[Python-ideas] More useful slices

Rob Cliffe rob.cliffe at btinternet.com
Mon Feb 2 15:44:27 CET 2015


On 02/02/2015 12:48, João Santos wrote:
> L = ['foo', 'bar', 'baz'] is syntactic sugar, you can write L = 
> list('foo', 'bar', 'baz')
No you can't (at least not in Python 2.7.3).  (A good advertisement for 
testing your code before publishing it. )  It has to be L = list(('foo', 
'bar', 'baz')) which is using a tuple literal.



More information about the Python-ideas mailing list