Executing a modified function

Gerhard Häring gerhard.haering at gmx.de
Thu Jan 2 16:24:32 EST 2003


Dave Bazell wrote:
> If I enter python

The interactive interpreter, I suppose.

> and run a funtion, then I modify it

How do you modifiy it? Do you compile a new function bound to the same
name, like I do below?

> and try to run it again, it appears I execute the old version.

Not for me:

#v+
>>> def foo(): print 4
...
>>> foo()
4
>>> def foo(): print 5
...
>>> foo()
5
#v-

> Is there a way to force the new version to be executed in this
> situation, without leaving python and starting again?

Can you demonstrate with a code snippet how Python doesn't do what you
expect it to do?

Gerhard
-- 
Favourite database:             http://www.postgresql.org/
Favourite programming language: http://www.python.org/
Combine the two:                http://pypgsql.sf.net/
Embedded database for Python:   http://pysqlite.sf.net/




More information about the Python-list mailing list