[Python-3000] No Container Literals

Calvin Spealman ironfroggy at gmail.com
Sat Jul 8 20:40:31 CEST 2006


On 7/8/06, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 7/8/06, Calvin Spealman <ironfroggy at gmail.com> wrote:
> > Just throwing this out there, but I would love to see a complete
> > dropping of container literals from Python. That is why I proposed the
> > coercion syntax (ex: list from something) because it would allow
> > things like list(1, 2, 3)
>
> I don't see how your proposal solves the problem of distinguishing
> ``["abc"]`` from ``list("abc")`` where the former is a list of a
> single three-character element and the later is a list of three
> one-character elements.  And no, throwing away the <type>(<iterable>)
> constructor is not going to work -- it's far too useful.

With my proposals, list("abc") would the same as ["abc"] is today.
Creating a list of the characters in a string would be done with 'list
from "abc"', which would coerce a string into a list explicitly. Thus,
we still have an easy, and in my opinion more readable, method of
coercing any iterable (or any type) to any other type.

> Remember, Python 3000 is not a new language.  It's Python 2.X with
> some of the warts removed.
>
> Steve
> --
> I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
> tiny blip on the distant coast of sanity.
>         --- Bucky Katt, Get Fuzzy
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/ironfroggy%40gmail.com
>


More information about the Python-3000 mailing list