Python will make you write nice code. I call bull on this one.
Sure you'll have to indent your loops so they work but that
won't make you write nice code.
I have a hefty slab of absolutely unreadable UI code sitting
in a repository on a university server to prove it.
Indeed.
I'm still surprised by how many folks, who don't know either
language particularly well, claim that "Python is more readable",
or that "Perl looks like line noise" -- to which, I normally reply
that Russian is "unreadable" if you don't know Russian.
I sometimes further challenge folks who claim magical code readability
powers for Python,
to please explain how using Python ensures that they:
- Make sound domain abstractions.
- Decompose their programs wisely into highly cohesive, loosely coupled modules.
- Choose descriptive, explanatory, consistent and regular names.
- Write useful comments.
- Minimize the exposure of implementation details.
- Avoid duplication (DRY).
- Don't use magic numbers in their code.
- Create interfaces that are: consistent; easy to use correctly; hard to use incorrectly; easy to read, maintain and extend; clearly documented; appropriate to audience.
- Write components that are testable in isolation.
- Establish a rational error handling policy and follow it strictly.
That is, far more important than "readability" is "maintainability",
so that programmers who know the language can come
to the code later in its life and
understand its construction and intentions
and change it comfortably and confidently.
See also: list of similar Perl v Python questions
Update: See also a later, more comprehensive version of this reply at: Re: Some Help for a Report About Perl (Readability vs Maintainability References)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.