method that can be called from a class and also from an instance

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Nov 22 23:23:22 EST 2012


On 2012年11月22日 07:14:29 -0800, Marc Aymerich wrote:
> Hi,
>> I want to create a method within a class that is able to accept either a
> class or an instance.

You want my "dualmethod" decorator:
http://code.activestate.com/recipes/577030/
-- 
Steven


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /