What can be the length of the identifier in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What can be the length of the identifier in Python?

17th Jun 2021, 4:30 AM
RuBeen Dahal👿
9 Answers
+ 5
According to this, identifiers have unlimited length: https://docs.python.org/3.9/reference/lexical_analysis.html#identifiers
17th Jun 2021, 5:31 AM
David Ashton
David Ashton - avatar
+ 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.
17th Jun 2021, 2:38 PM
A͢J
A͢J - avatar
+ 3
Try an experiment. This identifier is 97 characters long https://code.sololearn.com/c8jPzY216hDI
17th Jun 2021, 5:42 AM
David Ashton
David Ashton - avatar
+ 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
17th Jun 2021, 11:19 AM
Bot
Bot - avatar
17th Jun 2021, 6:33 AM
Bot
Bot - avatar
+ 1
seems like there are two people who are mass downvoting all of our answers
17th Jun 2021, 12:34 PM
Bot
Bot - avatar
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
17th Jun 2021, 10:21 AM
aspad🇮🇷
aspad🇮🇷 - avatar
- 1
aspad🇮🇷 seems like you are as wrong as 🅼︎🆁︎ 🅷︎🅰︎🆂︎🅰︎🅽︎ , as proved by David Ashton sir
17th Jun 2021, 11:05 AM
Bot
Bot - avatar