On 10/11/07, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > > Hi there. > > I just tried this test: > > ==== > def f(**kwds): > print kwds > > import UserDict > d = UserDict.UserDict(hello="world") > f(**d) > ==== > > And it fails with a TypeError exception ("f() argument after ** must be a > dictionary"). I find that weird, as UserDict should support all protocols that > dict supports, yet it doesn't seem to support ** unpacking. If instead of > UserDict I use a derivate class from dict (class mydict(dict):pass), the ** > operator works as expected. It also works if I execute f(**dict(d)) instead. > > Is that behavior expected? Is there any reason (performance, perhaps?) to > break > duck-typing in this situation?
Reported, accepted and closed 5 months ago: http://bugs.python.org/issue1686487 -- http://www.advogato.org/person/eopadoan/ Bookmarks: http://del.icio.us/edcrypt -- http://mail.python.org/mailman/listinfo/python-list