Re: [Tutor] the sense of brackets

2008-11-24 Thread Lie Ryan
On Sat, 22 Nov 2008 22:58:48 +0100, spir wrote: > W W a écrit : > > On Sat, Nov 22, 2008 at 9:42 AM, spir <[EMAIL PROTECTED]> wrote: > > > >> I have long thought "[]" /simply/ is a list constructor syntax. What > >> do you think of the following? > >> > >> t = "aze" > >> print t, list(t), [

Re: [Tutor] the sense of brackets

2008-11-22 Thread Kent Johnson
On Sat, Nov 22, 2008 at 10:42 AM, spir <[EMAIL PROTECTED]> wrote: > I have long thought "[]" /simply/ is a list constructor syntax. list(x) and [x] are not equivalent, as you have discovered. list(x) requires that x is a sequence - something that can be iterated - and it makes a new list out of t

Re: [Tutor] the sense of brackets

2008-11-22 Thread spir
W W a écrit : > On Sat, Nov 22, 2008 at 9:42 AM, spir <[EMAIL PROTECTED]> wrote: > >> I have long thought "[]" /simply/ is a list constructor syntax. >> What do you think of the following? >> >> t = "aze" >> print t, list(t), [t] >> print list(list(t)), list([t]), [list(t)], [[t]] >> ==> >> aze ['

Re: [Tutor] the sense of brackets

2008-11-22 Thread W W
On Sat, Nov 22, 2008 at 9:42 AM, spir <[EMAIL PROTECTED]> wrote: > I have long thought "[]" /simply/ is a list constructor syntax. > What do you think of the following? > > t = "aze" > print t, list(t), [t] > print list(list(t)), list([t]), [list(t)], [[t]] > ==> > aze ['a', 'z', 'e'] ['aze'] > ['

[Tutor] the sense of brackets

2008-11-22 Thread spir
I have long thought "[]" /simply/ is a list constructor syntax. What do you think of the following? t = "aze" print t, list(t), [t] print list(list(t)), list([t]), [list(t)], [[t]] ==> aze ['a', 'z', 'e'] ['aze'] ['a', 'z', 'e'] ['aze'] [['a', 'z', 'e']] [['aze']]