local variable 'p' referenced before assignment

Pankaj Jangid pankaj.jangid at gmail.com
Sun Sep 8 14:50:44 EDT 2019


David <bouncingcats at gmail.com> writes:
>
https://docs.python.org/3/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python 
>
> " If a variable is assigned a value anywhere within the function’s body,
> it’s assumed to be a local unless explicitly declared as global."
>

Coming with a baggage of other languages. :-) I should have searched
it. Thanks a lot for sharing this.

Regards.

-- 
Pankaj Jangid



More information about the Python-list mailing list