Prothon is switching to the .NET platform

Christopher T King squirrel at WPI.EDU
Tue Aug 10 22:20:16 CEST 2004

On Tue, 10 Aug 2004, John Roth wrote:

> "Christopher T King" <squirrel at WPI.EDU> wrote in message
> news:Pine.LNX.4.44.0408101527020.9982-100000 at
> > On Fri, 6 Aug 2004, John Roth wrote:
> >
> > > The place where this gets really ugly is inserting functions
> > > into the instances. They have to be created at the module
> > > level, and then inserted into the instance by a module level
> > > function (somewhat similar to the way classmethod,
> > > staticmethod and property work).
> >
> > Oh, I wouldn't even attempt that until Python supported
> > "def object.method():" syntax (like Prothon does).
> It actually works quite nicely.

Oh, I know you can do it in standard Python, but like you say, it's ugly ;)

> Your suggested syntax would be a definite plus, but I'm not holding my
> breath until there are a number of people using some variety of
> prototype package in Python. It's a classic chicken and egg problem.
> On the other hand, it could simply be waiting on someone writing a PEP
> and giving some believable use cases for wanting to insert random
> methods into instances.

I thought there was already a PEP for it, but a quick scan reveals none.  
I know it's been brought up before, though.

> I'm not familiar with your system,

Basically, derive(foo) returns a new object whose __getattr__ references 
foo.  A side effect of this is that you can subclass derive for great 

> but there's no particular difficulty inserting methods into either a
> class or an instance. You just have to know the correct way to wrap it.
> To put it into an instance, you have to wrap it in new.instancemethod.

Some of us are just too darn lazy to do that ;)

More information about the Python-list mailing list