[Python-Dev] what is a dict_keys and where can I import it from?
Andrew Svetlov
andrew.svetlov at gmail.com
Tue Feb 12 11:18:21 CET 2013
More information about the Python-Dev mailing list
Tue Feb 12 11:18:21 CET 2013
- Previous message: [Python-Dev] what is a dict_keys and where can I import it from?
- Next message: [Python-Dev] what is a dict_keys and where can I import it from?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Is collections.KeysView good for you? On Tue, Feb 12, 2013 at 9:05 AM, Chris Withers <chris at simplistix.co.uk> wrote: > Hi all, > > So, dicts in Python 3 return "something different" from their keys and > values methods: > >>>> dict(x=1, y=2).keys() > dict_keys(['y', 'x']) >>>> type(dict(x=1, y=2).keys()) > <class 'dict_keys'> > > I have vague memories of these things being referred to as views or some > such? Where can I learn more? > > More importantly, how can I tell if I have one of them? > I guess I can keep a reference to type({}.keys()) somewhere, but that feels > a bit yucky. Should these things be in the types module? > > cheers, > > Chris > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > - http://www.simplistix.co.uk > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com -- Thanks, Andrew Svetlov
- Previous message: [Python-Dev] what is a dict_keys and where can I import it from?
- Next message: [Python-Dev] what is a dict_keys and where can I import it from?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list