The following methods:
BaseIP.__getitem__
BaseIP.broadcast / BaseIP.broadcast_ext
BaseIP.hostmask / BaseIP.hostmask_ext
BaseIP.netmask_ext
return strings or integers. They should return IPv4 objects instead.
The fact that you have separate broadcast and broadcast_ext methods that return
the integer and
string forms of a network's broadcast address, for instance, indicates that
your object model is
not as clean as it could be. Since the broadcast address is, in fact, an
address, why not return a
fully functional IPv4 instance? Users could then do (assuming network is an
IPv4 instance):
str(network.broadcast) if they want the string form, or could do:
network.broadcast.is_private
or any of the other valid operations on an address.
Returning strings and integers from these methods leads to code duplication and
does not
embrace the spirit of object-oriented design.
Original issue reported on code.google.com by gtg464t@mail.gatech.edu on 2 Jun 2009 at 6:13
Original issue reported on code.google.com by
gtg464t@mail.gatech.edu
on 2 Jun 2009 at 6:13