- 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
The point was that not everyone has every feature turned on; not even the common ones; sometimes for good reasons, sometimes for not-so-good reasons. We as programmers, especially on this forum, should set a good example by doing basic error checking and informing the user that something that is required is missing. That's all!
Admin
if( lang !supportAndOrRequire( braces ) ) { print lang + " is a POS!"; }
Admin
you should swap continue with else: (no longer in a for remember?)
Also, python has regexes, why didn't he/she (Paula Bean?) use them?
captcha: muhahaha, hilarious
Admin
I notice a lot of people saying that
are equivalent. You missed another WTF -- there's a 'continue' in that thar for-loop! So this is the real equivalence:
Except, of course, there is no goto in Python. Or there wasn't until this WTF, anyway.
Admin
Very clever.
Captcha: bathe. Kurtz probably did need a bath.
Admin
actually ('value',) is a tuple with a single entry not a list
Admin
The REAL WTF here is that this site is no longer called the dailywtf.
Admin
+1
Admin
Ok, it's 11:15 CST and the entire time between 10:58 and now I've gotten the "Sorry, we're out of stickers." message, and there's no note about the stickers on the post today like there was yesterday...
:( That makes me a sad panda. I want a friggin sticker!!!
Will buying them be possible at any point in our near future?
Admin
Admin
it's a tuple, not a list.
Admin
Admin
Python 3000 will make mixing tabs and spaces an error, finally fixing the problem of editors not distinguishing them properly.
Fwiw, I agree that Fortran is insane. Python isn't anything like Fortran though, and gets a lot of unfair hatred because of the association.
Admin
Admin
I actually went so far as to set up a cron job to open up a browser window pointing to the sticker form at noon EST and I got the same thing. It's a shame that the form just wasn't activated today, as I was really looking forward to getting one.
Count me in for purchasing a couple if they ever go up for sale.
Admin
In fact, in my mind, anyone who disables javascript is in the same category as the people who created and stocked bunkers for Y2K: paranoid. So, LITERALLY unwilling to enter the 21st century!
Admin
Besides, python tuples are just "quick lists" read-only lists with the content managing methods striped, their are very list-ish in most respects.
And then you have to explain to erlang programmers about how python tuple differ from erlang tuples.
Admin
Admin
Worse than... Fuck?
Admin
Graceful degradation is an important aspect of Web design, and it's really not hard in most cases: just write the source without any JavaScript, and have a separate JavaScript file that can hook into the link to provide extra functionality if JS is enabled. It's generally not any more complicated than using onclick. You'll also benefit from smaller page loads, since external JS can be cached.
Admin
Amusingly enough, several people have suggested that "for field in ('value',) is the same as "field = 'value'". I guess they missed that "continue" statement.
Admin
The fortran/column 7 thingy is a throwback to "writing" programs on punchcards. Cobol has a similar convention. The first spaces on the cards were for comments.
Admin
Oh, nice. My captcha is "onomatopoeia".
Admin
The question of tabs-vs-spaces doesn't matter much though, as long as you're consistent throughout your files.
Management decides to change host for cost purposes, new host only supports PHP. d00med. Doesn't matter much as a Python tuple is merely an immutable list.(the real wtf is that Python doesn't have real tuples?)
Or haskell programmers, or Caml programmers I think, or pretty much any functional language programmer in fact ;)NoScript Firefox extension too, verrry popular.
Admin
Any non-wtf developer should read Martin Fowler's Refactoring. I find it even more important than over-hyped design patterns, some of which are just workarounds for languages that lacks some obvious constructs ( I personally can't live without ruby blocks ).
About this one, like anything looking like that, code should read as explicit as possible, even without comments. Thus, extract code parts, isolate them in an explicitly named method, and you should end with a chain of obvious method calls.
http://www.refactoring.com/catalog/extractMethod.html
Admin
About pro- or con-javascript : okay, phone-browsers and geeks surfing with lynx are just poor arguments. But if a feature would have worked exactly the same way with 1995's browsers ( clicking on a link to see the complete article, is it so futuristic ? ), having it working only with javascript in 2007 is clearly a regression. There is just no limit, someday we'll have to install bloatware plugins just to do the exact same thing.
I love javascript when it's added value.
Admin
Exactly. And that is why Python is gay.
Admin
Egaads, no!!
I mean it can, but only at a considerable cost in readability and portability. Tabs can be subject to widely varying interpretations depending on the editor that a piece of source is opened in. There are still a lot of interfaces out there that still tab at eight spaces. Others may make the same tabs four, spaces, or three, or two.
Combine that with space-based indentation in the same source, and you have no standard at all. I have seen some of that in Drupal source, and I can tell you, it makes an already difficult task of tracing execution paths a downright nightmare.
For my part, I use an Editor [Programmer's File Editor for Windows] that provides the option of space-based tabbing. I prefer three spaces these days, but what is important is consistency within a unit of source. Just pick a reasonable indentation level [8 spaces is over the top IMHO] and stick to it.
Admin
You visit err... questionable websites then you should turn off javascript. Even in Web 2.0 most links are still links; no need for javascript to do an href.
Admin
All I say about this WTF: I'm glad that there is at least one other person out there who hasn't drank the Pythod Koolaid.
Admin
Way to go, Tony, PHP is so much nicer than Python. Wait?
Admin
Secondly, self.request() is called twice, yet the same value appears to be expected. Thus, self.request would be best wrapped in a property before use.
Admin
All these flames about different languages being inherently flawed just cracks me up. Like saying SlashCode is totally unreliable because it is written in Perl/MySQL. Any sufficiently established, modern language is sufficient to create reliable code.
I wouldn't try writing something in Fortran, Cobol or Lisp. Currently, I work a lot with Active Server Pages (itself very outdated now). This scripting language (if you can call it that) is a nightmare to program with compared to PHP.
Admin
If you're eRe3t enough to want to disable javascript in your browser, you probably should be able to figure it out.
Admin
He probably meant (ERR)OROROROROR!
Admin
The triple-breasted OROROR of Eroticon 6
Admin
Admin
The problem with this line of logic is that in C (or more generally, !Python) the braces are still there, so even a human-unreadable file can be programmatically entabbed into readability. In Python, if you lose your block structure due to, say, two people modifying the same source in different text editors, it's gone -- only careful editing by someone who fully understands the code can restore functionality.
Admin
he means doing:
if(foo==false){fooBar();fooBar(7);fooBar(12);}else if(foo==funnyTriStateBoolMidVal){/fuck it/}
may confuse you but it comes in handy
Admin
Why would you be using text editors that automatically reformat code? That sounds like a recipe for disaster to me.
Admin
Admin
Admin
The real WTF here is why convert Python code to PHP?
Maybe because of the poor programming they thought that PHP would be better somehow.
Admin
Jeff wrote: "Except, of course, there is no goto in Python. Or there wasn't until this WTF, anyway."
That actually hasn't been true since April 1 2005, when the goto module was released: http://entrian.com/goto/
Not that I'm encouraging anyone to actually use it...
Admin
No one said Perl/MySQL was a wtf, cowbert specifically said "Badly written perl". And many would consider any database without transactions (don't give me this innodb shit, /. uses myisam) a wtf, though slashdot has done pretty well on it. I remember quite well that old incarnations of LJ and Slashdot code were excellent candidates for tdwtf, even if you subscribe to the idea that cleverness is more important that maintainability or extensibility. That was 6 years ago, they've probably matured and been rewritten a few time since.
Because Visual Studio, Eclipse, PhpED, and so on are actually really, really nice to use, and you can just stop worrying about formatting altogether. You might as well ask why anyone ever bothered to use lint back before IDEs got big - because some people just can't keep a style to save their lives, even if they're decent coders.Admin
This is ofcourse a false statement from someone that hasn't read the code or understand python. The first, self.request().value(field,None) will look up if the is "key" field and if return its value, if not return None. But here, the key field could "hold" a value that is false which would render the hole statment false. This is not what would happen in your if field in self.request:, In your code, you only check if the key field is in the mapping object! Its completely different ofcourse...
you-have-to-know-your-pythons-ifs-and-donts-ly'ers
Admin
It would be just as dumb to write this in PHP as it was to write it in Python, but (using slinkp's rewrite as a crib):
Admin
I assume "there are often times" means every k hours/days, not every k minutes, and that a bunch is actually a lot more than 4. How about, instead of writing a script (though there's nothing wrong with the solution), put all the shortcuts into a folder. To launch the files, open the folder, Control+A (select all), Enter (invoke).
Admin
Would print the word 'value'. What is happening here is (at the far right of the first line, just before the colon) that a tuple is being created with exactly one member (the string 'value'). A tuple is a sequence, and 'for' iterates over sequences -- assigning to the variable (in this case 'field') each of the items of the sequence.
Why do we have a for loop, looping through a hard-coded sequence of precisely one item? Job security?
Admin
It could be both, but it has to always match -- you could choose for instance yo always indent with 2 spaces and a tab... But you'd hate yourself in the morning ;-)