repr

Accessing object memory address

When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it out? ...

Java equivalent of Python repr()?

Is there a Java method that works like Python's repr? For example, assuming the function were named repr, "foo\n\tbar".repr() would return "foo\n\tbar" not foo bar as toString does. ...

ActionScript: An equivalent of Python's `repr` (ie, a useful string representation of an object)?

Python's repr function is awesome: it returns a printable representation of an object. For example, repr(["a'b", {1: 2}, u"foo"]) is the string '["a\'b", {1: 2}, u\'foo\']'. Notice, eg, how quotes are properly escaped. So, is there anything like this for ActionScript? For example, right now: [1, 2, ["3", "4"]].toString() produces the ...

Best output type and coding practices for __repr__() functions?

Lately, I've had lots of trouble with __repr__(), format(), and encodings. Should the output of __repr__() be encoded or be a unicode string? Is there a best encoding for the result of __repr__() in Python? What I want to output does have non-ASCII characters. I use Python 2.x, and want to write code that can easily be adapted to Pyt...

Error with T::iterator, where template parameter T might be vector<int> or list<int>

I'm trying to write a function to print a representation of common STL containers (vector, list, etc..). I gave the function a template parameter T which, for example, might represent vector. I'm having problems getting an iterator of type T. vector<int> v(10, 0); repr< vector<int> >(v); ... template <typename T> void repr(const T & ...