Warren Turkal added the comment:

Won't that instantiate an object for each item in the list though? For example:

>>> list(net.subnets(prefixlen_diff=16))[499]

This take a long time. I was trying to think of a way to lazily instantiate.

For example, I don't want to create 65536 network objects (like above) if I am 
looking for the 500th /24 subnet of 10.0.0.0/8. The following executes much 
more quickly:

>>> ipa.ip_network((10 << 24) + (499 << 8))

That essentially what the __getattr__ method should do. Of course, it might 
also be nice to have a __len__ on that object.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20860>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to