Renaming or Overloading In Python
Diez B. Roggisch
deets at nospam.web.de
Sun Mar 18 15:22:51 EDT 2007
gamename schrieb:
> Hi,
>
> I'm a recent convert from TCL. One of the more powerful aspects of
> TCL is the ability to rename a function at will (generally for testing
> purposes).
>
> Example from the tcl doc:
>
> rename ::source ::theRealSource
> set sourceCount 0
> proc ::source args {
> global sourceCount
> puts "called source for the [incr sourceCount]'th time"
> uplevel 1 ::theRealSource $args
> }
>
> So, is such a thing possible in Python?
def foo():
print 'foo'
bar = foo
bar()
Is it that what you mean?
Diez
More information about the Python-list
mailing list