itertools to iter transition

David M. Cooke cookedm+news at physics.mcmaster.ca
Wed Mar 30 15:51:40 EST 2005


Steven Bethard <steven.bethard at gmail.com> writes:

> Terry Reedy wrote:
>>>But if classmethods are intended to provide alternate constructors
>> But I do not remember that being given as a reason for
>> classmethod().  But I am not sure what was.
>
> Well I haven't searched thoroughly, but I know one place that it's
> referenced is in descrintro[1]:
>
> "Factoid: __new__ is a static method, not a class method. I initially
> thought it would have to be a class method, and that's why I added the
> classmethod primitive. Unfortunately, with class methods, upcalls
> don't work right in this case, so I had to make it a static method
> with an explicit class as its first argument. Ironically, there are
> now no known uses for class methods in the Python distribution (other
> than in the test suite).

Not true anymore, of course (it was in 2.2.3). In 2.3.5, UserDict,
tarfile and some the Mac-specific module use classmethod, and the
datetime extension module use the C version (the METH_CLASS flag).

And staticmethod (and METH_STATIC) aren't used at all in 2.3 or 2.4 :-)
[if you ignore __new__]

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list