NNTP-Posting-Date: Wed, 18 Jul 2012 10:49:09 -0500 Date: Wed, 18 Jul 2012 16:49:06 +0100 From: Lipska the Kat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.python Subject: Re: Encapsulation, inheritance and polymorphism References: <3vnfd9-343.ln1@satorlaser.homedns.org> <-8SdnVrXGqie25jNnZ2dnUVZ7qKdnZ2d@bt.com> <5005A103.9050802@stoneleaf.us> <5006b48a$0$29978$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 61 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-LOX7h+T869NBJwT9n/kqucJiOEmtNm8nF7ulgXnLDHn/ABxCJ6WuXi3QpQT7hm3UPPvYEgBGJ9WqmfD!p2CzQ+2uRzXVHI7uNe/BBcW3WH+FN7+lof0T3PhmSlhheOKs/xRMY+t6E8lKDdidownddaWmI4Q= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 4268 Path: csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail Xref: csiph.com comp.lang.python:25579 On 18/07/12 16:32, Ethan Furman wrote: > Lipska the Kat wrote: >> On 18/07/12 14:05, Steven D'Aprano wrote: >>> Even with a break, why bother continuing through the body of the >>> function >>> when you already have the result? When your calculation is done, it's >>> done, just return for goodness sake. You wouldn't write a search that >>> keeps going after you've found the value that you want, out of some >>> misplaced sense that you have to look at every value. Why write code >>> with >>> unnecessary guard values and temporary variables out of a misplaced >>> sense >>> that functions must only have one exit? >> >> Object Oriented programming is all about encapsulating human concepts >> in a way that makes sense to human beings. Make no mistake, it is >> NEVER the case that a software system is written for any other reason >> than to serve human beings. OO is more than just the mechanics of >> writing code, it's a state of mind. > > I must admit I have no idea how we went from discussing Single Exit > functions to the One True Purpose of Object Oriented Programming; are > you saying that SE is one of the basic tenets of OO? It's my fault, I get carried away sometimes. Maintainable code is one of the basic tenets of OO, it all seems so clear to me and I get frustrated when I think that others don't see the 'beauty' ... but then I come to my senses and realise that there is always another way to do things. >> Python looks like an interesting language and I will certainly spend >> time getting to know it but at the moment it seems to me that calling >> it an Object Oriented language is just plain misleading. > > Since *everything* in Python is an object, how can you /not/ call it an > OO language? Obviously I can't. I can't make a call as I haven't studied the language yet. I just can't get my head around duck typing at the moment as it is just so ... different. > Sure, you don't have to use everything as an object -- > plain functions exist -- kinda ;) Even functions live in some namespace: > len() lives in __builtin__, any top level function lives in its module, > etc. Oh, and namespaces are objects. > > It seems to me that Python is more about providing tools, and then > staying out of your way. > > That works for me. Maybe it will work for you, too. I hope so and thank you for being so calm and reasonable in your response. > > ~Ethan~ Lipska -- Lipska the Kat: Troll hunter, Sandbox destroyer and Farscape dreamer of Aeryn Sun.