
1 Apr
2008
1 Apr
'08
6:13 a.m.
2008/3/31, Mathias Panzenböck grosser.meister.morti@gmx.net:
Maybe dictionary unpacking would be a nice thing?
d = {'foo': 42, 'egg': 23} {'foo': bar, 'egg': spam} = d print bar, spam
42 23
Bad idea.
It uncovers a lot of details for your brain to take care when doing that, for example:
d = {'foo': 42, 'egg': 23} {'not': bar, 'egg': spam} = d print bar
???
{'egg': bar, 'egg': spam} = d print bar
???
I would consider something like the following:
bar, spam = d.multiple("foo", "egg")
with the semantics of:
bar, spam = [d[k] for k in ("foo", "egg")]
Regards,
--
. Facundo
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/