Sujet : Re: Triggered By Mediocre Code (Posting On Python-List Prohibited)
De : piergiorgio.sartor.this.should.not.be.used (at) *nospam* nexgo.REMOVETHIS.de (Piergiorgio Sartor)
Groupes : comp.lang.pythonDate : 27. Aug 2024, 19:38:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <qhf1qk-664.ln1@lazy.lzy>
References : 1
User-Agent : Mozilla Thunderbird
On 25/08/2024 23.53, Lawrence D'Oliveiro wrote:
Looking at this article about the top three languages for getting
programming jobs
<https://www.zdnet.com/article/want-a-programming-job-make-sure-you-learn-these-three-languages/>,
naturally I couldn’t help noticing the code in the screenshot at the
top (my transcription):
bufferedNumber = str(doc.GetTime().GetFrame(docFps))
if len(bufferedNumber)<4:
for x in range(len(bufferedNumber),4):
bufferedNumber = "0" + bufferedNumber
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?
That the more correct question would be:
What is easier to read? And to debug?
The four line version or the one liner?
To paraphrase someone:
"If the length of a program would be
measured by the time needed to understand
it, some program would be too short to
be short."
Because the world is plenty of one liner
nobody (almost) doesn't understand.
There is even a category in the OCC
(
https://www.ioccc.org/).
Don't get me wrong, I like and dislike
one liner.
Namely, I like mine and dislike the others :-)
bye,
-- piergiorgio