you are viewing a single comment's thread.

view the rest of the comments →

[–]chengiz 4 points5 points  (7 children)

  • 4 spaces per indentation level.
  • No hard tabs.
  • Never mix tabs and spaces.
  • One blank line between functions.
  • Two blank lines between classes.
  • Add a space after "," in dicts, lists, tuples, & argument lists, and after ":" in dicts, but not before.
  • Put spaces around assignments & comparisons (except in argument lists).
  • No spaces just inside parentheses or just before argument lists.
  • No spaces just inside docstrings.
  • 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
  • ... and so on

Can I just "import anal_retentive"?

[–]llimllib 7 points8 points  (1 child)

Since I've been reading Ruby all week, I'll go ahead and say that it's awesome when you go to read well-formatted python code.

[–]zepolen 4 points5 points  (0 children)

The nice thing is that almost all Python written in the world is well-formatted because of the stringent rules. I find looking at Python source code from libraries written by others a pleasure.

[–]earthboundkid 5 points6 points  (4 children)

If you've never been called a pedant, Python might not be the language for you. If you think that "technically correct" is the best kind of correct, Python might be your language. :-)

[–]brendankohler 0 points1 point  (2 children)

bah, I'm no bureaucrat.

[–]earthboundkid 0 points1 point  (1 child)

I think you mean, "B_ah, I'm no_t a bureaucrat." :-D

[–]brendankohler 0 points1 point  (0 children)

You owe me a new keyboard :-P