On 10/9/06, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote: > There are a few sane choices for the semantics of 'var': > > 1. The variable is visible from 'var' to the end of the scope. > If 'var' doesn't specify an initial value, accessing the variable > before it gets assigned to is an error. > > 2. The variable is visible from 'var' to the end of the scope. > If 'var' doesn't specify an initial value, 'None' is used. > > 3. The variable is visible from the beginning to the end of the scope. > Accessing the variable before the 'var' is executed is an error. > If 'var' doesn't specify an initial value, 'None' is used.
Of these, only (3) specifies what happens if the variable is referenced before the 'var' statement. And that one makes 'var x' mean exactly the same as 'x = None'. None of them make it clear what the effect of 'var' is in a context where an outer (or global) definition of the variable is available. I don't see any way in which the proposed statement is any less confusing than the current semantics - it's just confusing in a different way. So, on the basis that Py3K shouldn't be breaking code unless there's a good justification[1], this proposal (in any form) gets a solid -1 from me. Paul. [1] My interpretation of PEP 3002 is that Py3K, although it is allowed to break backward compatibility, should not do so arbitrarily, or without a clear and relatively strong justification. _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
