When naming variables, functions, and methods, the Style Guide for Python Code calls for “lowercase with words separated by underscores as necessary to improve readability.” It goes on to say “mixedCase is allowed only in contexts where that’s already the prevailing style (e.g. threading.py), to retain backwards compatibility.”
Fuck that.
You know, I usually like to do things by the book, and I’m obviously not going to claim to know better than Guido, but I really don’t understand this guy’s obsession with using underscores all over the place. Those things are ugly as hell. They should be reserved for other inherently ugly things like GLOBAL_VARIABLES. It’s bad enough that I have these hideous built-in __methods__ everywhere. I’m sticking with mixedCase until Python starts emitting warnings about it.
i went through a period of indecision trying to decide on camel case versus underscores, and camel case ultimately won out. it’s neater and less wasteful.
one of the problems i had (and this is when i was dealing with a lot of php) was using underscores for function names but camel case for variable names, but that was mostly due to my job at the time being reliant on drupal and the various apis available for it.
i’ve been working in visual basic a bit, and the ide is a big shift from web based languages written in notepad-like software. one of the things i remembered liking most about the visual basic ide was that it corrects the case for any variable or function you reference based on how you declared it, which makes the camel case that much more appropriate.
i think this is more of a global programming standards issue, and it seems kind of silly to me that it would be addressed in some language specific style guide, but all of the documentation i found regarding it was indecisive so i guess one way of determining a real standard would be to dictate the use of one or another in an ‘official’ capacity.
camelCase is actually the way forward in my view. We use JAX-B to marshall our model objects into XML where the camelCase is converted to camel-case to be compatible with XML.
Having said that, camelCase just looks wrong in PHP, but since I generally avoid PHP these days, it doesn’t bother me so much. I don’t like PHP’s idea of Object Orientation anyway.