buggy python interpretter or am I missing something here?

Peter Otten __peter__ at web.de
Mon Jan 27 03:45:24 EST 2014


me wrote:

Not me, you ;)

> Since this code is for a personal research project I'm not as concerned
> about code quality as I would be if I was getting paid to write
> production code...and if it was production code I'd only prototype a
> proof-of-concept in python and then rewrite in c++.

Another way to improve code quality is to write less code yourself and 
instead to rely on well-tested libraries:

import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--basedir", default="/process")
parser.add_argument("-i", "--inpipe", default="/tmp/TCdaemonIN")
parser.add_argument("-#", "--maxjobs", type=int, default=8)
parser.add_argument("-o", "--outpipe", default="/tmp/TCdaemonOUT")

print parser.parse_args()

Seriously, code quality doesn't magically improve by a switch of language. 
You may make fewer newbie errors in C++, but once you get over the 
instinctive

"Ducktype and unit tests? I'll do it with these three undebuggable templates 
and get type checks for free from the compiler."

the simpler and often more concise Python solutions will start to pay off.





More information about the Python-list mailing list