Path: csiph.com!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'example:': 0.03; 'argument': 0.05; 'root': 0.05; 'subject:Python': 0.06; 'binary': 0.07; 'class,': 0.07; '(aka': 0.09; 'bits': 0.09; 'defines': 0.09; 'formatting': 0.09; 'whatever.': 0.09; 'stored': 0.12; '"object': 0.16; "(i'm": 0.16; '(system': 0.16; '(there': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hierarchy': 0.16; 'hierarchy,': 0.16; 'name)': 0.16; 'only)': 0.16; 'referencing': 0.16; 'sub- class': 0.16; 'subclass': 0.16; 'subject:Java': 0.16; 'unix- style': 0.16; 'wrote:': 0.18; 'library': 0.18; 'bit': 0.19; 'dependent': 0.19; 'thu,': 0.19; 'programming': 0.22; 'adds': 0.24; 'oriented': 0.24; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'programming.': 0.30; 'strongly': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'object.': 0.31; 'class': 0.32; 'probably': 0.32; 'run': 0.32; 'style': 0.33; 'subject: (': 0.35; "can't": 0.35; 'info': 0.35; 'classes': 0.35; 'good.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'introducing': 0.36; 'maintained': 0.36; 'opposed': 0.36; 'done': 0.36; 'method': 0.36; 'possible': 0.36; 'operating': 0.37; 'step': 0.37; 'handle': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'letters': 0.60; 'most': 0.60; "you'll": 0.62; "you've": 0.63; 'here': 0.66; 'further,': 0.74; 'click': 0.77; 'mount': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=9WKYS/Z9rnaASZzsGyi37dAoHFotgKXAIKA357YuMJc=; b=hYu2+66nULpRGEtwY2ZsyE0v4PC1LKrbMEMDkf3rN/8m2qPcgF1ix4S8q7Fcb3wdBX NeQo/z27K/xCfipdY/gZ44JNEMiB4vMhxBgqksSbOYeW1+uTEDvCXIfw/rBe6K9tMl1p a76Iis0wHex4+ovxjObeEfMcDVHHiyEKtJp1I8pZJUpVsNl+MeFABpX7ENsxfpMorHHf HL0zxcRh1gJqFFb/EOMjI2cHGYKQeODP9R96pdIGP3Lbv/RgDlxZEaQstGMn59EGWMlf GbAWEeK0o13kUNPcf43SKJH7H0cK4Uq0jno0W2siIX2OOH3abclvpGiMHuxUcQJhsxNd 9wQg== MIME-Version: 1.0 X-Received: by 10.49.62.137 with SMTP id y9mr1781635qer.59.1381994120389; Thu, 17 Oct 2013 00:15:20 -0700 (PDT) In-Reply-To: <1df612d9-27a0-4f06-9b0c-a8d7fd9bf257@googlegroups.com> References: <1df612d9-27a0-4f06-9b0c-a8d7fd9bf257@googlegroups.com> Date: Thu, 17 Oct 2013 18:15:20 +1100 Subject: Re: Python was designed (was Re: Multi-threading in Python vs Java) From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381994122 news.xs4all.nl 15898 [2001:888:2000:d::a6]:51875 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56941 On Thu, Oct 17, 2013 at 5:49 PM, Peter Cacioppi wrote: > I don't know if I want to step into the flames here, but my understanding= has always been that in the absence of polymorphism the best you can do is= "object based" programming instead of "object oriented" programming. > > Object oriented programming takes things further, most significantly by i= ntroducing the idea that the object reference you are referencing might be = a run time dependent sub-class. Even Python, which isn't strongly typed, ma= nages polymorphism by allowing the self argument to a sub-class of the meth= od class. What you've said here is that "without polymorphism, you can't have polymorphism". :) The OS/2 PM with SOM (System Object Model) classes does give polymorphic functionality; here's a bit of an example: (Reference: http://www.markcrocker.com/rexxtipsntricks/rxtt28.2.0299.html - class hierarchy, standard classes only) Part way down you'll see WPFolder. It's a subclass of WPFileSystem (aka "stuff backed by the disk" as opposed to abstract objects), which is a subclass of WPObject (aka "stuff you can see and click on"), which is a subclass of SOMObject (aka "stuff"). The WPFolder class defines a whole pile of functionality, and its code is all stored in some library somewhere, as a binary on the disk. Well and good. Now look at the WPRootFolder class. It's a subclass of WPFolder and adds a few extra bits and bobs designed for the root of any particular drive (OS/2 uses an MS-DOS style of drive letters for volumes, rather than a Unix-style mount points) - menu items for formatting the drive, getting extra info perhaps, whatever. But most of its functionality comes from WPFolder. When a WPFolder method is called on a WPRootFolder, the code has to handle the fact that it's working with a subclass of that object. As long as the proper SOM boilerplate is maintained correctly, the WPFolder code won't even be aware that it's operating on a WPRootFolder. That's polymorphism, and it's all done in a completely cross-language way :) (There are additional complications, as it's possible for a subclass to WPReplaceClass (I'm probably misremembering the function name) itself into the position of the parent class, which messes up the hierarchy a bit - it still all works, but it's less clean to describe. Most things work the way I'm describing.) ChrisA