On Wed, Aug 3, 2011 at 9:25 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:

> gc wrote:
>
> > Target lists using comma separation are great, but they don't work
> > very well for this task. What I want is something like
> >
> > a,b,c,d,e = *dict()
>
> a, b, c, d, e = [dict() for i in range(5)]
>

I think this is good code -- if you want five different dicts, then you
should call dict five times. Otherwise Python will magically call your
expression more than once, which isn't very nice. And what if your datatype
constructor has side-effects?

Katriel
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to