[Python-Dev] Re: Guido's Magic Code was: inline sort option

Guido van Rossum guido at python.org
Thu Oct 30 13:00:59 EST 2003


> If there were a 'classonlymethod()' built-in, I'd probably use it, as I use 
> classmethods a fair bit (mostly for specialized constructors), but I don't 
> recall ever desiring to call one via an instance.  Do you have an example 
> of the use cases you see?

Not exactly, but I notice that e.g. UserList uses self.__class__ a
lot; I think that's the kind of area where it might show up.

> Hm.  What if your PickyClassmethod were a built-in called 'constructor' or 
> 'factorymethod'?  Probably too confining a name, if there are other uses 
> for class-only methods, I suppose.

I'm not convinced that we have a problem (beyond Alex lying awake at
night, that it :-).

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list