Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Peter Moody
On Wed, Aug 19, 2009 at 9:07 PM, Eric Smith wrote: > Fred Drake wrote: >> >> On Aug 19, 2009, at 6:01 PM, Peter Moody wrote: >>> >>> just to double check, it's fine for IPNetwork to remain hashable if >>> set_prefix() actually returned a new object, correct? >> >> >> The name would be confusing, th

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Eric Smith
Fred Drake wrote: On Aug 19, 2009, at 6:01 PM, Peter Moody wrote: just to double check, it's fine for IPNetwork to remain hashable if set_prefix() actually returned a new object, correct? The name would be confusing, though. Perhaps using_prefix() would be more clear. I think you'd be bet

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Fred Drake
On Aug 19, 2009, at 6:01 PM, Peter Moody wrote: just to double check, it's fine for IPNetwork to remain hashable if set_prefix() actually returned a new object, correct? The name would be confusing, though. Perhaps using_prefix() would be more clear. -Fred -- Fred Drake __

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Antoine Pitrou
Eric Smith trueblade.com> writes: > > Is there some existing library that uses .number or .zero? IPy uses .net > (and .broadcast for [-1]). Why not be explicit? Use .first and .last. ___ Python-Dev mailing list Python-Dev@python.org http://mail.pyth

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Peter Moody
On Wed, Aug 19, 2009 at 2:44 PM, Nick Coghlan wrote: > Peter Moody wrote: >> 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.broadc

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Nick Coghlan
Peter Moody wrote: > 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

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Nick Coghlan
Glyph Lefkowitz wrote: > -1. I think 'network.number' or 'network.zero' is a lot clearer than > 'network.network'. Maybe '.broadcast' would be okay, as long as it > /can/ be adjusted for those unusual, or maybe even only hypothetical, > networks where it is not the [-1]. Maybe this is something

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Nick Coghlan
Glyph Lefkowitz wrote: > It is unusual, but frankly, needing to actually do operations on > broadcast addresses at all is also a pretty unusual task. Broadcast > itself is a somewhat obscure corner of networking. I suspect that in > many deployments that need to write significant code to deal wit

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Eric Smith
[Glyph] So it sounds like doing what I suggested earlier (default to [-1], allow for customization) is actually required by the RFC :-). Although it does sound like the RFC only requires that you be able to customize to [0] rather than [-1], rather than any address. In practical terms though

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Glyph Lefkowitz
On Wed, Aug 19, 2009 at 4:45 PM, "Martin v. Löwis" wrote: > > No, I just said its conventionally used as that but its not definition > > of a broadcast (in fact you can have any valid host address defined > > as broadcast as long as all members of the network agree on that) > > You could, but then

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-19 Thread Martin v. Löwis
> Now on to the complaints: Though I recently added support for this in > Jython, I don't like that nodes can be defined without required > attributes, for example: > > node = ast.Assign() I think we disagree in two points in our evaluation of this behavior: a) ast.Assign is *not* a node of the

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Martin v. Löwis
> No, I just said its conventionally used as that but its not definition > of a broadcast (in fact you can have any valid host address defined > as broadcast as long as all members of the network agree on that) You could, but then you are violating existing protocol specifications. RFC 1122 manda

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-19 Thread Benjamin Peterson
2009/8/19 Frank Wierzbicki : > Before I start complaining, I want to mention what a huge help it has > been to be able to directly compare the AST exposed by ast.py in > making Jython a better Python.  Thanks for that! > > Now on to the complaints: Though I recently added support for this in > Jyth

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Eric Smith
Glyph Lefkowitz wrote: On Wed, Aug 19, 2009 at 2:20 PM, Eric Smith > wrote: I think using .network and .broadcast are pretty well understood to be the [0] and [-1] of the network address block. I don't think we want to start creating new terms or access p

Re: [Python-Dev] Two laments about CPython's AST Nodes

2009-08-19 Thread Brett Cannon
On Wed, Aug 19, 2009 at 11:10, Frank Wierzbicki wrote: > Before I start complaining, I want to mention what a huge help it has > been to be able to directly compare the AST exposed by ast.py in > making Jython a better Python.  Thanks for that! > > Now on to the complaints: Though I recently added

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Glyph Lefkowitz
On Wed, Aug 19, 2009 at 2:20 PM, Eric Smith wrote: > I think using .network and .broadcast are pretty well understood to be the > [0] and [-1] of the network address block. I don't think we want to start > creating new terms or access patterns here. > > +1 on leaving .network and .broadcast as-i

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Eric Smith
Peter Moody wrote: On Wed, Aug 19, 2009 at 9:21 AM, R. David Murray wrote: Possibly. Tino means exactly what he said: the broadcast address does not _have_ to be the last IP, nor does the last IP _have_ to be a broadcast, though in practice they almost always are (and using the last IP as a

[Python-Dev] Two laments about CPython's AST Nodes

2009-08-19 Thread Frank Wierzbicki
Before I start complaining, I want to mention what a huge help it has been to be able to directly compare the AST exposed by ast.py in making Jython a better Python. Thanks for that! Now on to the complaints: Though I recently added support for this in Jython, I don't like that nodes can be defin

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Peter Moody
On Wed, Aug 19, 2009 at 9:21 AM, R. David Murray wrote: > On Wed, 19 Aug 2009 at 08:19, Peter Moody wrote: >> >> On Wed, Aug 19, 2009 at 6:47 AM, Tino Wildenhain >> wrote: Le Tue, 18 Aug 2009 13:00:06 -0700, Peter Moody a écrit : >>> >> o.broadcast >>> >>>    IPv4Address('1.1.1.255')

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Antoine Pitrou
Le Wed, 19 Aug 2009 08:35:15 -0700, Peter Moody a écrit : >> >> 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. It is a commo

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Peter Moody
On Wed, Aug 19, 2009 at 8:39 AM, Eric Smith wrote: > Peter Moody wrote: >> >> On Wed, Aug 19, 2009 at 3:20 AM, Antoine Pitrou >> 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 manipu

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread R. David Murray
On Wed, 19 Aug 2009 at 08:19, Peter Moody wrote: On Wed, Aug 19, 2009 at 6:47 AM, Tino Wildenhain wrote: Le Tue, 18 Aug 2009 13:00:06 -0700, Peter Moody a ?crit : o.broadcast ? ?IPv4Address('1.1.1.255') this is often used but not the only valid broadcast address, in fact, any address betwee

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Tino Wildenhain
Peter Moody wrote: On Wed, Aug 19, 2009 at 6:47 AM, Tino Wildenhain wrote: Antoine Pitrou 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

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Eric Smith
Peter Moody wrote: On Wed, Aug 19, 2009 at 3:20 AM, Antoine Pitrou 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 fo

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Peter Moody
On Wed, Aug 19, 2009 at 3:20 AM, Antoine Pitrou 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 wit

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Peter Moody
On Wed, Aug 19, 2009 at 6:47 AM, Tino Wildenhain wrote: > Antoine Pitrou 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 a

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Tino Wildenhain
Antoine Pitrou 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 ad

Re: [Python-Dev] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-19 Thread Antoine Pitrou
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