[Python-3000] sets in P3K?
Jim Jewett
jimjjewett at gmail.com
Tue Apr 25 20:59:49 CEST 2006
On 4/25/06, Terry Reedy <tjreedy at udel.edu> wrote:
> I can see an argument that the appropriate
> response to more types is a compensating decrease in syntax
> (as in dropping [xx] as a synonym for list(xx)) rather than adding
> more.
Great. Except then how would you create a collection in the first place?
Right now, I use the awkward
set(["asdf", "asdf2"])
set(list("asdf", "asdf2")) #syntax error
set(tuple("asdf", "asdf2")) #syntax error
set(tuple(("asdf", "asdf2"))) # just add parens? Or does that go too?
We need at least one literal for sequences. We currently have list
(ordered, mutable), tuple (ordered, immutable), and dict (unordered,
mutable, associative).
The question is whether we should also have one for unordered
collections. This is the datatype that we really want for most "x in
y" tests, but getting rid of the extra information may not be
important enough to use up literals.
-jJ
More information about the Python-3000
mailing list