New submission from Mike Siegel <[email protected]>:
Perhaps I'm missing something here but this behavior seems unexpected to me.
"Lists
The items of a list are arbitrary Python objects. Lists are formed by
placing a *comma-separated* list of expressions in square brackets. (Note that
there are no special cases needed to form lists of length 0 or 1.)"
>>> import sys
>>> print(sys.version)
3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0]
>>> test = [ "foo" "bar" ]
>>> type(test)
<class 'list'>
>>> print(test)
['foobar']
>>> import json
>>> json.dumps({ "foo": test })
'{"foo": ["foobar"]}'
>>>
In a complex dict structure this is an easy way to shoot yourself in the foot.
----------
messages: 386725
nosy: mikesiegel
priority: normal
severity: normal
status: open
title: Lists without commas?
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43180>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com