Spacing conventions

Bill BILL_NOSPAM at whoknows.net
Wed Sep 27 03:50:24 EDT 2017


Ever since I download the MyCharm IDE a few days ago, I've been noticing 
all sort of "spacing  conventions (from PEP) that are suggested.  How do 
folks regard these in general?

For instance,  the conventions suggest that

if x>y :
      pass

should be written
if x > y:
     pass

Personally, I like seeing a space before the colon (:).   And then in

my_list = [ i for i in range(0, 10) ]
it complains about my extra space inside of the brackets.

If you are teaching beginning students, do you expect them to try to 
follow these sorts of conventions?  Is it perfectly fine to let "taste" 
guide you (I'm just trying to get a feel for the philosophy here)?   I 
also notice "break" and exception handling is used much more in Python 
than in C++, for instance.  I was taught "break" and "continue" led to 
"unstructured code"--but that was a while back.  I can still see their 
use  causing potential trouble in (really-long) real-world code.

Bill






More information about the Python-list mailing list