[Python-3000] sets in P3K?

Greg Wilson gvwilson at cs.utoronto.ca
Mon Apr 24 18:44:45 CEST 2006


Interesting --- I think that being able to write down a data structure
using the same sort of notation you'd use on a whiteboard in a high school
math class is one of the great strengths of scripting languages, and one
of the things that makes it possible to use Python, Perl, and Ruby as
configuration languages (instead of the XML that Java/C# users have to put
up with).  I think most newcomers will find:

x = {2, 3, 5, 7}

more appealing than:

x = set(2, 3, 5, 7)

though I don't have any data to support that.

Thanks,
Greg

On Mon, 24 Apr 2006, Alex Martelli wrote:

> On 4/24/06, Barry Warsaw <barry at python.org> wrote:
> > On Mon, 2006-04-24 at 10:16 -0400, Greg Wilson wrote:
> >
> > > I'm sure we can work something out --- I agree, {} for empty set and {:}
> > > for empty dict would be ideal, were it not for backward compatibility.
> >
> > I dunno, the more I write dict() and set() the more I kind of like them
> > rather the literal alternatives (at least for the former).
>
> I concur -- and I would add list(), too (e.g. to get a copy of
> somelist's contents, i find list(somelist) *MUCH* more readable than
> the traditional somelist[:]).
>
> I'd love for py3k to focus on 'nailing down [some] builtin names'
> enough to allow the compiler to specialize many cases of, e.g.,
> dict(a=1,b=2) to make exactly the same bytecode as for {'a':1, 'b':2},
> and so on -- I suspect that focusing efforts on that "nailing down"
> would have much vaster benefits than focusing them on all sorts of
> punctuation-heavy syntaxes.
>
>
> Alex
>
>


More information about the Python-3000 mailing list