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): 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 = self.new return self._x @property def y(self): """I'm the 'x' property.""" self._y = self.new*-1 return self._y ....... >>> print(class.x) ****x**** >>> print(class.y) --------- ++++y++++ --------- *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog <http://vincentdavis.net> | LinkedIn<http://www.linkedin.com/in/vincentdavis>
-- http://mail.python.org/mailman/listinfo/python-list