Peter Moody wrote: this is a good idea and I'll implement this. .iterhosts() for subnet > - (network|broadcast) and .iterallhosts() for the entire subnet (in my > testing, looping over an iterator was actually reasonably faster than > just for i in IP(network):, so I'll support iterators for both)
I would suggest just changing __iter__ to be the equivalent of the current iterhosts() and then changing iterhosts() as described. Such a change would would also fix the thread safety and nested iteration problems problems suffered by the current __iter__ implementation. I haven't executed the following, but from reading the code I am confident they would behave as a I describe in the comments: # With the current implementation, this is an infinite loop net = IPv4Network("192.168.2.0") for x in net: iter(net) # And this only runs the inner loop once for x in net: for y in net: pass Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ 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