<font size="2"><font face="courier new,monospace"><div>I am sure this is easy but I am not sure how to do it and google was failing me.</div><div>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</div>
For example</font></font><div><font size="2"><font face="courier new,monospace"><div>class C(object):</div><div> def __init__(self, new):</div><div> self.letter = dict(a=1,b=2,c=3, amin=np.amin)</div><div> self.new = new</div>
<div> self._x = None</div><div> self._Y = None</div><div><br></div><div> @property</div><div> def x(self):</div><div> """I'm the 'x' property."""</div><div>
self._x = self.new</div><div> return self._x</div><div><br></div><div><div> @property</div><div> def y(self):</div><div> """I'm the 'x' property."""</div>
<div> self._y = self.new*-1</div><div> return self._y</div><div><br></div><div>.......</div></div><div>>>> print(class.x)</div><div>****x****</div><div>>>> print(class.y)</div><div>---------</div>
<div>++++y++++</div><div>---------</div><div><br></div></font></font><div name="mailplane_signature"> <table><tbody><tr><td width="80">
<img src="http://www.gravatar.com/avatar/226e40fdc55d4597a46279296a616384.png">
</td><td width="10"></td><td width="127" align="center">
<div style="padding-right: 5px; padding-left: 5px;
font-size: 11px; padding-bottom: 5px; color: #666666;
padding-top: 5px">
<p><strong>Vincent Davis<br>
720-301-3003
</strong><br>
<a href="mailto:vincent@vincentdavis.net">vincent@vincentdavis.net</a> </p>
<div style="font-size: 10px">
<a href="http://vincentdavis.net">my blog</a> |
<a href="http://www.linkedin.com/in/vincentdavis">LinkedIn</a></div></div></td></tr><tr></tr></tbody></table></div></div>