Seth Bromberger added the comment:

1) However:

>>> b = ipaddress.IPv4Address('1.2.3.4')
>>> a = ipaddress.IPv4Address('1.2.3.4')
>>> id(a)
4428380928
>>> id(b)
4428381768
>>> a == b
True
>>> b._ip += 6
>>> id(b)
4428381768
>>> b
IPv4Address('1.2.3.10')


2) Isn’t _version already a class attribute? It’s set in _Basev4/Basev6.

3) Memory consumption seems particularly wasteful in the current 
implementation: it takes 56 bytes (via sys.getsizeof) to store what amounts to 
4 bytes of data.

I thought about subclassing Int as well, and I agree it’s the wrong approach. 
There are too many int methods that don’t make sense in the context of IP 
addresses.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23103>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to