Function parameter scope

Chris Rebert clp2 at rebertia.com
Wed Jul 28 22:05:53 EDT 2010


On Wed, Jul 28, 2010 at 7:00 PM, Navkirat Singh <navkirats at gmail.com> wrote:
> Hi,
>
> I had another question:
>
> What is the scope of  a parameter passed to a function? I know its a very basic question, but I am just sharpening my basics :)
>
> def func_something(x)
>
>        return print(x+1);
>
> Does x become a local variable or does it stay as a module scoped variable?
>
> Though I think its local, but just want to be sure.

Yes, it's indeed local. Also, you may wish to instead direct similar
basic questions to the Python Tutor mailinglist in the future:
http://mail.python.org/mailman/listinfo/tutor

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list