What you're actually doing in Python when you put a list into itself is to put a reference to the list into itself.
L = []
L.append(L)
L[0] is L # True
Python and Ruby arrays are heterogenous, unlike in C++, where strong typing forces us to define a common type for objects contained in the same collection. There's no way to do this with the STL <vector>, but you could do this with an object system, for example Qt, where all "Q" objects derive from QObject:
lainproliant wrote
What you're actually doing in Python when you put a list into itself is to put a reference to the list into itself.
Python and Ruby arrays are heterogenous, unlike in C++, where strong typing forces us to define a common type for objects contained in the same collection. There's no way to do this with the STL
<vector>
, but you could do this with an object system, for example Qt, where all "Q" objects derive from QObject: