-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT Clean up examples #21246
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
MNT Clean up examples #21246
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR @DimitriPapadopoulos !
I agree with removing #!/usr/bin/python
.
As for print(__doc__)
, I am +1 on having it everywhere, right under the files' docstring. I think it came from a time where all the narrative was in the file's docstring. Now we have examples with multiple cells and many view the examples as HTML. I think there is still value in printing out the docstring, so there is some feedback running the example locally. Note I think print(__doc__)
can be another PR, so we do not block this one.
@@ -1,3 +1,4 @@ | |||
# -*- coding: utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding, utf-8 is the default encoding for Python 3. Given that, I would prefer to remove it everywhere. @DimitriPapadopoulos What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware or had forgotten UTF-8 is the default encoding of source code files in Python 3:
If no encoding declaration is found, the default encoding is UTF-8.
So yes, all these encoding declarations should be removed. They just obfuscate examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put back the encoding declarations for consistency with this other PR: #21260.
cfd50c2
to
5e88973
Compare
I would also prefer a different PR for |
@thomasjpfan @jjerphan See also #21260. Should I give up on the |
Yea let's revert the |
5e88973
to
ed348ac
Compare
* chmod -x * remove Python shebang from examples: #!/usr/bin/python
ed348ac
to
696a125
Compare
I've reverted all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |
What does this implement/fix? Explain your changes.
See #21234 (comment).
chmod -x
#!/usr/bin/python
only UTF-8-encoded files contain "-# -*- coding: utf-8 -*-
"Any other comments?
Examples could be made more consistent.
-# -*- coding: utf-8 -*-
? Keep it in UTF-8-encoded files? Remove it from all example files? Add it to all example files?print(__doc__)
, others don't. Should it be added to all examples?