[Python-3000] sets in P3K?

Nick Coghlan ncoghlan at gmail.com
Sat Apr 29 13:55:23 CEST 2006


Paul Moore wrote:
> One downside, which I only point out because someone will, is that
> optimization opportunities will be lost for the usual reason - the
> optimizer can't be sure that set (or whatever) hasn't been reassigned.
> But I still see that as something to be addressed independently, if at
> all.

If we decide to go this route (supporting braced calls), I'd quite like to see 
{} become a simple abbreviation for dict{}, similar to the way [] would be an 
abbreviation of list{} and () would be an abbreviation of tuple{}.

While I felt the optimisation benefits of a set literal were worth mentioning, 
they're significantly less important to me than the readability benefits.

Maybe {1, 2, 3} should actually result in the old pseudo-set of {1:None, 
2:None, 3:None}. It eliminates the type ambiguity as bare braces would always 
result in a dict, and getting a real set or frozenset is just a matter of 
putting the relevant name before the first brace.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list