views:

1378

answers:

8

All members are camel case, right? Why True/False but not true/false, which is more relaxed?

+11  A: 

It's the way Guido indented it!

Ali A
You mean intended? :)
Joan Venge
Must have been invented
Johan Dahlin
I'd change it, then again I find that typo too amusing:)
Torsten Marek
It's a standing in-joke, not a typo.
chaos
This should go to http://stackoverflow.com/questions/234075/programmer-jokes-whats-your-best-one
Abgan
A: 
no_a_member_can_be_anything_the_language_allows
leppie
Yes, but I mean the guidelines. Does it make sense to use pascal casing if the default members are camel cased?
Joan Venge
+18  A: 

Form Pep 285:

Should the constants be called 'True' and 'False' (similar to None) or 'true' and 'false' (as in C++, Java and C99)?

=> True and False.

Most reviewers agree that consistency within Python is more important than consistency with other languages.

This, as Andrew points out, is probably because all (most)? built-in constants are capitalized.

James Sulak
Thanks James, but isn't the default casing is camel casing in python?
Joan Venge
It is for classes. There are different rules for other things.Scroll to "Naming Conventions": http://www.python.org/dev/peps/pep-0008/
Baltimark
+2  A: 

Here's a possible explaination:

I see that naming conventions are such that classes usually get named CamelCase. So why are the built-in types named all lowercase (like list, dict, set, bool, etc.)?

Because most of them originally were types and factory functions, not
classes - and a naming convention is not a strong reason to make backwards incompatible changes. A different example: the new builtin type set is based on (altough not exactly equal to) the Set class from the sets module

Stephen Pape
+8  A: 

All of python's built-in constants are capitalized or [upper] CamelCase:

Andrew Jaffe
Constants, yes, but all other members are camelCased, right?
Joan Venge
@Andrew: Don't you mean PascalCased rather than camelCased ?
Kev
@Kev, yes, but technically, I think "upper CamelCase" is the same as PascalCase.
Andrew Jaffe
A: 

Cozz python is inconsistent.

Natasha
You mean like with None and Ellipsis, the other built-in named literals?
Ignacio Vazquez-Abrams
Actually more for things like len, str, bool, etc, but having to capitalise these constant, just makes it slower to type.
Natasha
`len`, `str`, `bool` etc are [builtins](http://docs.python.org/library/functions.html), which are all lowercase.. I don't see how Python is inconsistent..
dbr
A: 

True and False are capitalized in Haskell, the other language which uses indentation as syntax.

Justice
A: 

I'd say that they're called True and False because they're singletons.

Geo