Coding style in CPython implementation

Στέφανος Σωφρονίου stefanossofroniou542 at gmail.com
Sun Oct 29 22:51:34 EDT 2017


On Monday, October 30, 2017 at 2:35:13 AM UTC+2, ROGER GRAYDON CHRISTMAN wrote:
> NOTE:   The case in question was never comparing to True;  it was comparing to
> NULL.
> 
> There is no "No: if x == None" below, because None is not Boolean.
> Similarly comparing a pointer to NULL is not the same as comparing it to a
> Boolean.
> 
> So I would favor the "Explicit is better than Implicit" in the example cited.

Thus, my 4 Zen points are accurately interconnected:

Being simple and explicit with your code leads to elegant results that are indeed quite pleasant to read.


> 
> Roger Christman
> Pennsylvania State University
> 
> On Sun, Oct 29, 2017, Setfan Ram wrote: >
> =?UTF-8?B?zqPPhM6tz4bOsc69zr/PgiDOo8+Jz4bPgc6/zr3Or86/z4U=?=

> >>I guess the following parts from "Zen of Python" apply to this case:
> >
> >  If we would agree to apply Python rules to C,
> >  then we could also use this excerpt from PEP 8:
> >
> >|o Don't compare boolean values to True or False using ==.
> >|
> >|Yes:   if greeting:
> >|No:    if greeting == True:
> >|Worse: if greeting is True:
> >
> >




More information about the Python-list mailing list