- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Anyone got that one clip from Fantasia ready? The one where the brooms go out of control with their buckets? Because this feels a lot like an apprentice going mad with the power at their fingertips.
Admin
TRWTF is this comment moderation. What did ray10k say? Should i avoid saying anything in case I just repeat it?
I could be wrong, but I don't recall significant spam issues before it was introduced. Now I see a ton of comments on recent articles that still haven't been moderated. If you're going to implement a moderation queue, at least be bothered to resolve it frequently!
Admin
I think it's just because I'm not registered. Besides, this is a comment box on the internet. Erring on the side of caution is reasonable enough.
Admin
(Also, there definitely were issues before. I remember that about a year back, getting articles spammed with >100 spam comments (usually with lots of gross/violent pictures to further pad the length) was common. Really, I prefer having my comments held for moderation over having to worry about getting a face-full of whatever grossness the trolls can cook up.)
Admin
It's a protection against uncertainty. Instead of maybe be exposed to annoying spammy messages, we are definitely exposed to annoying redacted ones. In terms of UX it's clearly top tier, up there with material design or Microsoft Bob.
Admin
That's why my code has no comments, its all been held for moderation.
Admin
It looks like that
while True: … break
is utterly pointless, since thebreak
is not conditionally executed. Which if this code ever gets executed from anywhere with a complex call stack will make this all thoroughly unpleasant.Admin
"So, first, we check the current recursion limit. Then, we try setting the recursion limit to two. If the current recursive depth is greater than two, then when we try to change the recursion limit it throws a RecursionError. So catch that, and then try again with one higher recursion limit." The real WTF(TM) is Remy. What he writes there is not what the code does. It /stores/ the current recursion limit (not checking anything), then sets the recursion limit to two (no reason why that ever would throw a RecursionError, so n will not be increased - but even if there was a RecursionError, the break will happen anyway, so the while True will only run once). I mean, the code is still very much insane, but differently so than Remy writes.
Admin
Remy is closer than you think. Note he says "If the current recursive depth is greater than two," not the limit. If you call sys.setrecursionlimit(2) when you're already two function calls deep, it fails because it would already be over the limit.
You're right about the break though; there should either be a continue in the except: clause or the break should be within an else:.
Admin
If you want to ‘delegate property access to other classes’, wouldn't inheritance be the One Obvious Way To Do It?
Admin
Footgun. First time I've seen that word used.
My FORTRAN's rusty so I may have got the syntax slightly wrong.
Admin
https://docs.python.org/3/library/sys.html#sys.setrecursionlimit
"If the new limit is too low at the current recursion depth, a RecursionError exception is raised."
Admin
Well, no, not really. Not with nested classes. Mind you, you have to think about this a bit.
Which is more than the OP did, and to his/her credit, they realised it.
Composing behaviour is a different thing to inheriting behaviour. In this case, the two are smooshed via Python's (perfectly legitimate) implementation of operator overload. Incidentally, I don't see why Remy has a problem with operator overload, but hey, that's just me. I think we all have a problem with cyclic object graphs and infinite recursion, let alone a silly attempt to control infinite recursion.
tl;dr Just compose contained objects naturally, using the Bridge pattern (aka, in C++, pimpls). The whole point of an object, in any object oriented language, is to control behaviour and access to data members. Leave the Jitter to solve the existential crisis of "oh, my, I've got a reference to a reference to a reference."
In short, be elegant. Don't be a prat.
Admin
I think the only time one of my guest posts got moderated was when I connected via TOR. After all, only malicious spammers would ever try to post a comment over TOR, right?
Admin
[code] Proper Fortran: DO 10 I=1,5 SHOOT_TOE(I) 10 CONTINUE STOP END
Addendum 2018-09-11 17:56: Someone might tell me how to put code in a comment one of these days.
Admin
Why the hell do people use this abortion survivor of a language, I don't know.
Admin
Apparently it's markdown, so you use three graves on either side.
Admin
Three graves on either side is what Voldemort could use, if he would use graves at all.
Admin
+1. Especially when that spam was longer than all useful comments together or even containing endless streams of NSFW pictures. Still got my userscript from back then that i used as a workaround
Admin
Important note for non-Python programmers:
__getattr__
is only called if the attribute is not found the usual way (in__dict__
or in the class's__dict__
- the latter of which covers how__slots__
works)There's also
__getattribute__
which is technically more gets called for every case, and thus is more analogous to__setattr__
or__delattr__
- but is rarely what you want.One useful thing you can do:
Admin
This sentence is staying with me:
"This is an impressive amount of effort into constructing a footgun."