On 03/09/16 23:20, zakaria wrote: > Is there any practical usage of using reference cycling?
There are a (very) few cases where data structures require the creation of cyclic references. One example I've used is in managing comms networks where nodes are multiply and/or cyclically linked and you need to build those linkages into your data model. In those cases you need to manage the cleanup yourself. But most cyclic references occur by accident, the programmer probably didn't intend them to exist but it just so happened that one object points to another which happens to point at another which in turn points at the first. The cycle can span many objects. Think of a directory tree where a deeply nested node has a link pointing back at a root level node. But the root also indirectly points at that low level node by means of the tree structure... As a specific example, It often happens in GUIs where widgets hold references to other widgets higher in the widget parent/child tree. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor