Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.065 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'am,': 0.12; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ignored,': 0.16; 'intersection': 0.16; 'subject:Adding': 0.16; 'subject:classes': 0.16; 'subject:interface': 0.16; 'mon,': 0.16; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'assumes': 0.23; 'message-id:@mail.gmail.com': 0.28; 'to:addr:python-list': 0.34; 'two': 0.37; 'received:google.com': 0.37; "there's": 0.37; 'steven': 0.38; 'received:209.85': 0.38; 'either': 0.39; '(with': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'type': 0.61; '2011': 0.61; '26,': 0.67; 'circle': 0.73; 'failure': 0.74; '12:27': 0.84; 'nice,': 0.84; 'self.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LBcRHSUr7Dw7NSI3V7OaRxFkS6y4q5a4xPui9hCnk4Y=; b=QXyfsLjzurtFGKJIAbhroBJ8O+mtNMtab7rT/TdrOmWMn2OscYzft6XKtAG0qXCmOS yjPelPf2Ck8KgQ94Hcu9/3D51WXxXMYAYGY63S3mgZOJ3IuAD9UFBnebKOYlwESWJpAt 07kKiu5Ual4XoSaq+RaEqPv603wq8c3KPZDZQ= MIME-Version: 1.0 In-Reply-To: <4ef724d4$0$29973$c3e8da3$5496439d@news.astraweb.com> References: <8f345777-1ef7-46dc-b3fb-a0bea5ebf2c3@r16g2000prr.googlegroups.com> <22ea371a-f282-4d81-89f6-bc3229e2e8b1@a17g2000yqj.googlegroups.com> <4ef712c0$0$29973$c3e8da3$5496439d@news.astraweb.com> <4ef724d4$0$29973$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 26 Dec 2011 00:37:22 +1100 Subject: Re: Adding an interface to existing classes From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324820245 news.xs4all.nl 6958 [2001:888:2000:d::a6]:51048 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17894 On Mon, Dec 26, 2011 at 12:27 AM, Steven D'Aprano wrote: > There's nothing in the above that assumes that other has the same type as > self. It's just that the type of other is ignored, and the type of self > always wins. I find that a nice, clear rule: x.intersection(y) always > returns a point with the same type as x. The intersection of DrawableLine and DrawableLine is DrawablePoint. That's not the same type as either of the inputs. Same if you seek the intersection of two planes, which is a line - or two spheres, which is a circle (with possible failure if they don't intersect). ChrisA