Skip to content

Commit

Permalink
Add IP.__ne__(other) method
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Stinner committed Sep 7, 2011
1 parent fbeec02 commit b1e1d7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ChangeLog
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,8 @@
Version 0.76 (under development) Version 0.76 (under development)
-------------------------------- --------------------------------


* IP.__eq__(other) returns False if other is not an IP object, instead of * ip == other and ip != other doesn't fail with an exception anymore if other
raising an exception is not a IP object
* Add IP.get_mac() method: get the 802.3 MAC address from IPv6 RFC 2464 * Add IP.get_mac() method: get the 802.3 MAC address from IPv6 RFC 2464
address. address.


Expand Down
3 changes: 3 additions & 0 deletions IPy.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -745,6 +745,9 @@ def __eq__(self, other):
return False return False
return self.__cmp__(other) == 0 return self.__cmp__(other) == 0


def __ne__(self, other):
return not self.__eq__(other)

def __lt__(self, other): def __lt__(self, other):
return self.__cmp__(other) < 0 return self.__cmp__(other) < 0


Expand Down
4 changes: 4 additions & 0 deletions test/test.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ Issue #2 and #9
False False
>>> IP('1.2.3.4') == object() >>> IP('1.2.3.4') == object()
False False
>>> IP('1.2.3.4') != None
True
>>> IP('1.2.3.4') != object()
True




get_mac() get_mac()
Expand Down

0 comments on commit b1e1d7a

Please sign in to comment.