On Wed, 14 May 2008 09:21:10 -0700, vbgunz wrote:
> [...] 
> when you see
> one, what is the first thing that comes to mind? When you write one,
> what was the first thing on your mind? Other than "similar to static-
> methods", at what point will you be glad you used one? To sum it up,
> what is the best role for a class-method that does not turn your work
> into code-soup?

The first thing on my mind when I see a classmethod is that I may need a 
metaclass here.

class A(object):
    @classmethod
    def do_something_with_aclass(cls):
        pass

    @classmethod
    def do_something_diffferent_with_aclass(cls):
        pass

    def do_something(self):
        pass

is similar to:

class M(type):
    def do_something_with_aclass(cls):
        pass
    
    def do_something_diffferent_with_aclass(cls):
        pass

class A:
    __metaclass__ = M
    
    def do_something(self):
        pass

-- Ivan
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to