Sujet : Re: Triggered By Mediocre Code (Posting On Python-List Prohibited)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.pythonDate : 26. Aug 2024, 01:49:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vagfus$24uu6$5@dont-email.me>
References : 1 2
User-Agent : Pan/0.160 (Toresk; )
On Sun, 25 Aug 2024 15:07:45 -0700, Paul Rubin wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
I mean, really? Four lines to do what could be done in a single
expression? Was that written by a PHP programmer, do you think?
It is not fluent Python, that's for sure. No idea about PHP though. I
have been wondering about PHP recently. The language is painful but the
implementation has some attractions and it's widely available.
I earn part of my living from it. It’s something I use when I have to
(e.g. writing WordPress plugins). I don’t know what these “attractions”
are that you speak of: Python is at least as widely available, and it does
better than PHP at Web-based programming (supposedly PHP’s bread and
butter) because ASGI-based frameworks allow common handling of WebSocket
connections together with regular HTTP ones, which is more awkward in PHP.
Is this what you had in mind?
bufferedNumber = f'{doc.GetTime().GetFrame(docFps):04}'
Printf style makes it explicit that it is an integer, and nothing else
will do:
bufferedNumber = "%0.4d" % doc.GetTime().GetFrame(docFps)
The irony of my putdown is that PHP can do it about as simply. But don’t
expect your typical PHP programmers to know that ...