Python built-in next supports default value

By ubaumann, Tue 17 August 2021, modified Tue 17 August 2021, in category Brief Byte

Python

Python built-in next function supports default value for exhausted iterators.

win_symbols = iter("🥇🥈🥉🍺")
next(win_symbols, '  ')

https://docs.python.org/3/library/functions.html#next

example usage of jc