PEP8 space after a comma

0 votes

I'm working on code review, and seeing method declarations like:

def __init__(self,data):

I thought that it should be formatted like this:

def __init__(self, data):

But then I checked PEP 0008 and see no exact statement about that. There is guide about whitespace around operators, and inside parentheses, but no about comma separated list.

If it is not described in PEP8, probably there is some unwritten convention about this? Why I was convinced that this was in PEP8? Should PEP8 be updated?

Jul 19, 2019 in Python by ana1504.k
• 7,890 points

1 answer to this question.

0 votes

I guess the reason that most people believe this rule is in PEP8 is pip pep8.

According to their document:

E231 missing whitespace after ‘,’

As most people use this as their style checker, it is easy to be convinced that the rule is really in PEP8.

answered Jul 19, 2019 by SDeb
• 13,250 points

Related Questions In Python

0 votes
1 answer

How to hide a window in the constructor immediately after creation?

You can use QtCore.QTimer class Example(QWidget):     def __init__(self, app):         QWidget.__init__(self)         QTimer.singleShot(0, ...READ MORE

answered Apr 17, 2018 in Python by anonymous
0 votes
1 answer

Hide a window in the constructor immediately after it is created?

Apparently it seems that the code should ...READ MORE

answered Sep 28, 2018 in Python by Priyaj
• 57,550 points
+1 vote
1 answer
0 votes
1 answer

Run a function after keyboard interrupt in python

Below is the code to run a ...READ MORE

answered Jul 26, 2019 in Python by Shri
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,183 views
0 votes
0 answers
0 votes
1 answer

Return a list inside a for loop while iterating over the elements of another list

The print() is getting called multiple times ...READ MORE

answered Sep 21, 2018 in Python by SDeb
• 13,250 points
0 votes
1 answer

Is there a string 'contains' in python?

In this case, you can use the ...READ MORE

answered Sep 25, 2018 in Python by SDeb
• 13,250 points