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

Unnecessary assignment #4

Closed
tjomk opened this issue Feb 16, 2015 · 4 comments
Closed

Unnecessary assignment #4

tjomk opened this issue Feb 16, 2015 · 4 comments

Comments

@tjomk
Copy link

tjomk commented Feb 16, 2015

https://github.com/jab/bidict/blob/master/bidict.py#L426 - unless I miss something this looks like a unnecessary line. After doing self._fwd = self._bwd you are assiging self._fwd (which already has the value of self._bwd) back to self._bwd.

Any reason for doing this?

@jab
Copy link
Owner

jab commented Feb 17, 2015

Please read again and note the difference between self and inv.

@jab jab closed this as completed Feb 17, 2015
@jab
Copy link
Owner

jab commented Feb 17, 2015

Thank you for the code review in any case. If you'd like to share how you found out about bidict and what you're using it for, I'd be interested to hear.

@tjomk
Copy link
Author

tjomk commented Feb 21, 2015

Ah, it was in plain sight. Not sure why I found this suspicious.

Read about this in Pycoder's Weekly: http://pycoders.com/

@jab
Copy link
Owner

jab commented Feb 21, 2015

Didn't realize you were from Pycoder's Weekly. Thanks for putting bidict in this week!

And I think something about the variable names makes it easy to read something like inv._bwd = self._fwd and think self._bwd = self._fwd by mistake. Maybe renaming inv "inverse" would make it easier to parse. If you spot anything else that looks funny in the code, please don't hesitate to mention.

Thanks again!

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

No branches or pull requests

2 participants