Why this code is working?

Hussein B hubaghdadi at gmail.com
Wed Jan 14 10:57:48 CET 2009


On Jan 14, 11:55 am, Bruno Desthuilliers <bruno.
42.desthuilli... at websiteburo.invalid> wrote:
> Hussein B a écrit :
>
> > Hey,
> > Why this code is working?
>
> >>>> def f1( ):
> > ...      x = 88
> > ...      f2(x)
> > ...
> >>>> def f2(x):
> > ...      print x
> > ...
> >>>> f1( )
> > 88
>
> Well... Because it is correct ?
>
> What make you think it _shouldn't_ work ?

Because def2 is defined after def1 in an interpreted language, not
compiled.



More information about the Python-list mailing list