A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/007196.html below:

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

[Python-Dev] extended print statement, uPre-PEPTim Peters tim_one@email.msn.com
Sun, 23 Jul 2000 23:40:18 -0400
[Paul]
> log.writeln($"post to ${listname} from ${sender}, size=${len(msg)}")

[Tim]
> 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))"

[Barry]
> 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

    %(name)format

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





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4