A small inconsistency in syntax?
James_Althoff at i2.com
James_Althoff at i2.com
Mon Oct 29 12:46:25 EST 2001
Brian Quinlan wrote:
>I could want to write:
>a = ['x value','y value','z value'] = x
>
>Here the intermediate list is doing 3 things for me:
>
>1. it's providing documentation
>2. it's forcing the sequence type to be of length 3
>3. it's making the type assigned to 'a' a list
and
4. it's providing a handy way to generate a syntax error ;-)
Python 2.2a1 (#21, Jul 18 2001, 04:25:46) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>>
>>> a = ['x value','y value','z value'] = 1,2,3
SyntaxError: can't assign to literal
>>>
Jim
More information about the Python-list
mailing list