+ 5
What can be the length of the identifier in Python?
9 Réponses
+ 5
According to this, identifiers have unlimited length: https://docs.python.org/3.9/reference/lexical_analysis.html#identifiers
+ 5
"Python identifiers are unlimited in length" but as per PEP-8 you should limit identifier to a maximum of 79 character for better readability but there is no restriction.
+ 3
Try an experiment. This identifier is 97 characters long
https://code.sololearn.com/c8jPzY216hDI
+ 2
🅼︎🆁︎ 🅷︎🅰︎🆂︎🅰︎🅽︎ and aspad🇮🇷 here is a 10000 chars long identifier, not even remotely close to your 79 chars limit myth:
https://code.sololearn.com/cGQqsDdLPG4e/?ref=app
+ 1
🅼︎🆁︎ 🅷︎🅰︎🆂︎🅰︎🅽︎ sources?
+ 1
🅼︎🆁︎ 🅷︎🅰︎🆂︎🅰︎🅽︎
There is no limit of identifier.
https://code.sololearn.com/cNHorTYeaat9/?ref=app
+ 1
seems like there are two people who are mass downvoting all of our answers
0
In Python, the highest possible length of an identifier is 79 characters. Python is a high level programming language. It’s also a complex form and a collector of waste.
Python, particularly when combined with identifiers, is case-sensitive.
When writing or using identifiers in Python, it has a maximum of 79 characters.
Unlikely, Python gives the identifiers unlimited length.
However, the layout of PEP-8 prevents the user from breaking the rules and includes a 79-character limit
- 1