class-oriented rather than object-oriented?

Ben Finney bignose+hates-spam at benfinney.id.au
Sat May 24 23:21:31 EDT 2008


notnorwegian at yahoo.se writes:

> does object-oriented refer to that everything(strings, ints etc) are
> all objects? so there is a class string somewhere in the
> implementation rather than a primitive or somehing?

The term is used (and abused) in different ways. The term "object
oriented" is usually an abbreviation of "object-oriented programming",
which contrasts with the older practice of "procedural programming".

It refers to the shift in focus, away from programs that feed data
through a mostly-linear procedural process, and toward programs that
define how objects behave and change state, and interact with other
objects.

> are python functions objects?

Yes.

> can a functional language be object-oriented or an objectoriented
> language be functional?

Yes. Again, it's m ore accurate to say that a language *enables* a
particular style of programming. Python enables procedural
programming, object-oriented programming, and functional programming.

> one definition of OO is a language that passes messages between
> objects. but not necessarily that is has to pass message sbetween
> classes?

Classes only exist to define functionality, including the
functionality of creating instances of themselves. It's those
instances that contain state data, and that pass messages back and
forth.

Think of a class as a type definition (and, indeed, types and classes
are now unified in Python since early in the 2.x series), and
instances as specific values of that type. The type defines the
behaviour of its instances, but the instances are what the program
actually uses.

-- 
 \            "Madness is rare in individuals, but in groups, parties, |
  `\         nations and ages it is the rule."  -- Friedrich Nietzsche |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list