dict view to list
castironpi at gmail.com
Fri Mar 27 14:58:14 CET 2009
On Mar 27, 7:14 am, alex23 <wuwe... at gmail.com> wrote:
> On Mar 27, 3:44 pm, Aaron Brady <castiro... at gmail.com> wrote:
> > Is there a possibility of the dict_values, dict_items, and dict_keys
> > objects growing a 'tolist' method? It's one of those little things
> > that contributes to one's user experience.
> Probably not, because the Python approach is to use the builtins. I'm
> not sure what you feel mydict.values().tolist() might offer over the
> conventional list(mydict.values()).
> So yeah, -1.
I'd like to address this, even though if I weren't an interested
party, I'd probably recognize a -1 too. I'll try to be impartial.
The suggestion is entirely a "look and feel" observation. In an
interactive session, to examine the contents of a dictionary I've just
created, I need to type list(_), and lose the previous return value.
It's a better for my <anecdote> train of thought too.
I don't necessarily advocate that every collection and iterator should
grow one, though I don't really have the case for a special case for
dict views. OTOH, I find three 'tolist' methods in the standard
library: array, memoryview, and parser.ST. It could offer the same as
Mostly a convenience request I guess.
More information about the Python-list