Skip to content

Conversation

@khanashes
Copy link

Summary

In Python 3, when __eq__ is defined, Python automatically provides __ne__ by negating __eq__. Explicitly defining __ne__ is redundant and unnecessary code.

Changes

  • Removed redundant __ne__ method from HTTPBasicAuth class
  • Removed redundant __ne__ method from HTTPDigestAuth class

Testing

All existing authentication tests pass (50 tests), confirming that Python's automatic __ne__ implementation works correctly:

50 passed, 561 deselected, 8 warnings in 5.33s

Benefits

  • Cleaner, more maintainable code
  • Follows Python 3 best practices
  • Reduces code duplication
  • No functional changes - behavior remains identical

In Python 3, when __eq__ is defined, Python automatically provides
__ne__ by negating __eq__. Explicitly defining __ne__ is redundant
and unnecessary code.

This removes the redundant __ne__ methods from HTTPBasicAuth and
HTTPDigestAuth classes. All existing tests pass, confirming that
Python's automatic __ne__ implementation works correctly.
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.

1 participant