[Python-3000] Dropping the parentheses after dict.keys?
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Dec 13 21:19:03 CET 2007
Noam Raphael wrote:
> 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?
Half of your suggestion is being done -- d.keys() will create
and return an indexable view object, rather than a list.
Keeping it as a method rather than a property makes sense,
since it still involves the creation of an object rather than
just providing access to something already existing.
--
Greg
More information about the Python-3000
mailing list