The Python standard library and PEP8
chambon.pascal at wanadoo.fr
Sun Apr 19 19:33:14 CEST 2009
I agree that there are still some styling inconsistencies in python
stdlib, but I'm not advocating a cleaning because I've always found
camelCase much prettier than those multi_underscore_methods :p
Concerning the length property of strings, isn't the __len__() method
I know they're not usual in OOP languages, but builtins like len() and
iter() might be better anyway, since they deal with some magical
problems (CF "special attributes lookups" in the python documentation)
Emmanuel Surleau a écrit :
> Hi there,
> Exploring the Python standard library, I was surprised to see that several
> packages (ConfigParser, logging...) use mixed case for methods all over the
> place. I assume that they were written back when the Python styling
> guidelines were not well-defined.
> Given that it's rather irritating (not to mention violating the principle of
> least surprise) to have this inconsistency, wouldn't it make sense to clean
> up the API by marking old-style, mixed-case methods as deprecated (but
> keep them around anyway) and add equivalent methods following the
> lowercase_with_underscores convention?
> On an unrelated note, it would be *really* nice to have a length property on
> strings. Even Java has that!
More information about the Python-list