[Python-Dev] Currently baking idea for dict.sequpdate(iterable, value=True)

Walter Dörwald walter@livinglogic.de
Tue, 26 Nov 2002 11:49:35 +0100


Guido van Rossum wrote:

> >>  x = {}.sequpdate(...)
> >>
> >>which suggests that you're really looking for a different constructor
> >>as a class method.
> >
> >Yes!
> >
> >Will revise the patch accordingly
> >and use Just's suggested name, fromseq().
> >
> >Do you prefer the default value to be None or True?
> >Earlier discussions on python-dev showed that
> >True is more meaningful to some in the context of
> >membership testing.  OTOH, dict.setvalue and
> >dict.get both use None.
>
>
> I think it should be None -- let's be explicit when we want True.

And maybe the method should be named fromkeyseq, because there
is another constructor that creates the dict from a sequence
of items. (Maybe this constructor should be made into a
class method fromitemseq?)

Bye,
    Walter Dörwald