Can a low-level programmer learn OOP?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Fri Jul 13 17:06:41 EDT 2007


Chris Carlen a écrit :
> Bruno Desthuilliers wrote:
> 
>> Chris Carlen a écrit :
> 
>  >[edit]
> 
>>>  Must possibly learn a completely new way of thinking (OOP)
>>
>>
>> Not necessarly. While Python is OO all the way down - meaning that 
>> everything you'll work with will be an object (functions included) -, 
>> it doesn't *force* you into OO (IOW : you don't have to define classes 
>> to write a Python program). You can as well use a procedural - or even 
>> somewhat functional - approach, and most Python programs I've seen so 
>> far are usually a mix of the three.
>>
>>> not just a new language syntax. 
>>
>>
>> You forgot one of the most important part of a language : idioms. And 
>> it's definitively *not* idiomatic in Python to use classes when a 
>> simpler solution (using plain functions and modules) is enough.
> 
> 
> I see.  That's very promising.  I guess some articles I read painted a 
> picture of religiousity among OOP programmers.

That's alas a common disease - I'd say the best way to be definitively 
disgusted from OO is to read comp.lang.object :(

>  But that is not the 
> impression I am getting at all on the street.

Heck. As you said, the important is to get things done. And I guess 
that's why we all (here) love Python. Last time I had to work on a 
Pascal program (actually Delphi's ObjectPascal, but the whole thing was 
almost caricaturally procedural), I found myself having to write tens of 
lines of code for thing that would have been no-brainer one-liners in 
Python, and define new types (records - Pascal's structs) where Python's 
builtin dict type would have do the trick. It's not a matter of 
procedural vs OO vs functional, it's a matter of using the appropriate 
tool for the job.



More information about the Python-list mailing list