Old Man Yells At Cloud

Pavol Lisy pavol.lisy at gmail.com
Thu Sep 21 04:33:53 EDT 2017


On 9/20/17, Steve D'Aprano <steve+python at pearwood.info> wrote:
> On Wed, 20 Sep 2017 02:55 pm, Pavol Lisy wrote:

Thanks Steve, I agree with most of your mail and really appreciate
interesting reading! :)

> (a) "you save one character (two keystrokes)"; and

First I have to admit that I forgot space! But if we like to be
pedantic (what I am not sure) then we compare <space> vs <shift+( and
shif+)> so 1 vs 4 , right? So not two keystrokes but three?

> print ', '.join(str(obj) for obj in (foo, bar, baz))  # 52 chars
> # and builds up a potentially large string ahead of time

> print(foo, bar, baz, sep=', ')  # 30 chars
> # and DOESN'T build up a large string ahead of time
> # and is self-explanatory

I am totally on your side here! Just forgive me next:

print(f"{foo}, {bar}, {baz}")  # 29 :P

>> 3. "for sake of saving one character"? Could we really simplify
>> motivation of opposite side to just this? (what about breaking old
>> code?)
>
> I don't know what the motivation of the "print should be a statement!" side
> is,
> because they never say why it was better. (If they have said, I have never
> seen
> it.)

I am not sure if links below could bring a little light to this, but
probably it could be interesting:

Julia has print and println functions but has also printf macro. About
motivation why not function you could read here ->
https://stackoverflow.com/questions/19783030/in-julia-why-is-printf-a-macro-instead-of-a-function#19784718
and update of view is IMHO worth to read too ->
https://github.com/JuliaLang/julia/pull/11941#issuecomment-129966921



More information about the Python-list mailing list