简体   繁体   中英

Python variable naming convention

What is meaning of this rule? 1.mixedCase is allowed only in contexts where that's already the prevailing style (eg threading.py), to retain backwards compatibility.

mixedCase is allowed only in contexts where that's already the prevailing style (eg threading.py), to retain backwards compatibility

It means exactly what is says. Function names should only be mixed case - like doThing or computeAmount if that style is already in use in the containing module, of which threading.py is an example.

This is to cater for modules which were written before PEP8.

In any modern Python code you should use snake_case for function and variable names.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM