TheDoctor

joined 7 months ago
[–] [email protected] 2 points 5 days ago

In the way that’s common in languages like Java where you’re making a property read-only, yes. But there’s a whole protocol in Python called descriptors where you can override the . on a field. The most common form of these is class methods annotated with the @property annotation, which makes it so the method can be accessed as if it were a property.

[–] [email protected] 5 points 5 days ago (1 children)

Yeah. I can understand the use case when it’s something relating to keeping simple state in sync by replacing it with derived state. But this particular case was flushing a cache after each get, which made each get of the property non-deterministic based on the class’s state.

[–] [email protected] 10 points 5 days ago (5 children)

I helped a friend debug a script last week that was working inconsistently in really weird ways. I looked at the script and it was all event hooks littered with sleep calls. I told him he was basically fuzz testing his own script and then getting surprised when he found race conditions. Shit was wild. Also, sometimes getters in Python are a mistake.

[–] [email protected] 65 points 2 weeks ago

You left out the part where, instead of telling him to knock it off as soon as they learned about it and disciplining him internally as a student, the school contacted law enforcement and allowed him to continue doing it so they could prosecute him harder make an example out of him. You’d think if he was as big of a threat as you’re implying, they would stop what he was doing ASAP. And if you’re going to be pedantic about leaving out details, maybe tell the whole thing. Maybe it’s not “honest” enough if we haven’t posted the full text of a documentary in a comment. That’s clearly your call.

[–] [email protected] 16 points 2 weeks ago

Worse than Bitcoin miners, AI seems to have the wholethroated support of capital (rather than a single faction), who see it as the next big form of automation

[–] [email protected] 7 points 1 month ago* (last edited 1 month ago) (1 children)
dozen = 12 + 1; // one extra for the baker!

I got mad at this when I first saw it but then I remembered there’s some code at work that defines an hour as 50 minutes

pain

[–] [email protected] 5 points 1 month ago

Statistically, this makes your code better

[–] [email protected] 3 points 1 month ago

Yeah…. I’ve definitely been the next guy on a couple bad regexes that I wrote

[–] [email protected] 4 points 1 month ago

When versioning and feature flags are too hard: just use git and hope for the best

[–] [email protected] 6 points 1 month ago (2 children)

My old senior used to do this before he got laid off and now I’m charge of code that’s littered with old commented out code and no way to know why it was commented out.

[–] [email protected] 5 points 1 month ago (2 children)

Then it breaks years after you’ve left and someone has no choice but to touch it

view more: next ›