"Filip Gruszczynski" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |> If you want to just declare that name exist, but doesn't want to | > declare the type, why don't you just do this:
Names do not 'exist' in Python, nor do they have types. They are bound to objects that have types. Learn to program Python as Python, not one of those languages with a quite different model of names and values. | > def somefunc(): | > nonlocal = nonlocal Syntax error in 3.0. Error or nonsense in 2.x | > local = 0 # or None or [] or an initial value | > # | > return nonlocal * local | | Err.. I don't quite get. How it may help me? Could you explain? Forget the above. The only 'declarations' in Python, 'global' and 'nonlocal' are for the specialized purpose of *binding* names that are not in the local namespace of a function or nested function. They are only needed because otherwise names that get bound are otherwise assumed to be local. See the language ref section on function defs. tjr -- http://mail.python.org/mailman/listinfo/python-list