- 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
Pro tip: if you're ever unsure of the best way to write a block of code, just write it in the most naive way possible, post it to The Daily WTF, and wait for someone to show you the right way to do it.
It's sort of like crowd-sourcing code quality.
Admin
Finally we get a good comment.
Admin
As I noted on /r/python, not all combinations. Order is irrelevant in combinations, meaning 'aaZ' and 'Zaa' would not both appear. This code creates all k-permutations with repetition.
The best one liner that doesn't express the pathological conditions (early termination if {9,Z,z} is not the last element in wlc, and |wlc|^15 steps if {9,Z,z} not in wlc) someone came up with is:
Trying to reproduce the pathological conditions would be... interesting.
Admin
I'm sick of these motherfuckin' dicks fuckin' my motherfuckin' ass!
Admin
Any decent QA engineer knows that's the first thing to look for.
Admin
All code like this should be re-indented to look like a hand with a raised middle finger, flipping the bird at the future maintainer.
Admin
Interestingly enough I was just thinking something similar. Of course the down side to such massively difficult to learn languages (spoken as someone who is nearly proficient enough in Haskell to say so), is that while you're learning it you still write a lot of code that if not quite at the level of WTF exhibited here is at least still considered a minor WTF by someone proficient in the language.
On the topic of Python I'm afraid it's quickly sliding into the realm of Javascript and VB, as the go to language of shitty programmers. It isn't quite there yet thankfully, WTFs in Python are still relatively few, but I have a feeling we'll be seeing a lot more Python posts on here before too much longer. I await with baited breath the very first Haskell WTF to be posted (I'm sure we'll see one eventually I just can't imagine what it's going to look like).
Admin
Of course another WTF is assuming they don't want to generate passwords with more than 15 characters.
No, no WTF there.
What's the point of a 16+ character generated password?
If people can change them, they will, and to something they can remember.
If people can't change them, they're just going to get pissed off that you're trying to make them remember 16 or more characters of garbage - and this is never good, one way or another.
If these are never being used by human beings directly, then it probably ought to be using something more awesome than a password, like an SSH key or certificate.
I can't think of a sane design, ever, that requires such a thing as what that would be.
Admin
Admin
That's nothing. I used to work on a product where the low level file and database api routines were so old, they were written when the proprietary language only had space for 4 different variables at a time. That meant all the variables in the whole thing were called q1,q2,q3 or q4. Cue much swapping of variables inside subroutines. Basically if a database query did something weird and the debugger took you into one of those libraries, you just gave up and worked around it.
Admin
Except that because whitespace matters so much, Python is a language where something like this is painful beyond belief, and utterly painful to have to deal with - far more so than the same code written in Java or C#.
Stuffing up the indentation in Python is equivalent to mismatching brackets in those languages - a guaranteed bug.
Admin
Whatever. Wimps need more than four variables. I only use more when I HAVE to to come down to your level -- I hate the mess when numb-skull coders' heads explode.
I believe you've seen some of my clever work here in many of the articles. Those are MINE, and I will sue everyone who reads the code.
Admin
I think today's WTF certainly qualifies as a pathological condition... I can't imagine what kind of diseased mind wrote that code...
Admin
FTFY
Admin
Admin
Column 6 was for continuation. You could put anything there EXCEPT a blank, or the digit zero as they indicated the first card.
The other thing to remember was that white space was NOT significant except in hollerith or quoted text strings (usually in format statements).
Admin
I've seen this code before: http://www.python-forum.org/pythonforum/viewtopic.php?f=1&t=27111
That guy posted this code, claiming he got it from somewhere else.
Is Jakob working for the same company as the guy who created that thread? Or maybe they both ripped the code from some common source?
Admin
Comment from the original author, in the post where he seems to have first shared this: "The script isn't very fast."
Admin
Sounds like he's got more than enough snake to choke himself with.
Admin
Good thinking! It saddens me that the original thread is full of praise. Maybe if the original post had elicited responses more along the lines of those found in the python-forum.org thread, people wouldn't be so eager to replicate the code (then again, maybe they would...).
Admin
Hell, when I started, I was going to do it in php - The kind folks here quickly put a stop to that, and I have now learnt how to use CGI (Common Gateway Interface, not graphics stuff) so that I can use C and Perl for my web page instead of PHP!!
Admin
It's quite amusing, people argue to the death that the technology they have just discovered is the "new black", and then wonder why quickly it gets a reputation as a "shit programmer's" technology. They never seem to make the connection that perhaps people actually listened to all the costs about how cool dah new stuff is. People have been (and continue) singing the wonders of Python to all who will listen, and then seem surprised when some dopey pricks actually listen, but don't understand how to use it...
sigh Sorry, I finished my grumpy bit. I going back to my Ol' C now....
Admin
Admin
Oh, don't mind. You can be sure he would be able to get some kind of code working on any language. And you really don't want to see how he does that.
The correct procedure is to fire this sort of programmer, letting him realise there could be something wrong with him. Unfortunately, that is also the last used route.
Admin
Take Nagesh with you if you can. Thanks!
Admin
Admin
I suppose you similarly ridicule science ficton fans because they all wear pointy plastic ears.
Admin
For fuck's sake, what is the point of asterisking out letters on a work that is at best mildly profane? For that matter, what is the point of doing it even to words which are presumably intended to be and are generally accepted as obscene? Everyone knows you just wrote "cunt" even if you took the trouble to obscure the u or n.
Either clean up your language, or let it all out.
Admin
Admin
Admin
Are you trolling? You prefer something like the abomination that is VB.NET? Fucking underscore gives me conniptions now. I don't mind telling the compiler I'm done with a command. What's wrong with semicolons?
Admin
Oh my god. Thank you for making my day. This is far better than the submission.. SO MUCH BETTER.
Admin
Why spred hatred like this? be solid like Anna hazare.
Admin
It occurs to me: has anybody, on reading a WTF, posted a message along the lines: "Oh yeah, I remember that. I wrote that, it's mine. What's wrong with it, you philistines!"?
Admin
And where else are you going to find any Haskell?
Admin
CAPTCHA: secundum. I secundum that emotion!
Admin
exec ("word = " + " + ".join(["wlc[i" + str(15 - i) + "]" for i in range(int(maxchar))]))
This saves quite a few lines here! Incredible they missed that opportunity to use code generation.
Admin
This is the kind of code that makes me think Python is just Perl for whimps who are afraid of (or never learned to touch-type) punctuation. Except you can indent Perl sanely.
Admin
Admin
Standard FORTRAN77 (and earlier) allowed no whitespace between tokens. This lead to multiple parsing interpretations.
The Dragon book (Aho, Sethi, & Ullman) gave this FORTRAN77 tokenizing error sample.
5 DO20N=1.10 ... 20 CONTINUE
The one-point-one-zero is a REAL constant & DO20N is an implicit REAL variable type. Line 5 is an assignment & line 10 is an un-matched CONTINUE
A valid DO loop has the comma to show the 1..10 range.
5 DO 20 N=1,10 ... 20 CONTINUE
Admin
Admin
Nevermind, it's probably to subtle for me to understand.
Admin
What fucking shitty code.
is the minimally standard to which any contemporary FORTRAN should be written. Anyone who thinks it may be written in anything more primitive should have his arse reamed out with a red-hot poker.
Admin
(This was well before the age of the personal computer, of course).
Admin
Oh very well, just for you two darlings, I've decided to stay alive for at least another two WTFs.
And, for the record, Nagesh is a fucking diamond.
Admin
He was probably trying to use sarcasm or irony, I don't bloody know the difference, in order to be funny.
Admin
He was probably trying to use sarcasm or irony, I don't bloody know the difference, in order to be funny.
Admin
"Standard FORTRAN77 (and earlier) allowed no whitespace"
I don't remember it like that at all and I wrote a lot of FORTRAN77 on HP/MPE, CDC/Cyber, PDP/11, VAX/VMS and Multics. Are you sure ?
And I trashed my copy of the Dragon Book many years ago.
Admin
Admin
COMPUTER LANGUAGES don't write bad code - PEOPLE with COMPUTER LANGUAGES write bad code!