[Python-ideas] reprs of recursive datastructures.

Cameron Simpson cs at zip.com.au
Sun Sep 9 01:20:20 CEST 2012


On 08Sep2012 23:27, MRAB <python at mrabarnett.plus.com> wrote:
| On 08/09/2012 23:06, Alexander Belopolsky wrote:
| > If we ever decide to allow non-ASCII characters in repr, my vote for
| > repr of recursive list will be
| >
| >>>> "[[\N{ANTICLOCKWISE GAPPED CIRCLE ARROW}]]"
| > '[[⟲]]'
| >
| Or:
| 
|  >>> "[[\N{CLOCKWISE GAPPED CIRCLE ARROW}]]"
| '[[⟳]]'
[...]

These are sublime!

Personally I find the former one more intuitively expressive of a
recursion, probably because the arrow points "left" (in my current font,
anyway; how variable is this?) and therefore towards the stuff already
recited. The latter arrow seems to point "right" or "forwards", no so
recursive to my intuition.

| >>>> "\N{WHITE SMILING FACE}"
| > '☺'

Cute but a -1 from me; less intuitive meaning.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

To understand recursion, you must first understand recursion.



More information about the Python-ideas mailing list