python horror
2016-05-30 02:19Writing code in Python is pretty neat. Executable pseudocode! It does match how I think. (Not how everyone thinks: a friend says he's gotten so used to pattern matching a la Haskell/ML now that *that's* part of his pseudocode, and Python is deficient.) Also the interpreter is really nice, and I'm surprised Perl still doesn't have one like it.
Testing code in Python? This seems to suck. Even the most basic lexical analysis isn't done and erroneous variable references don't get caught until the code tries to run.
happily prints "hello"; referencing an unassigned variable by calling an undefined function in a function that doesn't run causes no fuss. Naive perl is no better, but strict perl
generates
OTOH, the undefined 'rint' causes no fuss, which surprises me.
I was coding a simple HTTP server in Python, and while it's good to try to exercise all your code paths in testing as it is, I found myself wanting to do so specifically to make sure I didn't have typos in the enumerated constants I was referencing. That should not be an issue in a production language...
Testing code in Python? This seems to suck. Even the most basic lexical analysis isn't done and erroneous variable references don't get caught until the code tries to run.
def dummy(): rint(stri) print("hello")
happily prints "hello"; referencing an unassigned variable by calling an undefined function in a function that doesn't run causes no fuss. Naive perl is no better, but strict perl
use strict; sub dummy() { rint $stri; } print "hello\n"
generates
Global symbol "$stri" requires explicit package name at test.pl line 4.
Execution of test.pl aborted due to compilation errors.
OTOH, the undefined 'rint' causes no fuss, which surprises me.
I was coding a simple HTTP server in Python, and while it's good to try to exercise all your code paths in testing as it is, I found myself wanting to do so specifically to make sure I didn't have typos in the enumerated constants I was referencing. That should not be an issue in a production language...