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

Guilherme Polo ggpolo at gmail.com
Thu Dec 13 10:29:25 CET 2007


2007/12/13, Noam Raphael <noamraph at gmail.com>:
> 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.

Such thing wasn't considered, I doubt it will.

>
> 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?
>

d.keys()[5] won't work on python 3.0 aswell because it returns a view now.

> 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
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/ggpolo%40gmail.com
>


-- 
-- Guilherme H. Polo Goncalves


More information about the Python-3000 mailing list