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 20, 2019 in Python by ana1504.k
• 7,910 points
1,860 views

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 20, 2019 by SDeb
• 13,300 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
902 views
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
• 58,020 points
1,297 views
+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
15,066 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
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 22, 2018 in Python by SDeb
• 13,300 points
5,035 views
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,300 points
696 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP