New user's initial thoughts / criticisms of Python

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Nov 9 16:01:46 EST 2013


On 09/11/2013 20:33, Mark Janssen wrote:
>
>> * Call me pedantic by why do we need a trailing comma for a list of one
>> item? Keep it intuitive and allow lstShopping=[] or ["Bread"] or
>> ["Bread", "Milk","Hot Chocolate"] I don't like ["Bread",]. It bugs me.
>
> This one got answered, it has to do with the parser when dealing with parens.
>

It got answered and was simply mistaken, no comma is needed but a comma 
will be accepted.  How did the parser enter into this, or are you also 
thinking about tuples?

 >>> mylist=['Bread']
 >>> mylist
['Bread']
 >>> mylist=['Butter',]
 >>> mylist
['Butter']

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence




More information about the Python-list mailing list