python without OO

beliavsky at aol.com beliavsky at aol.com
Wed Jan 26 18:42:03 EST 2005


Nick Coghlan wrote:
> Davor wrote:
> > thanks for the link
> >
> >
> >>know what's funny: in the Lua mailing list there is currently a
> >>discussion about adding OO to Lua.
> >
> >
> > I guess most of these newer languages have no choice but to support
OO
> > if they want to attract a larger user base :-(...
>
> Tell me, have you ever defined a C structure, and then written
various functions
> to operate on that structure (i.e. taking a pointer to the structure
as their
> first argument)?
>
> Have you then put both the structure definition and the function
prototypes into
> a single header file and used that header file from other code?
>
> That's OO programming: associating several pieces of information as
an 'object',
> and associating various methods to operate on instances of those
objects.

Then why was C++ invented? What you have described can be done in C,
Pascal, and Fortran 90, all of which are generally classified as
procedural programming languages. As Lutz and Ascher say in "Learning
Python", in object-based programming one can pass objects around, use
them in expressions, and call their methods. "To qualify as being truly
object-oriented (OO), though, objects need to also participate in
something called an inheritance hierarchy." Whether true OOP is a Good
Thing is arguable and depends on the situation.




More information about the Python-list mailing list