Spacing conventions

Christopher Reimer christopher_reimer at icloud.com
Wed Sep 27 08:14:06 EDT 2017


On Sep 27, 2017, at 12:50 AM, Bill <BILL_NOSPAM at whoknows.net> wrote:
> 
> 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
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

I came across a Python script on Github that did what I needed except for some trivial modifications to make it Python 3 compatible. I did consider contributing changes to make the script Python 2 and 3 compatible. However, the script was written an idiosyncratic, anti-PEP8 style that was hard to match and the author previously rejected all Python 3 contributions. Forking the script to make it Python 2/3 compatible *and* PEP8 compliant would require too much effort on my part, especially since I needed to use the script only once.

Chris R. 


More information about the Python-list mailing list