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

Minor updates to the vector demo #24853

Merged
merged 3 commits into from
Mar 16, 2021
Merged

Conversation

rhettinger
Copy link
Contributor

  • Have repr follow best practices and not hardwire the class name.
  • Convert comments to docstrings.
  • Enhance the demo with one non-dunder method, a dot product.

* __repr__ to follow best practices and not hardwire the class name.
* Convert comments to docstrings.
* Enhance the demo with one non-dunder method, a dot product.
@@ -50,22 +56,28 @@ def __getitem__(self, i):
return self.v[i]

def __add__(self, other):
# Element-wise addition
"Element-wise addition"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't best practise triple quotes for docstrings? Ref. PEP 8/documentation-strings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're somewhat loose about this. The original rationale was that it would save you from retyping the quotes if the docstring grew to multiple lines. That isn't a likely possibility here.

@rhettinger rhettinger merged commit d69ae75 into python:master Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants