Function calling another function

Satish Chimakurthi skchim0 at engr.uky.edu
Mon Mar 1 18:52:44 EST 2004


Hi all,

Thanks a lot and sorry. It was an indentation mistake. Caused havoc for 30
mins for me.


Thanks again

Regards,
Satish


----- Original Message ----- 
From: "Diez B. Roggisch" <deets_noospaam at web.de>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Monday, March 01, 2004 4:14 PM
Subject: Re: Function calling another function


> > My question is surely a basic one, but somehow, I am not able to figure
it
> > out.
> <snip>
> > When I execute satish.py, main() executes. I was expecting y() to
execute
> > first and then x() and then y() again. I wanted function x() to be
capable
> > of calling function y(). With this form of code, seems like function x()
> > is not recognising function y(). Is there any sort of import or anything
> > else that I can do here ??
>
> Works for me:
>
> def main():
>     y()
>     x()
>
>
> def y():
>     print "y"
>
> def x():
>     print "x"
>     y()
>
> main()
>
> gives me:
>
>
> x
> y
> x
>
> As expected.
> -- 
> Regards,
>
> Diez B. Roggisch
> -- 
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list