pythonpython-2.7

What is the maximum length for an attribute name in python?


I'm writing a set of python functions that perform some sort of conformance checking on a source code project. I'd like to specify quite verbose names for these functions, e.g.: check_5_theVersionOfAllVPropsMatchesTheVersionOfTheAutolinkHeader()

Could such excessively long names be a problem for python? Is there a maximum length for attribute names?


Solution

  • 2.3. Identifiers and keywords from The Python Language Reference:

    Identifiers are unlimited in length.


    But you'll be violating PEP-8 most likely, which is not really cool:

    Limit all lines to a maximum of 79 characters.

    Also you'll be violating PEP-20 (the Zen of Python):

    Readability counts.