python function defs/declarations

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Jul 5 10:00:21 EDT 2006


bruce:
> is there a way for me to do this..
>
> print "hello"
> foo()
>
> def foo():
>  i = 2
>  print "i = "i
>
> ie, to use 'foo' prior to the declaration of 'foo'

Generally no you can't, you have to define a name before using it.
Why do you want to do that?

Bye,
bearophile




More information about the Python-list mailing list