Gordon McMillan wrote: > >.. > > There's only one difference that matters: subclassing. I don't > think there's an incremental path to that that leaves Python > "easily extended". All of the differences matter! Inconsistency is a problem in and of itself. > But not a __name__. They really do have __name__s. Try it. type("").__name__ > > > They are not (yet) callable but I > > cannot think of a circumstance in which that would matter. > > Take a look at copy.py. copy.py only expects the type object to be callable WHEN there is a getinitargs method. Types won't have this method so it won't use the class callably. Plus, the whole section only gets run for objects of type InstanceType. The important point is that it is not useful to know that __class__ is callable without knowing the arguments it takes. __class__ is much more often used as a unique identifier for pointer equality and/or for the __name__. In looking through the standard library, I can only see places that the code would improve if __class__ were available for extension objects. -- Take a recipe. Leave a recipe. Python Cookbook! http://www.activestate.com/pythoncookbook
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4