Sorry about the HTML. I _hate_ the way they configure things at work -- I have to remember to force text, and can't get around the stoopid legal disclaimer at the bottom. I'll try to remember not to post from here again. Best regards, Pat -----Original Message----- From: Guido van Rossum [mailto:guido at esi.elementalsecurity.com] Sent: Monday, October 13, 2003 3:39 PM To: Patrick Maupin Cc: pyython-dev at python.org Subject: RE: [Python-Dev] Python and Coercion This is a feature. It is mentioned in passing in http://www.python.org/2.2.2/descrintro.html : """Note that while in general operator overloading works just as for classic classes, there are some differences. (The biggest one is the lack of support for __coerce__; new-style classes should always use the new-style numeric API, which passes the other operand uncoerced to the __add__ and __radd__ methods, etc.) """ PS Next time don't post HTML. --Guido van Rossum (home page: http://www.python.org/~guido) -----Original Message----- From: python-dev-bounces at python.org [mailto:python-dev-bounces at python.org] On Behalf Of Patrick Maupin Sent: Monday, October 13, 2003 1:08 PM To: python-dev at python.org Subject: [Python-Dev] Python and Coercion Dear developers: __coerce__ does not seem to work in new-style classes, e.g. class foo: def __int__(self): return 1 def __coerce__(self,other): return int(self), int(other) x = foo() print 1+x works fine, but if foo is derived from object, it fails with: TypeError: unsupported operand type(s) for +: 'int' and 'foo' After finding this difference, I could not figure out if this was an interpreter error or a documentation error. http://www.python.org/doc/current/ref/coercion-rules.html states that: "In Python 3.0, coercion will not be supported." so I thought maybe this was the first round of removing this support. I googled around for awhile trying to find supporting documentation for this -- it appears it might have to do with PEP 228, but I'm not really sure, so I was hoping someone could point me at a reference point for this statement. Regards, Pat Maupin This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto. This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4