Infinitely nested containers
rosuav at gmail.com
Fri Nov 21 08:03:49 CET 2014
On Fri, Nov 21, 2014 at 4:54 PM, Gill Shen <gillarete at gmail.com> wrote:
> How is this behavior implemented under the hood? And why is this allowed at all? Is it just a curiosity or can you do something useful with it?
Simple: The list contains itself. When you dereference the list, you
get back the original list. It does have value; you just have to be
careful of any recursive operation like printing it out - the repr()
for a list carefully checks for this.
More information about the Python-list