6 Aug
2011
6 Aug
'11
11:21 p.m.
Now that it is valid in any expressions, I'd argue the repr should reflect the literal syntax. There are however some reasons this might not be desirable: ellipsis is used to represent recursive objects, and by reprlib when summarizing long reprs. Thus there would be ambiguity. A counter-argument may be that a repr isn't intended to be completely unambiguous, reversible or parseable - in deed many objects mimic the literal syntax of builtin types even though they add special behavior. I was going to give os.environ as an example here, and then learned this is no longer the case in Python 3, so maybe it is after all seen as undesirable. :) Anyway: discuss!