News for hackers. Stuff that matters.
Re:True hacker resume: CV as Python unit test by moe on Thursday July 15, 2010 @05:55PM (#1519366)
May be irritating for some but good practice regardless.

Putting the constant left in a conditional means you will never miss an accidental = instead of ==.

Re:True hacker resume: CV as Python unit test by masklinn on Thursday July 15, 2010 @06:00PM (#1519386)
> Putting the constant left in a conditional means you will never miss an accidental = instead of ==.

That's only useful for dumb languages

    >>> a = 5
    >>> if a = 3: print 'ok'; else: print 'nok'
      File "<stdin>", line 1
        if a = 3: print 'ok'; else: print 'nok'
             ^
    SyntaxError: invalid syntax
Python simply does not allow assignments in conditional contexts.
Re:True hacker resume: CV as Python unit test by moe on Thursday July 15, 2010 @06:12PM (#1519427)
Dumb is a strong word, young padawan.

The difference between theory and practice is smaller in theory than in practice.

Re:True hacker resume: CV as Python unit test by masklinn on Friday July 16, 2010 @01:49AM (#1520404)
> Dumb is a strong word, young padawan.

I carefully weighted my words, and I rest my case.

Re:True hacker resume: CV as Python unit test by 146 on Thursday July 15, 2010 @09:12PM (#1519850)
> That's only useful for dumb languages

The compilers/interpreters I know that don't do this are PHP and Perl (C/C++ will do it if you use -Wall, which you should be using anyway).

So yeah, you're pretty much right. /snark

Re:True hacker resume: CV as Python unit test by chromatic on Thursday July 15, 2010 @10:40PM (#1520029)
Perl does indeed warn about the use of = instead of == in a conditional.
Re:True hacker resume: CV as Python unit test by 146 on Friday July 16, 2010 @01:57PM (#1521894)
You're right; I didn't know about the -w setting. I guess that just leaves PHP.
Re:True hacker resume: CV as Python unit test by subwindow on Friday July 16, 2010 @11:13AM (#1521368)
That's like wearing a helmet while walking down the street because you might accidentally fall and hit your head.

Don't be an idiot in the first place and you won't have to do idiotic things to prevent damage from your idiocy.

Re:True hacker resume: CV as Python unit test by moe on Friday July 16, 2010 @12:29PM (#1521604)

    Good judgement is the result of experience.
    Experience is the result of bad judgement.  <-- You are here