Is there an official way to add methods to an instance?
Charles Mason
cemasoniv at gmail.com
Fri Apr 4 12:08:17 EDT 2008
And for such a behavior they've termed "monkeying"
Thus, the coinage "Monkeypatching" for what you want to do:
http://mail.python.org/pipermail/python-dev/2008-January/076194.html
There are a group of people who think "monkeypatching is destroying ruby."
You still probably should avoid it for production code.
On Fri, Apr 4, 2008 at 11:25 AM, John Nagle <nagle at animats.com> wrote:
> 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.
>
> John Nagle
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080404/3fa2ad0f/attachment-0001.html>
More information about the Python-list
mailing list