Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 0007: Only use C++ style // one-line comments #2072

Closed
wants to merge 1 commit into from
Closed

PEP 0007: Only use C++ style // one-line comments #2072

wants to merge 1 commit into from

Conversation

DimitriPapadopoulos
Copy link
Contributor

PEP 0007 itself states:

Only use C++ style // one-line comments in Python 3.6 or later.

Therefore switch to C++ style // one-line comments.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@DimitriPapadopoulos

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@DimitriPapadopoulos
Copy link
Contributor Author

I did sign the CLA - minutes before creating the PR.

@zware
Copy link
Member

zware commented Sep 16, 2021

There is a human review step to the CLA process, so it will take some time before @the-knights-who-say-ni recognizes that you have signed.

As far as the content of the PR, I think you may be mistaking the point of that line: it is not saying that only C++-style one-line comments should be used, but that such comments should not be used in versions of Python before 3.6. There is no prohibition against single-line multi-line-style comments.

@DimitriPapadopoulos
Copy link
Contributor Author

Ah right, got it. I'm not a native speaker, but I think the text can be interpreted both ways:

  1. Do not use C++ style // one-line comments before Python 3.6.
  2. Use only C++ style // one-line comments starting with Python 3.6.

Of course, the first interpretation is the most straightforward and obvious, and the second one is convoluted. Still, to accommodate non-native speakers, I would recommend changing to something like this:
Do not use C++ style // one-line comments before Python 3.6.

Much easier to understand, at least for me.

@Rosuav
Copy link
Contributor

Rosuav commented Sep 16, 2021

Since Python 3.6 is now the oldest version still supported, perhaps it can be worded more positively, as a permission rather than a version-specific prohibition? "As of Python 3.6, C++ style // one-line comments may be used freely."

@warsaw
Copy link
Member

warsaw commented Sep 16, 2021

I'm of the mind that since 3.5 is EOL'd we can just remove the Python version qualifier.

@DimitriPapadopoulos
Copy link
Contributor Author

I'm of the mind that since 3.5 is EOL'd we can just remove the Python version qualifier.

If so, this sentence can be removed altogether 😄

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented Sep 16, 2021

Since Python 3.6 is now the oldest version still supported, perhaps it can be worded more positively, as a permission rather than a version-specific prohibition? "As of Python 3.6, C++ style // one-line comments may be used freely."

Or something like this, whatever you prefer.
As of Python 3.6, both C++ style // and C89 style /**/ can be used for one-line comments.

Is there a preferred style for longer comments, by the way? Why refer to one-line comments?

But again, perhaps this sentence should be removed if Python 3.5 is EOL'd. Actually, I have found 3 occurrences of references to versions of Python < 3.6, the last one being the worst offender!

  • Python versions before 3.6 use ANSI/ISO standard C (the 1989 version of the standard).
  • Python versions greater than or equal to 3.6 use C89 with several select C99 features:
  • For C code that needs to support versions of Python older than 2.3, you can include this after including Python.h:

@gvanrossum
Copy link
Member

I'm not really interested in this discussion, except to confirm that the OP misunderstood the intention, and the PR as it stands should not be accepted.

@DimitriPapadopoulos DimitriPapadopoulos deleted the pep-0007_comment branch September 16, 2021 22:50
@DimitriPapadopoulos
Copy link
Contributor Author

I would be interested to know why you think I misunderstood the intention. Is it because I am not a native speaker, or because the wording truly is ambiguous?

@zware
Copy link
Member

zware commented Sep 16, 2021

It may very well be ambiguous; I'm having a hard time seeing it that way, but I'm also more familiar with the history here. I would support removing the Only use ... line and cleaning up the 2.3 reference in a new PR, but there's no need to change the comments throughout the file.

@Rosuav
Copy link
Contributor

Rosuav commented Sep 17, 2021

It may very well be ambiguous, but I believe Guido's point is that this particular PR shouldn't be accepted. Feel free to open a separate PR changing the wording of that comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants