On Sun, Dec 27, 2015 at 1:20 PM, Serhiy Storchaka firstname.lastname@example.org wrote:
On 27.12.15 19:16, Guido van Rossum wrote:
I really feel you all are overworrying and overthinking this. A downside to me is that <...> isn't clear about what the type of the object is. The use case here is not sophisticated users, it's beginners who have accidentally managed to create a recursive list or dict. They have most likely not even encountered Ellipsis objects yet. There's nothing clearer than the current notation to help them see that they've done something unusual.
My second alternative was to use full object.__repr__. E.g. <list object at 0xb7111498>.
The problem isn't that it's too long (though it is) but that it just poses the question "why is this not using the regular [etc] notation?"
Or, if this is considered too long, shorter form: <list>.
Or, as Georg suggested, use the word "recursive" for clearness: <recursive>. Or combine type name and the word "recursive": <recursive list>.
Sure, but I still am curious what problem you are really trying to solve. The problem seems to be purely in your mind. You also seem to be taken the guideline that the repr() of an object should be eval()-able way too strictly. It is just a guideline to help class authors decide what their repr() should look like if they don't have a better idea. And the guideline encourages writing repr()s that are intuitive to readers. Beyond that there's nothing of value -- it just reduces guesswork on both sides.