Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chromatic (983)

chromatic
  (email not shown publicly)
http://wgz.org/chromatic/

Blog Information [technorati.com] Profile for chr0matic [technorati.com]

Journal of chromatic (983)

Wednesday September 26, 2007
02:38 PM

Beyond Indentation and Invisible Sigils

[ #34552 ]

Here are some prescriptions for writing Python code that other Python programmers will find more usable and readable than it might otherwise have been (i.e. code that "doesn't obviously suck").

Titus Brown, Writing (Python) Code that Doesn't Suck, v2

Syntax doesn't give you readable code for free. Snarkiness aside, Titus's rules are pretty universal.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • This one, while it doesn't strike me as a very perlish thing to do, we already have conventions and libraries in place to do this in a different way, seems like a very natural way to organize unit tests:

    modules, when executed from the command line, should
    either run tests or do nothing.
    But, yes, 90% of the specifics and 100% of the concepts of that had nothing to do with Python.
    • All well-behaved Perl modules do nothing if you run them directly, so they already “run tests or do nothing”… :-)

  • Syntax doesn't give you readable code for free.

    Hm. Let's test this out.

    • Scheme has uniform syntax.
    • Uniform syntax is trivial to learn, and easy to read.
    • Therefore, if uniform syntax leads to readable code, then Scheme expressions should all be very readable and easy to understand

    Proof:

    ((call/cc call/cc) (call/cc call/cc))

    Hm. I guess uniform syntax doesn't necessarily lead to readable code. :-)

    • It's computers, so the analogy should involve cars, but "Just because I can diagram a sentence doesn't mean I can read Finnegan's Wake."