the further adventures of

Mike Pirnat

a leaf on the wind

« Previous Post Next Post »

The Zen of Doing It Wrong

A coworker unearthed this little treasure today... I think it's a vestigial structure to assist Diaper (anti)Pattern treatment during testing or debugging, but it's still gross to see it in real, live production code. (Oddly enough, I couldn't find a good "Diaper Pattern" link whilst Googling about--surely I'm not the only one who uses this term?) Anyway, without further ado:

try:
    os.remove(filename)
except:
    raise
    pass
try:
    os.remove(os.path.join(TMP,'out-%s' % base_filename))
except:
    raise
    pass
try:
    os.remove(os.path.join(TMP,'properties_%s.lock' % brandid_human))
except:
    raise
    pass

If an exception is raised, raise an exception... It has a certain zenlike beauty to its awfulness. The use of the Diaper Pattern is bad enough, but this guarantees blowouts!

blog comments powered by Disqus

« Previous Post Next Post »