[Python-Dev] PEP 3144 review.

Antoine Pitrou solipsis at pitrou.net
Wed Sep 16 13:41:43 CEST 2009


Stephen J. Turnbull <stephen <at> xemacs.org> writes:
> 
> Rather, don't you want to just give IPv4Address an attribute
> 'network'?  This could then be filled in by the indexing method on
> IPv4Network.

It doesn't make sense to me. An address, conceptually, doesn't have a "network".
If I say "213.5.4.68", it isn't part of a specific network /a priori/.

Not only doesn't it make sense to me, but it creates ambiguities.
Do two similar addresses, but with different "networks", compare and hash
equally? Both answers are unsatisfactory and will create nasty surprises for
users.

I don't see what's difficult in remembering the network object by yourself if
you need it. Python is not Java, it has lightweight syntax, useful datatypes and
notations (e.g. tuples). You don't need to have every use case taken care of by
a dedicated library API.

(to make an analogy: if I take an item from a list, it doesn't hold a reference
to the list just in case it might be practical to do so)

Regards

Antoine.




More information about the Python-Dev mailing list