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

BaseIP properties and indexes (netmask, broadcast, etc) should return IP objects #21

GoogleCodeExporter opened this issue Mar 18, 2015 · 1 comment


Copy link

The following methods:

  BaseIP.broadcast / BaseIP.broadcast_ext
  BaseIP.hostmask / BaseIP.hostmask_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:


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 by on 2 Jun 2009 at 6:13

Copy link

closing this out.  taken care of in 2.0.x

Original comment by on 26 Aug 2009 at 9:13

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant