Bobbing for Kernels

See Bob. See Bob bob. Bob, Bob, bob!

Posts Tagged ‘python’

bimorphic properties, too.

Posted by kernelbob on June 26, 2008

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.

Read the rest of this entry »

Advertisements

Posted in computers, Uncategorized | Tagged: , , | 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.

Read the rest of this entry »

Posted in computers | Tagged: , , | 2 Comments »