Thoughts on new vs traditional idioms
Bob Ippolito
bob at redivi.com
Sun Feb 29 09:27:12 EST 2004
On 2004-02-29 06:49:36 -0500, Peter Otten <__peter__ at web.de> said:
> Raymond Hettinger wrote:
>
>> d = {'a':1}
>> d.__init__([('b',2), ('c',3)]) # update with an items list
>> d.__init__(d=4, e=5) # update with keyword arguments
>> d.__init__(mydict) # update with another dictionary
>
> This is the first time I've seen the init as update idiom - this is clearly
> not a case of love at first sight. Objects cumulating data over subsequent
> calls of __init__() seems unintuitive to me.
>
> Why isn't dict.update() enhanced to handle all three cases? You might
> actually use the same implementation for both __init__() and update().
I submitted a small patch last week to correct this (well, to support
the first case, not the kwargs), but it was -1 or -0 by several people,
including guido, and ended up rejected.
-bob
More information about the Python-list
mailing list