On Fri, May 27, 2016 at 9:17 AM, Steven D'Aprano <steve@pearwood.info> wrote:
# apologies for breaking my own rule about realistic names
fee, fi, fo, fum = mydict.getmany('fee', 'fi', 'fo', 'fum')
so how again is the much better than:
> Isn't this the status quo? > a, b, c = [mapping[k] for k in ('a', 'b', 'c')]
the objection to that was that it gets ugly when you've got longer, more realistic names (and maybe more of them.)
fee, fi, fo, fum = [mapping[k] for k in ('fee', 'fi', 'fo', 'fum')]
only a little more typing, and in both cases, you need to specify the names twice.
(of course, they don't need to be the same names...)
-CHB
--
Christopher Barker, Ph.D. Oceanographer
Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception