Why self?

Fernando Pérez fperez528 at yahoo.com
Tue Jul 9 17:59:01 EDT 2002


Louis M. Pecora wrote:

> 
> Hmmm...a pretty bizzare example or else I just don't have enough
> programming experience.  I've never done anything close to that.  I
> will have to rely on others experience (including yours, which I know
> is substantial).  Is this realistic or are you just pulling out a
> pathological example for argument?

Well, if you care you can look at http://www-hep.colorado.edu/~fperez/ipython/

IPython is a replacement for the normal interactive interpreter with a ton of 
added features. Amongst those, it is fully extensible by the user, even at 
run time. This requires adding methods to the instance of the interpreter you 
are running on top of while it is running, and those methods are actually 
automatically generated code (via parametrized method templates). So it's 
somewhat funky kung-fu, but it works beautifully.

In my view, that flexibility (users can customize the environment a lot 
without ever touching the source) is one of ipython's strong points, and a 
lot of it would have been an utter nightmare to write (if possible at all) in 
a language without the dynamism and flexibility of python.

So I for one, would scream bloody murder if you tried to remove python's 
ability to dynamically modify objects at run-time and even with code they 
themselves autmatically write and compile while active.

If you call that bizarre, I simply call it 'you hadn't thought of it yet'.

Cheers,

f.



More information about the Python-list mailing list