Positional-only and keyword-only arguments in Python
Make function args positional or keyword-only.
In Python, it's possible to force a function argument to be positional-only or keyword-only. In this video, we see the syntax for doing this, as well as see some examples and reasons for why you might want to actually make a parameter positional-only or keyword-only.
Note: positional-only arguments are a Python 3.8+ feature. Keyword-only are Python 3.0+.
Errata:
1. At 1:22 you'll get a TypeError, not a SyntaxError.
― mCoding with James Murphy (https://mcoding.io)
Source code: https://github.com/mCodingLLC/VideosSampleCode
Positional-only PEP: https://peps.python.org/pep-0570/
Keyword-only PEP: https://peps.python.org/pep-3102/
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, Dragos C, Vahnekie, John Martin, Casey G
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
1:08 Keyword-only arguments
4:50 Positional-only arguments
7:45 Uncommon to use both
8:29 Speed test, position args are faster
Видео Positional-only and keyword-only arguments in Python автора Секреты Творческого Процесса
Видео Positional-only and keyword-only arguments in Python автора Секреты Творческого Процесса
Информация
28 сентября 2023 г. 4:28:55
00:09:48
Похожие видео