2016-05-30

mindstalk: (Witch)
Writing 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.

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...

Profile

mindstalk: (Default)
mindstalk

November 2025

S M T W T F S
      1
2345678
91011 1213 1415
16171819202122
23242526272829
30      

Page Summary

Most Popular Tags

Expand Cut Tags

No cut tags

Style Credit

Page generated 2025-11-15 03:47
Powered by Dreamwidth Studios