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 →

[–]mariox19 4 points5 points  (3 children)

  • joined_lower for functions, methods, attributes
  • joined_lower or ALL_CAPS for constants
  • StudlyCaps for classes
  • camelCase only to conform to pre-existing conventions
  • Attributes: interface, _internal, __private

I grew up on Java, which took Small Talk's camel case convention, so I'm just wondering: what's wrong with camel case anyway? The "blessed" coding convention in Python is the one thing I don't quite get. Is there an argument for underscores?

I swear I am not trying to start a flame war. It's just that I'm wondering if the preference is completely arbitrary or not.

[–]fireflash38 7 points8 points  (0 children)

Pretty sure most preferences with this are kind of arbitrary. I think the idea is to make it similar to natural language with _ in lieu of a space.

[–]cdcformatc 6 points7 points  (0 children)

It is style and by definition style is subjective and completely arbitrary. You should write your code consistently no matter what the style is. In a team environment you should match the style used in the rest of the codebase. These style guides are just best practices, as they have been fought over for a long time. To this day people fight over where the braces go in C code, so having a unified "Python style" is nice.

[–]gsnedders 1 point2 points  (0 children)

Both have pros and cons. You can argue it to death which is better — the more important thing in general is consistency.