Python's secret second argument to iter()



Python's secret second argument to iter()

Python's secret second argument to iter()

Iter can take TWO args, lets take a look.

Did you know that Python’s iter() builtin can actually take TWO arguments? This is a very obscure feature of Python. In this video we see how it differs from the very common single-argument form of iter(), how to use it, and what a better alternative is.

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosSampleCode
iter docs: https://docs.python.org/3/library/functions.html#iter
assignment expression docs: https://peps.python.org/pep-0572/

SUPPORT ME ⭐
—————————————————
Patreon: https://patreon.com/mCoding
Paypal: https://www.paypal.com/donate/?hosted_button_id=VJY5SLZ8BJHEE
Other donations: https://mcoding.io/donate

Top patrons and donors: Jameson, Laura M, Vahnekie, Dragos C, Matt R, Casey G, Johan A, John Martin, Jason F, Mutual Information, Neel R

BE ACTIVE IN MY COMMUNITY 😄
—————————————————
Discord: https://discord.gg/Ye9yJtZQuN
Github: https://github.com/mCodingLLC/
Reddit: https://www.reddit.com/r/mCoding/
Facebook: https://www.facebook.com/james.mcoding

CHAPTERS
—————————————————
0:00 Intro
0:12 Single arg iter
1:17 Two arg iter
5:47 Walrus operator