Purely a cosmetic thing, but when I create a class in python, how do I control its instances' titles? e.g. for
class Foo():
def __init__(self, name):
self.name = name
I can then create an instance:
>> f = Foo('bar')
>> f
<Foo instance at 0x10ab41a28>
If I wanted that to return bar
, what would I do? (In Django, you use the __unicode__
method of the class, but I've tried setting both __unicode__
and __str__
functions to return self.name
, and while these work on their own, they don't affect the value of the class.)