On Wed, Aug 19, 2009 at 8:39 AM, Eric Smith<e...@trueblade.com> wrote: > Peter Moody wrote: >> >> On Wed, Aug 19, 2009 at 3:20 AM, Antoine Pitrou<solip...@pitrou.net> >> wrote: >>> >>> Le Tue, 18 Aug 2009 13:00:06 -0700, Peter Moody a écrit : >>>> >>>> Howdy folks, >>>> >>>> I have a first draft of a PEP for including an IP address manipulation >>>> library in the python stdlib. It seems like there are a lot of really >>>> smart folks with some, ahem, strong ideas about what an IP address >>>> module should and shouldn't be so I wanted to solicit your input on this >>>> pep. >>> >>> When you say : >>> >>> « the results of the first computation should be cached and only >>> re-generated should the object properties change » >>> >>> does it mean that the objects are mutable? Would it make sense to make >>> them immutable and therefore hashable (such as, e.g., datetime objects)? >> >> that's a good point. I'll implement __hash__ in the BaseIP class. > > But are the objects mutable? I haven't had time to deep dive on this yet, > but I'd like to. I also use IPy and would like to some this in the stdlib.
you can't set them directly, if that's what you mean. >>> import ipaddr >>> o = ipaddr.IPv4Network('1.1.1.0/24') >>> o.broadcast IPv4Address('1.1.1.255') >>> o.network IPv4Address('1.1.1.0') >>> o.broadcast = ipaddr.IPv4Address('1.1.1.127') Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: can't set attribute >>> o.prefixlen = 25 >>> o.broadcast IPv4Address('1.1.1.127') > Eric. > _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com