Skip to content

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 25, 2020

Fully assigning self.collections with a list comprehension makes it
clear that there are not earlier elements in self.collections that may
stay there.

Also, the type used in the repr of the self.collections silent_list can
be directly inferred from the list items.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.4.0 milestone Jun 25, 2020
def __init__(self, type, seq=None):
self.type = type
if seq is not None:
self.extend(seq)

def __repr__(self):
return '<a list of %d %s objects>' % (len(self), self.type)
return (f"<a list of {len(self)} {self.type} objects>"
if self.type is not None else
Copy link
Member

@timhoffm timhoffm Jun 25, 2020

Choose a reason for hiding this comment

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

Can you pull out

type_ = self.type if self.type is not None else ...

That'd make the messages simpler to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Fully assigning self.collections with a list comprehension makes it
clear that there are not earlier elements in self.collections that may
stay there.

Also, the type used in the repr of the self.collections silent_list can
be directly inferred from the list items.
@QuLogic
Copy link
Member

QuLogic commented Jun 26, 2020

Slight preference those were two commits, maybe.

@timhoffm timhoffm merged commit 3bbc78a into matplotlib:master Jun 26, 2020
@anntzer anntzer deleted the contour2 branch June 26, 2020 06:57
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.

3 participants