[ python-Bugs-1071248 ] Documented grammar for List displays
incorrect (testlist)
SourceForge.net
noreply at sourceforge.net
Fri Dec 17 01:00:13 CET 2004
Bugs item #1071248, was opened at 2004-11-22 12:26
Message generated for change (Comment added) made by kermode
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1071248&group_id=5470
Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Lenard Lindstrom (kermode)
Assigned to: Jeremy Hylton (jhylton)
Summary: Documented grammar for List displays incorrect (testlist)
Initial Comment:
In section 5.2.4 of the Python Reference Manual for
Pythons 2.4 and 2.3 the definition
testlist ::= test ( "," test )* [ "," ]
should be
testlist ::= test [ ( "," test )+ [ "," ] ]
to conform with the definition of testlist_safe in the
Grammar definition file. In other words, a trailing
comma is not permitted if there is only one test in
testlist.
----------------------------------------------------------------------
>Comment By: Lenard Lindstrom (kermode)
Date: 2004-12-16 16:00
Message:
Logged In: YES
user_id=663274
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> [x for x in 1,]
File "<stdin>", line 1
[x for x in 1,]
^
SyntaxError: invalid syntax
>>> [x for x in 1,2,]
[1, 2]
>>> for x in 1,:
... print x
...
1
>>>
----------------------------------------------------------------------
Comment By: engelbert gruber (grubert)
Date: 2004-12-15 00:50
Message:
Logged In: YES
user_id=147070
but
>>> testlist = 1,
>>> testlist
(1,)
so testlist = 1 does not produce a list
testlist ::= one "," ( another "," )* [and [","]]
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1071248&group_id=5470
More information about the Python-bugs-list
mailing list