Re: Note about getattr and '.'
Steven D'Aprano wrote: On Tue, 21 Nov 2006 22:39:09 +0100, Mathias Panzenboeck wrote: Yes, this is known. I think IronPython uses a specialized dictionary for members, which prohibits malformed names. I don't know if there will be such a dictionary in any future CPython version. (Would be good.) Why would it be good? How many bugs have you found that were caused by this behaviour? It's not bugs. A specialized dictionary could be better optimized if you know it can only hold Python identifiers. There's talk of such a dictionary in Python 3000. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Note about getattr and '.'
On Tue, 21 Nov 2006 22:39:09 +0100, Mathias Panzenboeck wrote: [EMAIL PROTECTED] wrote: There is an interesting skewness in python: class A(object): pass a=A() setattr(a, '$foo', 17) getattr(a, '$foo') 17 But I can't write a.'$foo' Yes, this is known. I think IronPython uses a specialized dictionary for members, which prohibits malformed names. I don't know if there will be such a dictionary in any future CPython version. (Would be good.) Why would it be good? How many bugs have you found that were caused by this behaviour? -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list