Re: Hashable object with self references OR how to create a tuple that refers to itself

2012-06-18 Thread Duncan Booth
Dieter Maurer wrote: > You can create a tuple in "C" and then put a reference to itself into > it, but I am quite convinced that you cannot do it in Python itself. > (Of course, you could use "cython" to generate C code with a source > language very similar to Python). I don't think you can even

RE: Hashable object with self references OR how to create a tuple that refers to itself

2012-06-15 Thread Prasad, Ramit
> > I am trying to create a collection of hashable objects, where each > > object contains references to > > other objects in the collection. The references may be circular. > > > > To simplify, one can define > > x= list() > > x.append(x) > > which satisfies x == [x]. > > Can I create a s

Re: Hashable object with self references OR how to create a tuple that refers to itself

2012-06-15 Thread Dieter Maurer
"Edward C. Jones" writes: > I am trying to create a collection of hashable objects, where each > object contains references to > other objects in the collection. The references may be circular. > > To simplify, one can define > x= list() > x.append(x) > which satisfies x == [x]. > Can I

Re: Hashable

2008-01-26 Thread Steven D'Aprano
On Sat, 26 Jan 2008 11:10:03 +, Simon Pickles wrote: > Hi, > > The term 'hashable'. > > Am I right in thinking it means it can be indexed? like a string or a > dict? No. A hash function is a function which takes an arbitrary object and generates an integer from it. Python has a built-i