Skip to content

Refactor "magic" method constants so that there are no dups - #4838

Merged
msullivan merged 18 commits into
python:masterfrom
kamahen:master
Apr 4, 2018
Merged

msullivan merged 18 commits into
python:masterfrom
kamahen:master

Conversation

@kamahen

@kamahen kamahen commented Apr 2, 2018

Copy link
Copy Markdown
Contributor

This is to avoid bugs like issue #4770 and to make some planned changes easier to review.

I have hand-checked to verify that MAGIC_METHODS hasn't changed (the other constants have only been moved within the file).

kamahen added 17 commits March 20, 2018 12:10
Also change sharedparse.py to avoid this kind of bug in future.
Fixes #4767.
Also change sharedparse.py to avoid this kind of bug in future.
Fixes #4767.
Also change sharedparse.py to avoid this kind of bug in future.
Fixes #4767.
  to avoid bugs like issue #4770
This has been hand-checked to verify that MAGIC_METHODS is the same
  (the other constants have only been moved within the file)

@msullivan msullivan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One nit but looks good to me.

Comment thread mypy/sharedparse.py


MAGIC_METHODS = {
_NON_BINARY_MAGIC_METHODS = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd drop the initial underscore here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

_NON_BINARY_MAGIC_METHODS isn't used anywhere else and its existence is a side-effect of the implementation, so I'd rather leave the initial underscore if you don't mind. If someone wants to use this value in future, they can always remove the initial underscore at that time.

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed to leave the _ in.

@msullivan
msullivan merged commit 81d4317 into python:master Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants