[Python-Dev] PEP 216 (string interpolation) alternative EvalDict

Skip Montanaro skip@pobox.com
Mon, 14 Jan 2002 16:39:16 -0600


    Paul> Sorry I wasn't clear. Let's say it's the second hour of our
    Paul> Perl/Python class.

    Paul> Here's Perl:

    Paul> $a = 5;
    Paul> $b = 6;
    Paul> print "$a $b";

    ...

    Paul> Here's Python:

    Paul> a = 5;
    Paul> b = 6;
    Paul> print "%(a)s %(b)s" % vars()

So?  There are some things Perl does better than Python, some things Python
does better than Perl.  Maybe this is a (small) notch in Perl's gun.  It
just doesn't seem significantly better enough to me to warrant a language
change.  I would have written the Python example as

    print a, b

For the simple examples that would normally arise in an introductory
programming class, I think Python's print statement works just fine.  For
more hairy cases, Perl probably wins.  That's life.

but-that's-just-me-ly, y'rs,

-- 
Skip Montanaro (skip@pobox.com - http://www.mojam.com/)