[Python-Dev] PEP 3144 review.

Peter Moody peter at hda3.com
Tue Sep 15 20:46:01 CEST 2009


On Tue, Sep 15, 2009 at 11:49 AM, Stephen J. Turnbull
<stephen at xemacs.org> wrote:
> Antoine Pitrou writes:
>
>  > Speaking as a non-network specialist, it actually looks logical to
>  > me to be given an address if I iterate over a network (the same way
>  > that, if I iterate on a list, I get individual elements, not
>  > 1-element sublists).
>
> But if you iterate over a string you get one character strings.  So
> it's an issue of convenience of representation.

True, but you don't get a string of equal length back.

from the PEP:

 - Treat network elements as lists (in so far as it's possible).

(that should probably say "treat networks as lists")

you will no be able, with a string, to do something like

>>> 'this is my string'[0][1][2][3]

but that's what's being suggested here for networks.

>>> ipaddr.IPv4Network('1.1.1.1/24')[0][1][2][3]...

>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40hda3.com
>


More information about the Python-Dev mailing list