how to tell a method is classmethod or static method or instance method

Nathan Rice nathan.alexander.rice at gmail.com
Wed Feb 15 13:31:44 EST 2012


> And I'll take this opportunity to plug my dualmethod descriptor:
>
> http://code.activestate.com/recipes/577030-dualmethod-descriptor/

I use an analogous pattern in SQL Alchemy all the time (it's called
hybridmethod/hybridproperty there).

+1 to dualmethod, that pattern is great when you want a method or
property that does something concrete when passed an instance, or
something abstract relating to all instances when passed a class.


Nathan



More information about the Python-list mailing list