[Python-3000] Dropping the parentheses after dict.keys?

Noam Raphael noamraph at gmail.com
Thu Dec 13 10:24:42 CET 2007


Hello,

Was it considered to drop the parentheses after "dict.keys()", to make
it "dict.keys" (that is, to make it a property instead of a method
with no arguments)? If it was, please forgive me - a few minutes of
googling didn't find it.

I now write (another?) ordered dict, and I thought that the easiest
way to get the key with a given index would be "d.keys[5]". But it
means that d.keys is a collection of keys, not a method - and why not?

If backwards compatibility is a problem, we can make d.keys return the
same object that d.keys() currently returns, and add to the dict_keys
object a calling operation which raises a warning and returns itself.

Of course, d.values and d.items are the same.

Have a good day,
Noam


More information about the Python-3000 mailing list