I have been working on a large assignment and I'm almost finished except I need help writing the __str__
and __repr__
functions of a Set container.
I have never done this and I have no clue what to do. Searching the internet, I'm still stuck.
I've tried something like:
'%s(%r)' % (self.__class__, self)
I need to print out a representation like this:
'set([ELEMENT_1, ELEMENT_2,..., ELEMENT_N])'
My elements are stored in an array class that I wrote the set container around. I access it with a loop like for item in self
or if item in self
Please help?