On Sat, Apr 17, 2010 at 12:03 PM, Dino Viehland <di...@microsoft.com> wrote: > Maciej wrote: >> On Sat, Apr 17, 2010 at 11:38 AM, Dino Viehland <di...@microsoft.com> >> wrote: >> > Benjamin wrote: >> >> 2010/4/17 Guido van Rossum <gu...@python.org>: >> >> > On Sat, Apr 17, 2010 at 9:22 AM, Nick Coghlan <ncogh...@gmail.com> >> >> wrote: >> >> >> Guido van Rossum wrote: >> >> >>> Because Python promises that the object the callee sees as >> 'kwargs' >> >> is >> >> >>> "just a dict". >> >> >> >> >> >> Huh, I thought kwargs was allowed to be implemented as a >> >> >> string-keys-only dict (similar to class and module namespaces) >> while >> >> >> still be a valid Python implementation. I guess I was wrong. >> >> > >> >> > Actually I don't know about that. Is there language anywhere in >> the >> >> > language reference that says this? What do IronPython, Jython, >> PyPy >> >> > actually do? >> >> >> >> Similar to CPython, PyPy has dict versions optimized for strings, >> >> which fall back to the general version when given non-string keys. >> > >> > IronPython as well. The only place we use a string only dict is for >> > new-style classes whose dict's are wrapped in a dictproxy. >> >> And yet that breaks some code :-) > > Sure, if you do: > > class C(object): > locals()[object()] = 42 > > dir(C) > > You lose. Once I'm aware of some piece of code in the wild doing this > then I'll be happy to change IronPython to be more compatible. :) >
There was one thing in sqlalchemy tests, not sure exactly why. There were also other things that I've seen, but consequently it was decided that it's only accidentally working on CPython and namespace should contain string-only keys. Cheers, fijal _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com