Re: __str__ for each function in a class

2010-05-19 Thread Terry Reedy
On 5/19/2010 1:14 AM, Vincent Davis wrote: I am sure this is easy but I am not sure how to do it and google was failing me. Lets say I have a class() with an def x() and def y() and I want print(class.x) and (class.y) to have custom prints (__str__) how do I do this For example class C(object):

Re: __str__ for each function in a class

2010-05-19 Thread Xavier Ho
On 5/19/2010 1:14 AM, Vincent Davis wrote: class C(object): def __init__(self, new): self.letter = dict(a=1,b=2,c=3, amin=np.amin) self.new = new self._x = None self._Y = None @property def x(self): I'm the 'x' property. self._x =

__str__ for each function in a class

2010-05-18 Thread Vincent Davis
I am sure this is easy but I am not sure how to do it and google was failing me. Lets say I have a class() with an def x() and def y() and I want print(class.x) and (class.y) to have custom prints (__str__) how do I do this For example class C(object): def __init__(self, new):