What can be the length of the identifier in Python? | Sololearn: Learn to code for FREE!

+5

What can be the length of the identifier in Python?

6/17/2021 4:30:18 AM

RuBeen Dahal๐Ÿ‘ฟ

10 Answers

New Answer

+6

According to this, identifiers have unlimited length: https://docs.python.org/3.9/reference/lexical_analysis.html#identifiers

+6

"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.

+4

Try an experiment. This identifier is 97 characters long https://code.sololearn.com/c8jPzY216hDI

+3

๐Ÿ…ผ๏ธŽ๐Ÿ†๏ธŽ ๐Ÿ…ท๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ†‚๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ…ฝ๏ธŽ 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

+2

๐Ÿ…ผ๏ธŽ๐Ÿ†๏ธŽ ๐Ÿ…ท๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ†‚๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ…ฝ๏ธŽ sources?

+2

๐Ÿ…ผ๏ธŽ๐Ÿ†๏ธŽ ๐Ÿ…ท๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ†‚๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ…ฝ๏ธŽ There is no limit of identifier. https://code.sololearn.com/cNHorTYeaat9/?ref=app

+2

seems like there are two people who are mass downvoting all of our answers

+1

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

0

79 characters In Python, the highest possible length of an identifier is 79 characters.

0

aspad๐Ÿ‡ฎ๐Ÿ‡ท seems like you are as wrong as ๐Ÿ…ผ๏ธŽ๐Ÿ†๏ธŽ ๐Ÿ…ท๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ†‚๏ธŽ๐Ÿ…ฐ๏ธŽ๐Ÿ…ฝ๏ธŽ , as proved by David Ashton sir