[Python-3000] sets in P3K?

Guido van Rossum guido at python.org
Thu Apr 27 03:09:28 CEST 2006


On 4/26/06, Edward Loper <edloper at gradient.cis.upenn.edu> wrote:
> Guido van Rossum wrote:
> > I don't think this form (set(1, 2, 3)) will ever fly, because it would
> > makes set(x) ambiguous.
>
> For what it's worth, under the changes I was proposing set(x) would be
> unambiguous -- it would mean a set containing the single element x.

Unfortunately this would be (a) different from what it means today,
(b) different from what tuple(x) and list(x) mean; (c) make casts from
one collection type to another more cumbersome.

> A separate class method would be required to create a set containing the
> elements of an iterable x.  I would be -1 on any proposal that tries to
> make set(x) depend on the value of x.

Great.

> But I was only +0 on the proposal to begin with; and so if Guido's
> intuitions say that class method factories are "ugly and should be
> limited to cases that are rare but nevertheless useful," then it's
> fairly clear to me that this isn't the right way to go.  (Our BDFL's
> intuitions about what's ugly seem to be quite trustworthy.)

Thanks for the statement of trust. I needed that!

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list