Executing a modified function

Gerhard Häring gerhard.haering at gmx.de
Thu Jan 2 22:24:32 CET 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:

>>> def foo(): print 4
>>> foo()
>>> def foo(): print 5
>>> foo()

> 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?

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