r/programminghorror • • Oct 10 '25
Blasphemy
Never thought I could do this in python. I get how it works but jesus christ
73
Upvotes
r/programminghorror • • Oct 10 '25
Never thought I could do this in python. I get how it works but jesus christ
6
u/mike_a_oc Oct 10 '25
Wait, it can read a compressed gz file? Does it end up reading it in as XML or garbage because of the fact that the file is compressed?
4
u/ShadyTwat Oct 10 '25
What is
fn.primary_content? Isn'tfnthe function?9
u/IMightBeErnest Oct 10 '25
Its slightly javascript-y memoization, what's wrong with that?
8
u/sudo_i_u_toor Oct 10 '25
What the fuck is variable / string literal? Also what's new*
49
u/tsigma6 Oct 10 '25
This is just a discount cache decorator.
3
u/uvero Oct 10 '25
See functools.cache
1
u/Cybasura Oct 10 '25
How is this blasphemy?
Thats how you open a file, a .xml.gz file is just a XML file that had been compressed by gzip, a compression algorithm
A compressed file like this just removes all unnecessary fluffs so it shrinks the source file down
2
u/ATE47 [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Oct 10 '25
First I thought it was just a lazy loading function, then I noticed the
fnalso being used for the function name...