is python Object oriented??

Stephen Hansen apt.shansen at gmail.com
Fri Jan 30 01:14:55 EST 2009


> I'm new to Python and also wondering about OOP in Python.
>
> I want to justify the above question (is Python Object-Oriented?).
> Does Python follow the concepts/practices of Encapsulation,
> Polymorphism and Interface, which are quite familiar to Java
> programmers?


Python does not enforce Encapsulation; but convention is extremely
successful here although there's some really loud people in this newsgroup
who state otherwise. Python programmers tend to be very well-behaved in this
regard and they do not poke into private API's -- unless /they have to/.
That's important: /have/ to. If they were not allowed, they'd be unable to
use that code. Internally in corporate software this is a complete
non-issue: and in any major project it should be a non-issue too. If you
follow basic convention (private is preceded by _) then it is extremely
clear if you're obeying encapsulation and if someone in your project breaks
it without a good reason-- refuse the addition.

Python is *extremely* polymorphic.

Python does not have any built-in "interface" capability, per se, but there
are add-on libraries that can be used to provide interface functionality if
you are doing a framework or large program that needs it.  Then again
"Interface" is a bit questionable as an "OOP Concept"; its used in some
implementations of an OOP language, and not used in anothers-- and what it
means in one can differ from what it means in another.

There's all kinds of other "concepts" of OOP that various people describe,
and generally you can do them all in Python.

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090129/92ba6a59/attachment-0001.html>


More information about the Python-list mailing list