I coined the term, bimorphic method, last week. Shortly after I wrote about them, I found I wanted a bimorphic property too. It’s the same idea: create a decorator that turns a method into a property getter for both the class object and instances of the class. Here’s an example.
Posts Tagged ‘python’
bimorphic properties, too.
Posted by kernelbob on June 26, 2008
Advertisements
Posted in computers, Uncategorized | Tagged: bimorphic, language, python | Leave a Comment »
Bimorphic methods in Python
Posted by kernelbob on June 15, 2008
Methods in Python are either instance methods (the default), static, or class methods. You can create the latter two using the @staticmethod and @classmethod decorators.
But maybe it would be better to have a single function that can be called either as a class method or an instance method. I coined the term bimorphic method for this, and I wrote a decorator that can make a method bimorphic.
Posted in computers | Tagged: geeky, parsing, python | 2 Comments »