timmerk / ipaddr-py

Automatically exported from code.google.com/p/ipaddr-py
0 stars 0 forks source link

repr could be legitimate python #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Your __repr__ is ok, but it would be even more convenient if it emitted
real python code. In this case, it seems like that would be easy to do:

now:
In [6]: a = ipaddr.IPv4('10.1.0.1')

In [7]: repr(a)
Out[7]: '<ipaddr.IPv4: 10.1.0.1/32>'

better:
In [7]: repr(a)
Out[7]: "IPv4('10.1.0.1/32')"

The python result is less ambiguous and easier to paste into an interactive
python console for some debugging. E.g. if I print the repr of a dict of
addresses->hostnames, it would be cool if I could paste that whole result
into another python file for testing.

Original issue reported on code.google.com by drewpca on 2 Oct 2008 at 3:50

GoogleCodeExporter commented 9 years ago
http://codereview.appspot.com/6462

Original comment by sm...@google.com on 2 Oct 2008 at 2:55

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/ipaddr-py/source/detail?r=5

Original comment by sm...@google.com on 4 Oct 2008 at 1:19