Smital Desai (6)

iter function with sentinnel

Hello Pythonistas, did you know that Python iter function has a two arg variant ? iter(func, sentinnel)However the func - must be a zero argument callable. for _ in iter(func, sentinnel): do_something()In this case, loop will run only till func produces the sentinnel value. In…

Continue reading...