Chocolate [was Re: Python Books for 2002]
Moshe Zadka
moshez at zadka.site.co.il
Tue Apr 10 12:31:06 EDT 2001
On 10 Apr 2001 14:24:28 +0200, Konrad Hinsen <hinsen at cnrs-orleans.fr> wrote:
> Back to Python:
>
> from Europe.France import chocolate, wine, cheese # comment out one of
> from Europe.Italy import chocolate, wine, cheese # these lines
> from Europe.Germany import bread
> from Europe.Netherlands import vla
> ...
>
> for food in dir():
> if food[:2] != '_':
> eat(food)
Fatso! ;-)
You meant, if food[:1] != '_', otherwise you'd eat people's private
foods too...
But what I would do is:
d = {}
exec '''\
from Europe.France import chocolate, wine, cheese # comment out one of
from Europe.Italy import chocolate, wine, cheese # these lines
from Europe.Germany import bread
from Europe.Netherlands import vla
...
''' in d, d
for food in d.values():
eat(food)
--
"I'll be ex-DPL soon anyway so I'm |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
-- Wichert Akkerman (on debian-private)| easier, more seductive.
For public key, finger moshez at debian.org |http://www.{python,debian,gnu}.org
More information about the Python-list
mailing list