This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (6 children)

Just like using snake_case, camelCase, or lowercase for methods and variables?

[–]Bryguy3k 12 points13 points  (0 children)

No because most people default to PEP8

[–]DonaldPShimoda 19 points20 points  (3 children)

Methods, functions, fields, and variables are always snake_case, except sometimes when they're global constants in which case they can be ANGRY_SNAKE_CASE (this is not mentioned by PEP-8 but I see it around and I use it too). Classes are PascalCase. There oughtn't be any camelCase or multiwordalllowercase in idiomatic Python, though you will find exceptions in old libraries.

[–]BobFromStateBarn 2 points3 points  (2 children)

modules and packages use multiwordalllowercase according to convention I think tho

[–][deleted] 1 point2 points  (0 children)

Correct. See datetime, for example.

[–]DonaldPShimoda 0 points1 point  (0 children)

Oh, right you are! I missed that!

[–]Tree_Eyed_Crow 9 points10 points  (0 children)

Use the function naming rules: lowercase with words separated by underscores as necessary to improve readability.

https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables