PEP8 compliance

Terry Reedy tjreedy at udel.edu
Wed Jun 13 13:31:37 EDT 2018


On 6/13/2018 12:35 PM, T Berger wrote:

> I did make the changes in IDLE, but I thought I must be in the wrong place.

This is a good place for beginners.

> The line of code I got in terminal was:
> /Users/TamaraB/Desktop/mymodules/vsearch.py:1:25: E231 missing whitespace after ':'
> def search4vowels(phrase:str)->set:

The recommended style is

def search4vowels(phrase: str) -> set:

> I thought the 1:25: E231 couldn't be referring to anything in my text editor. But now I see that 1:25 refers to the first line, 25th spot (I suppose the 25 refers to the spot BEFORE which I'm supposed to add white space.

25 is the slice position between ':' and 's', where a new space would go.

> I don't know what the E231 refers to, but it doesn't seem helpful.

It is an arbitrary label.  You can probably use it to look up the 'error'.

> And, no, I'm not going to make these picayune changes that actually make the code harder to read. Adding a white space between "phrase:" and "str" just splits apart a conceptual unit in a complicated line of code. I was just doing this exercise in my workbook.

*I* happen to prefer the spaced-out version, but I also prefer that 
people do what they want, especially in private code.  You should also 
able to use E231 to tell pep8 to not report E231s (because you disagree 
with the recommendation).

-- 
Terry Jan Reedy




More information about the Python-list mailing list