Eric Snow added the comment:
@sbromberger, there's no need for your own package. Just use something like
this:
_addr_cache = {}
def ipaddr(addr):
try:
return _addr_cache[addr]
except KeyError:
_addr_cache[addr] = ipaddress.ipaddress(addr)
return _addr_cache[addr]
You could even throw weakrefs in there if your use case demanded it.
----------
nosy: +eric.snow
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23103>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com