Readit News logoReadit News
kryptocannon commented on How to Write the Worst Possible Python Code (Humor)   effective-programmer.com/... · Posted by u/naveed125
seanhunter · 9 months ago
I once was in the position of becoming pr approver[1] for a team of outsourced python programmers who were under some pretty extreme deadline pressure. Anyway one day a PR comes in and I can’t help but notice it was doing a string eval.

Weird. You almost never need to do string eval in python, and whenever there is something where you think you need eval there is a better and safer way to achieve the same result.

Also, I was bending my brain but I couldn’t really figure out what this eval was for until I wrote out some scratch code myself to figure it out.

Turns out this 5 lines or so was constructing a string to do dict lookup and then evalling that. So say you have a dict d = {‘foo’: ‘bar’} and you have a variable i=foo and want to look up d[i], instead of just doing that it was doing something like

   eval(‘d[‘+i+’]’)
Just no.

So I rejected the change and they came back with “but we’ve always done it that way”. I grep the codebase and yes. There were about 200+ uses of eval, all of which were constructing a string to look something up in a dictionary and then evaling the result. Some person who clearly didn’t program in python had found this twisted way to look things up in a dictionary and then this team had dutifully copied and pasted it throughout the codebase.

[1] ie I wasn’t there from the start of the project

kryptocannon · 9 months ago
> So I rejected the change and they came back with “but we’ve always done it that way”. I grep the codebase and yes. There were about 200+ uses of eval

That's code review's worst! Happened to me many times.

kryptocannon commented on Show HN: I completed shipping my desktop app   pimosa.app/... · Posted by u/anshrathodfr
rubymamis · a year ago
The problem with distributing standalone installers on Windows is that all non-popular apps are immediately regarded as malware by Windows Defender unless you go through the horrendous process of signing your app, which requires obtaining a certificate (which also requires forming a company that is not an LLC) and waiting more than a month while navigating multiple rounds of bureaucracy. I’ve done it for my app, and it was a terrible experience. Microsoft should study how Apple handles signing and notarization.

EDIT: spelling.

kryptocannon · a year ago
> which also requires forming a company that is not an LLC

I always thought that an LLC was sufficient, what's the actual requirement if an LLC is not enough?

kryptocannon commented on Building an ARM64 home server the hard way   jforberg.se/blog/posts/20... · Posted by u/jforberg
rcarmo · 3 years ago
I set up Proxmox on one of my Pi 4s (using an external SSD) and am quite happy with it. Runs four different LXC containers (one of which is a public-facing ActivityPub server for testing) and gives me zero headaches, so am currently looking for a beefier alternative that has a proper M.2 slot and at least 16GB of RAM...

I do wish that alternative boards had better OS support (especially the Rockchip ones, which tend to have weird kernel builds, etc),

kryptocannon · 3 years ago
Is there an official Proxmox build for the Raspberry Pi or are you using a third party?

u/kryptocannon

KarmaCake day5April 26, 2021View Original