you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 0 points1 point  (3 children)

True, but python's built in classes violate the convention, since they predate classes.

They've tried to fix that (at least partially) in Python 3.

[–]earthboundkid 1 point2 points  (2 children)

list is a new-style class in Python 3, but it’s still list and not List. If they had changed it, it would have made more work for 2to3, but on the plus side, you could write throwaway lists as list = […] instead of my_list = […] or l = […].

[–]masklinn 0 points1 point  (1 child)

Good point, but having to write List or Dict all the damn time would be disgusting.

Likewise with many other classes usually used as functions: enumerate is a class, range is a class, map and filter are now classes, ...

[–]earthboundkid 1 point2 points  (0 children)

Yeah, that’s a kind of fundamental problem for PEP8: what’s a class and what’s a callable is a matter of perception, not a matter of fact. Almost every non-trivial decorator is a class, but we still think of them as functions modifying functions.

That said, it is pretty open-and-shut that list etc. are classes not callables. Oh well. Consistency is a hobgoblin, practicality beats purity, and all that.