<[EMAIL PROTECTED]> wrote:
>In Python, you usually can use parentheses to split something over
>several lines. But you can't use parentheses for an assignment of
>several lines.

Yes you can, you just need an iterable of the right length on
the other side for the tuple unpacking to work:

>>> (CONSTANT1,
... # This isn't a syntax error
...  CONSTANT2,
...  CONSTANT3, #and neither is this
...  CONSTANT) = [1] * 4
>>> [ (k, v) for k, v in locals().items() if k.startswith("CONSTANT") ]
[('CONSTANT', 1), ('CONSTANT1', 1), ('CONSTANT3', 1), ('CONSTANT2', 1)]
>>> 

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to