[Python-Dev] Problems with new-style classes and coercion (original) (raw)
David Abrahams David Abrahams" <david.abrahams@rcn.com
Mon, 22 Apr 2002 10:43:08 -0500
- Previous message: [Python-Dev] Breaking builds
- Next message: [Python-Dev] Problems with new-style classes and coercion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This appears to be a 2.2.1 bug. Just looking for confirmation or correction before I put it in the bug tracker:
Python 2.2 (#28, Mar 13 2002, 23🔞18) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
coerce class ex(object): ... def init(self, v): ... self.v = v ... def coerce(self, other): ... return self, ex(other) ... def add(self, rhs): ... return ex(self.v + rhs.v) ... def repr(self): ... return 'ex(' + repr(self.v) + ')' ... ex(3) ex(3) coerce(ex(1),2.3) (ex(1), ex(2.2999999999999998)) ex(1).add(ex(2)) ex(3) ex(1)+2.3 Traceback (most recent call last): File "", line 1, in ? File "", line 9, in add AttributeError: 'float' object has no attribute 'v'
Thanks, Dave
+---------------------------------------------------------------+ David Abrahams C++ Booster (http://www.boost.org) O__ == Pythonista (http://www.python.org) c/ /'_ == resume: http://users.rcn.com/abrahams/resume.html () () == email: david.abrahams@rcn.com +---------------------------------------------------------------+
- Previous message: [Python-Dev] Breaking builds
- Next message: [Python-Dev] Problems with new-style classes and coercion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]