undefined variable

Peter Hansen peter at engcorp.com
Sat Jan 27 03:20:39 EST 2001


shaka wrote:
> 
>  hi, I am a beginner learning python, and I have notice that in python
> variale are not declared or defined. But does it mean that your cannot use
> the same variable twice and all your variable have to be of different name.
> In java you can have a variable of the same name but of different type and
> it makes programming much more flexible.

It sounds like you are looking for the concept called "namespaces",
or perhaps "scope".  Java can have variables of the same name but 
different type defined *in different places*, such as in two 
separate methods.

Python is no different in this respect.

Or did I misunderstand your (unclear) question?



More information about the Python-list mailing list