* Steven D'Aprano, on 13.07.2010 01:50:
On Mon, 12 Jul 2010 22:57:10 +0200, Alf P. Steinbach /Usenet wrote:

Existence of a variable means, among other things, that

    * You can use the value, with guaranteed effect (either unassigned
    exception
      or you get a proper value): in particular, you won't be accessing a
      global if you're using the name of a local declared by a later
      assignment.

That is too strong. Given the global code:

x

(where x doesn't exist in the global namespace, and therefore does not
exist, as you agreed earlier) Python promises to raise NameError. By the
above definition, this counts as "variable x exists".

But surely that is undesirable -- that implies that *all* variables
exist. Even $...@*@( is a variable that exists, as that is guaranteed to
raise SyntaxError.

Hm, I already answered someone else here committing that logic error.

In one case an exception is generated by removing a variable.

In the other case an exception is generated by adding a variable.


Cheers & hth.,

- Alf

--
blog at <url: http://alfps.wordpress.com>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to