What is rv expecting for __repr__ implementations?

Using RV 4.0.12 I have been experiencing inconsistent behavior with __repr__ in python.


It appears that if I try to define the __repr__ as something with <>'s it doesn't respect what I've given it, if I leave them out I get inconsistent behavior where sometimes I'll get the string as given, sometimes it will prepend the classname.


Is there a best practices for defining repr methods in classes used in RV?


Here is a simple isolated test:


class ReprTest(object):
    def __init__(self):
    def __repr__(self):
        return "<Something Useful for Debugging>"
    def __str__(self):
        return "String Representation"

class NoAngleReprTest(object):
    def __init__(self):
    def __repr__(self):
        return "Something Useful for Debugging"
    def __str__(self):
        return "String Representation"

test = ReprTest()
print "=Start Test="
print "=repr(test)="
print repr(test)
print "=test.__repr__()="
print test.__repr__()
print "=test="
print test
print "=str(test)="
print str(test)
print "=test.__str__()="
print test.__str__()

test2 = NoAngleReprTest()
print "=repr(test2)="
print repr(test2)
print "=End Test="


=Start Test=
String Representation
String Representation
String Representation
Something Useful for Debugging
=End Test=


Please sign in to leave a comment.