Sometimes I need to use variable name like max, or len, but they are somehow occupied by the python library method. Should I instead just use _max or max_?
What is the conversion for these variable naming style?
From pep8 official documentation:
single_trailing_underscore_: used by convention to avoid conflicts with Python keyword, e.g.
Tkinter.Toplevel(master, class_='ClassName')
There's no such convention, at least not in PEP 8, what is mentioned in PEP 8 that may apply is the following:
If a function argument's name clashes with a reserved keyword, it is generally better to append a single trailing underscore rather than use an abbreviation or spelling corruption. Thus class_ is better than clss. (Perhaps better is to avoid such clashes by using a synonym.)
maxlenor something likemax_length. If it's the length of something, uselength. Don't use weird underscores :Pmax_orlen_