lies about OOP

Mike Meyer mwm at
Wed Dec 15 07:10:22 CET 2004

"sbassi at" <sbassi at> writes:

> Instead of copy and paste, I use functions for code reuse. I didn't see
> the light of OOP, yet. I use Python but never did anything with OOP. I
> just can't  see what can be done with OOP taht can't be done with
> standart procedural programing.

There are cases where functions just don't do the job.

I at one time needed to use the little-used (and probably little-know)
"account" featre of an ftp server to automate a regular file
transfer. Both Perl and Python come with ftp modules. Perl's was (is?)
procedural, Python's is OO. Neither supported the account feature.

Now, if I used perl to do this, I'd have to either modify the module
in place, meaning I'd have to remember to put the mods back every time
we updated perl if I couldn't get them to buy the patch, or I could
make a local copy of the module, meaning it wouldn't get any bug fixes
that might come with new versions of perl.

With the Python version, I created a subclass of the FTP connection
module, rewrote just the login method, and installed that locally. Now
I don't have to worry about installing new versions of Python, as my
code is outside the distribution. But I still get the benefit of any
bug fixes that show up outside the login method. I also submitted the
new login method, and it's now part of the standard module.

This kind of code reuse just isn't possible with procedural code.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list