Am Montag, den 04.07.2005, 20:25 -0400 schrieb Roy Smith:
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> > Should we *really* be encouraging newbies to mess with globals() and
> > locals()? Isn't that giving them the tools to shoot their foot off before
> > teaching them how to put shoes on?
>
> W
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> Should we *really* be encouraging newbies to mess with globals() and
> locals()? Isn't that giving them the tools to shoot their foot off before
> teaching them how to put shoes on?
Why risk damaging perfectly good footwear?
But, seriously, I agree wit
On Mon, 04 Jul 2005 21:17:21 +0200, tiissa wrote:
> Josiah Manson wrote:
>> Hello. I am very new to Python, and have been unable to figure out how
>> to check if a variable exists or not. In the following code I have made
>> a kludge that works, but I think that it would be clearer to check if
>>
"tiissa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Variables are stored in two dictionnaries: globals() (for global
> variables) and locals() (for the local ones, which are also global on
> top level).
Within a function, the local namespace is usually *not* a dictionary.
D=lo
George Sakkis wrote:
> Hi Josiah,
>
>> Hello. I am very new to Python, and have been unable to figure out how
>> to check if a variable exists or not. In the following code I have made
>> a kludge that works, but I think that it would be clearer to check if
>> closest exists and not have to initi
Hi Josiah,
> Hello. I am very new to Python, and have been unable to figure out how
> to check if a variable exists or not. In the following code I have made
> a kludge that works, but I think that it would be clearer to check if
> closest exists and not have to initialize it in the first place. H
"Josiah Manson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello. I am very new to Python, and have been unable to figure out how
> to check if a variable exists or not. In the following code
Python does not have variables is the sense some other languages do. It
has (typele
Josiah Manson wrote:
> Hello. I am very new to Python, and have been unable to figure out how
> to check if a variable exists or not. In the following code I have made
try:
variable
except NameError:
# variable doesn't exist
else:
# variable exists
But it is rare that you actually ne
Josiah Manson wrote:
> Hello. I am very new to Python, and have been unable to figure out how
> to check if a variable exists or not. In the following code I have made
> a kludge that works, but I think that it would be clearer to check if
> closest exists and not have to initialize it in the first