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']
> ['a', 'z', 'e'] ['aze'] [['a', 'z', 'e']] [['aze']]

Consider the following:
In [1]: list("Hello")
Out [1]: ['H', 'e', 'l', 'l', 'e', 'o']
and the list docstring:
list() -> new list
list(sequence) -> new list initialized from sequence's items
so list(list(t)) makes perfect sense: list(t) is ['a', 'z' ,'e'] and
list(list(t)) simply creates a new list initialized from that list's items
HTH,
Wayne
-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn't. - Primo Levi
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to