[Python-Dev] extended print statement, uPre-PEP

Tim Peters tim_one@email.msn.com
Sun, 23 Jul 2000 23:40:18 -0400

> log.writeln($"post to ${listname} from ${sender}, size=${len(msg)}")

> where I've put back the comma from Barry's original.  Perhaps
> Barry will counter with
> print >> log, $"post to $listname from $sender, size=$(len(msg))"

> Actually, I'd counter with something quite similar, but much more
> Pythonic.
>     print >> log, 'post to %(listname)s from %(sender)s,
> size=%(msglen)s' % {
> 	'listname': listname,
> 	'sender'  : sender,
> 	'msglen'  : len(msg),
> 	}
> variants of which I use all the time!

Me too, but because there's nothing better:  Perl people think it's
*entirely* Pythonic to, e.g., need to type "listname" three times where they
only need to type it once <1/3 wink>.  That much redundancy on a single line
of code is not helpful at all.  This is simply an area where Perl is
friendlier & easier.  As I mentioned in another msg, Python's


shines when format is non-trivial; alas, plain unqualified %s formats
account for the vast bulk of uses in my experience.