things I wish python could do

Andrew Bennetts andrew-pythonlist at puzzling.org
Thu May 13 04:37:11 EDT 2004


On Thu, May 13, 2004 at 10:07:19AM +0200, Jacek Generowicz wrote:
[...]
> 
> > I want a way to extend a class as easily as I can define it.
> 
> You can. There is one syntax for creating new classes, and another for
> mutating existing ones. Ruby conflates the two.
> 
> I think that what you "want" is to cleate new classes and mutate
> existing ones using the same syntax. Perhaps you should question
> whether you really want that.
> 
> Maybe there's a satisfactory solution based on the decorators that are
> being proposed in PEP 318:
> 
>   class Shape [update]:
>       def triangle(self, sideLength):
>           ...

Or there's the evil solution, available right now:
    http://www.intarweb.us:8080/evil/reopenable.py

-Andrew.





More information about the Python-list mailing list