instance + classmethod question

Mike Meyer mwm at mired.org
Sun Dec 11 18:42:15 EST 2005


Laszlo Zsolt Nagy <gandalf at designaproduct.biz> writes:
> Is it possible to tell, which instance was used to call the
> classmethod that is currently running?

Ok, I read through what got to my nntp server, and I'm still
completely confused.

A class method isn't necessarilry called by an instance. That's why
it's a class method. What should happen in that case?

You provided an example where you passed self as an optional
argument. If it's going to have self, shouldn't it be an instance
method?

I think I agree with Steven - you should use two methods. You deal
with the issue of duplicated code by pulling the code that would be
duplicated out into private methods. This would be a straightforward
refactoring problem.

            <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list