Encapsulation, inheritance and polymorphism

Lipska the Kat lipska at lipskathekat.com
Wed Jul 18 17:49:06 CEST 2012


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.



More information about the Python-list mailing list