dict view to list

Luis Gonzalez luismgz at gmail.com
Fri Mar 27 17:01:57 EDT 2009


Yes, I know the python approach is to use built-ins.
But wouldn't it be cool if we could do mydict.values().tolist()
instead?
It would be more regular and intuitive and readable from an OO point
of view.
In my oppinion, this would be cleaner.
Built-ins used like this look like an early decission made when
designing an imperative language.

Luis

On 27 mar, 09:14, 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.




More information about the Python-list mailing list