Names changed to protect the guilty

Virgil Dupras hardcoded.software at gmail.com
Sat Oct 7 04:27:04 CEST 2006


MonkeeSage wrote:
> On Oct 6, 6:27 pm, a... at pythoncraft.com (Aahz) wrote:
> > The following line of lightly munged code was found in a publicly
> > available Python library...
>
> Yes, this violates the Holy, Inspired, Infallible Style Guide (pbuh),
> which was written by the very finger of God when the world was still in
> chaotic darkness. But I guess I'm an atheist when it comes to PEP 8. If
> it is clearer to you to make the condition explicit ("blah not False"),
> rather than implicit ("not blah"), then use the former. I say write the
> code the way *you* (and your team if applicable) are best able to read,
> write and maintain it. Then when other people tell you that it isn't
> good style, or isn't "pythonic," just stab them in the face with
> soldering iron ala Chris Walken. :)
>
> Regards,
> Jordan

I don't think it's even a matter of "If it's clearer to *you*", it's a
matter of not writing code while drunk. Isn't something like "key not
in schema.elements" universally clearer than the above mess? (If
elements has a "has_key()" method, it probably is or acts like a dict)

But I don't blame the autor of this line (The drunk thing was a joke),
I can see how it can happen: editing. You write something, and the
oops, it doesn't quite work, make a quick fix, then another, then
another. You end up with something that works, but don't notice the
ugly line you left. It happens.

However, it can *also* happen when you write code while drunk...




More information about the Python-list mailing list