Coding style in CPython implementation
Στέφανος Σωφρονίου
stefanossofroniou542 at gmail.com
Sun Oct 29 05:00:49 EDT 2017
On Sunday, October 29, 2017 at 4:18:38 AM UTC+2, Dan Sommers wrote:
> On Sat, 28 Oct 2017 16:20:54 -0700, Στέφανος Σωφρονίου wrote:
>
> > I do believe though that if (!d) is a lot clearer than if (d == NULL)
> > as it is safer than falsely assigning NULL in d, by pure mistake.
>
> Having made my living writing C code for a very long time, I always
> found if (!d) *harder* to read, especially if it happened to be written
> if(!d) without the space, because it was never a single character name
> the ! disappeared into the noise.
Indeed it gets harder to distinguish it after a lot of time staring at your source code.
I guess the following parts from "Zen of Python" apply to this case:
- Beautiful is better than ugly.
- Explicit is better than implicit.
- Simple is better than complex.
- Readability counts.
> OTOH, = vs. == always stuck out like
> a sore thumb. Then again, I grew up with monochrome terminals
> vs. unusably slow syntax highlighting, and grayscale printers (and we
> had to live in a small shoebox in the middle of the road).
>
> YMMV. Obviously.
>
> Dan
More information about the Python-list
mailing list