Hi,

I would like to have a method that is both a classmethod and an
instancemethod. So:

class MyClass(object):
  @class_or_instance
  def myfunc(cls_or_self):
    pass

The semantics I'd like are:
When you call MyClass.myfunc, it gets passed a class
When you call MyClass().myfunc, it gets passed an instance

I'm sure I've seen some code to do this somewhere, but I can't find it
now. Any help appreciated.

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

Reply via email to