return "".join(fmt.replace("%f", f"{self.weeks[i][0]:02d}").replace("%l", f"{self.weeks[i][1]:02d}").replace("%m", f"{self.month:02d").replace("%y", f"{self.year:024}") + "\n" for i in range(0, len(self.weeks)))
As a former sales engineer for an nlp company it looks like what happens when I checked my email and the CX team was demanding something 6 hours ago while I was on a flight back from a customer engagement. It never failed when shit hit the fan it was datetime related. And half of those were demanded of me while I was half asleep and half drunk.
166
u/fletku_mato Sep 12 '21
Wow. Such a pythonic snippet.
157
u/[deleted] Sep 12 '21
this is what Python masters on StackOverflow mean when they tell you there's a more pythonic way to write the program
180
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Sep 12 '21 edited Sep 12 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
53
u/[deleted] Sep 12 '21
Ah one liners.
Just because you can, does not mean you should
44
u/ThiagoFonseca Sep 12 '21
cutting the minifier's work in half. now that's efficient!
58
u/timeGeck0 Sep 12 '21
One liner to rule them all
25
u/Super-administrator Sep 12 '21
I don't know what the fmt library does, but I feel like this would just return
""20
u/Prestigious_River_34 Sep 12 '21
Yeah. No kidding. Can’t believe someone would leave that unformatted.
18
u/UltimatePlayerr Sep 12 '21
holy shoot, that's something I would expect from a virus trying to go around a antivirus software
18
u/_-o-0-O-vWv-O-0-o-_ Sep 12 '21
when someone with a perl background learns python
6
u/ZamilTheCamel Sep 13 '21
Average python user
4
u/Casey037 Sep 12 '21
They even got a for loop in there
2
u/OriginalTyphus Sep 12 '21
The use of 'range' triggers me more than the rest.
2
u/Simon_34545 Sep 13 '21
reminds me of something i made once
this is on a single line
2
u/AlexLovesBeans Sep 12 '21
Suckless be like:
1
u/articulatedbeaver Sep 12 '21
As a former sales engineer for an nlp company it looks like what happens when I checked my email and the CX team was demanding something 6 hours ago while I was on a flight back from a customer engagement. It never failed when shit hit the fan it was datetime related. And half of those were demanded of me while I was half asleep and half drunk.
1
u/JustAnotherGamer421 shameless Sep 12 '21
I mean one-liners are cool and all but...
1
u/Lewizkuz Sep 13 '21
I mean
You can do six flips and a kick-up to give me the date.
Or you can just give the damn date.
1
u/CunningBard1998 Sep 13 '21
Im imagining pep8 screaming at you
1
u/sixtyfifth_snow Sep 13 '21
That's why we need a pipeline operator or something similar like method chaining
1
u/Tomekske Sep 13 '21
It's okey, you shouldn't talk about that code anyway
1
u/themenotu Sep 13 '21
wait what the hell am i looking at
1
u/Moldybot9411 Sep 13 '21
So the code replaces the replacement of the replacement of the replacement of I dunno what lol
1
u/Sina_code Sep 16 '21
This is a whole damn project in just ONE line😑
1
u/konstantinua00 Sep 19 '21
if you put each dot on new line, you'd get stuff very similar to rust
0
u/weflown Sep 13 '21
It's Go guys, not Python.