Hello I am trying to add a str method to a Set ADT implementation to allow a 
user to print the contents of a set. However the resulting string should look 
like that of a list. except I am suppose to use curly brackets to surround the 
elements.

For an example...
>>> set1 = Set()
>>> print(set1)
{}


Question is how do you implement the "curly brackets" in my str method?

This is what I have so far...

def __init__( self, *initElements ):
    self._theElements = list()

def __str__(self):
     return self._theElements
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to