this post was submitted on 03 Apr 2024
1319 points (98.8% liked)
Science Memes
10940 readers
1963 users here now
Welcome to c/science_memes @ Mander.xyz!
A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.
Rules
- Don't throw mud. Behave like an intellectual and remember the human.
- Keep it rooted (on topic).
- No spam.
- Infographics welcome, get schooled.
This is a science community. We use the Dawkins definition of meme.
Research Committee
Other Mander Communities
Science and Research
Biology and Life Sciences
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- !reptiles and [email protected]
Physical Sciences
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
Humanities and Social Sciences
Practical and Applied Sciences
- !exercise-and [email protected]
- [email protected]
- !self [email protected]
- [email protected]
- [email protected]
- [email protected]
Memes
Miscellaneous
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
As a professor said, most programming languages don't care about readability and whitespace. But we care because humans need it to parse meaning. Thus, write code for people, not for the machine. Always assume that someone with no knowledge of the context will have to debug it, and be kind to them. Because that someone might be you in six months when you have completely forgotten how the code works.
Exactly. You read code way more times than you write it, so it makes all the sense in the world to prioritize readability.
Source code is for humans, then the compiler turns it into code for machines.
Python forcing end of line and tabs kinda does. Add Black auto-formatter and it's pretty good.
I've seen too many Python devs write out complex statements all on one crammed up line. Including some that are in the main docs.
Enforced whitespace is just one aspect of readable code. There are many others, and Python is no better at enforcing those than any other language.
That would probably make very long lines and black would automatically add returns to line with proper indentations. But it has a a limit for sure. If you chain many list comprehensions it's going to be a mess.
Yep, if you're writing code for a machine, just do it in binary to save compilation time (/s just in case). Also, you in six months will indeed be someone with no knowledge of the context. And every piece of code you think you write for one-time use is guaranteed to be reused every day for the next 5 years
This. Always be kind to your future self.
Yeah I totally agree. You can minimize and optimize as part of your build procedure/compilation but the source code should be as readable as possible for humans.