Hi

I'd say the problem isn't recursion. Here I'm using the definitions given
in:
https://en.wikipedia.org/wiki/Recursion
https://www.cs.utah.edu/~germain/PPS/Topics/recursion.html

Rather, it's that the data has a loop (or cycle) in it. A simple example of
this is
    >>> x = []
    >>> x.append(x)
    >>> x
    [[...]]
    >>> x[0] is x
    True

So far as I know, it's not possible to create such using only immutable
objects. And anything created using only immutable objects will have a hash.

A beginner can easily by mistake create an object such as x above, and
without the short-circuit provided by
    >>> x
    [[...]]
the result is an unprintable object, that further raises an exception (or
worse). That's really bad for the poor beginner.

As a first approximation, my opinion is that data having such a loop /
cycle in it is at least a code smell, and perhaps worse. However, there may
be examples that I've not considered that would make me change my mind.

By the way, in the mathematics of the symmetric group (permutations) the
two tuples
    >>> (0, 1, 2, 3)
    >>> (1, 2, 3, 0)
are different representations of the same cycle (where here the word cycle
has a different meaning).

Also by the way, determining if two vertex-edge graphs are isomorphic is a
hard problem. I've been told that the best tool for this is
https://www3.cs.stonybrook.edu/~algorith/implement/nauty/implement.shtml

To summarise, it's loops / cycles in the representation of the data that's
the problem. Without a use case to the contrary, I'd say don't do this.
That's my opinion. Yours may be different.

Final idea. Perhaps a tool to detect cycles in data might be a good idea.

Finally, Happy New Year.

 --
Jonathan
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LPWI7X7RJBWOSMXFQ3VURMADKDSLA5VR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to