why in returns values for array and keys for dictionary
Erik Max Francis
max at alcyone.com
Tue Aug 26 02:52:59 EDT 2008
++imanshu wrote:
> Wouldn't it be nicer to have 'in' return values (or keys) for both
> arrays and dictionaries. Arrays and Dictionaries looked so similar in
> Python until I learned this difference.
It's because dealing with keys makes far more sense, since that's how
the dictionary data structure works. If you're doing this an awful lot
-- whether testing for inclusion or iterating -- then you're probably
using the wrong data structure.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
Well I have been puppetized / Oh how I have compromised
-- Lamya
More information about the Python-list
mailing list