about functions question

Diez B. Roggisch deets at nospam.web.de
Thu Oct 25 02:44:20 EDT 2007


NoName schrieb:
> I try it:
> 
> def b():
>   ...
>   a()
>   ...
> 
> def a():
>   ...
>   b()
>   ...
> 
> b()
> it's not work.

It works.


def a():
     print "a"
     b()


def b():
     print "b"
     print a   # not calling!


b()

But if you really call a in b, you create an endless loop. In all 
programming languages, btw.


> Is it possible pre-define function like in c++

No.
> or place functions code
> after main block?

Yes.



More information about the Python-list mailing list