Is there an official way to add methods to an instance?
nagle at animats.com
Fri Apr 4 17:25:17 CEST 2008
Bruno Desthuilliers wrote:
> Paul Rubin a écrit :
>> Brian Vanderburg II <BrianVanderburg2 at aim.com> writes:
>>> I've checked out some ways to get this to work. I want to be able to
>>> add a new function to an instance of an object.
>> Ugh. Avoid that if you can.
> Why so ? OO is about objects, not classes, and adding methods on a
> per-object basis is perfectly legitimate.
It's what professional programmers call a "l33t feature",
one not suitable for production code. Typically such features
are used by programmers with about two years experience,
trying too hard to prove that they're cool.
More information about the Python-list