Python Forum
the way i like to code for readability
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
the way i like to code for readability
#1
the way i like to code is with a series of small discrete steps. i did this when i learned arithmetic and algebra. even my mathematical proofs were done this way, showing every small step. as i learned various programming languages, i did it this way with more statements instead of longer expressions. i think this is one of the reasons i liked programming in assembly language a lot.

the first compiler i used for Fortran (on mainframes) did not do any optimizing at all. often, the formulas i coded has subexpressions repeated in many places. i would calculate that expression once and save the result in a variable. then i would use that variable many times. i might have 20 lines of code instead of 2 big wide lines. my code would typically run much faster. even in cases where the expression was used only once, it made the code easier to read.

even my C code was often done this way. some people even said "you must be an assembly language programmer" when they looked at some of my C code.

i do this even in Python. i tend to avoid big wide expressions because i find them hard to read when the font is all the same (which it usually is for code).

my question is how this effects different judgements about code being very pythonic. i know that readability is something many consider to be important. what are your thoughts?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Readability in Python and PHP ankitdixit 1 911 Aug-17-2022, 10:59 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020