is python Object oriented??

thmpsn.m.k at thmpsn.m.k at
Sat Jan 31 18:40:59 CET 2009

On Jan 30, 2:32 pm, Michael Torrie <torr... at> wrote:
> Veerendra Ganiger wrote:
> > Python is not purely object oriented programming, because we can write
> > functions without any class.
> > You are right, predefined class attributes are available when we write or
> > execute a piece of python code without defining class, that means it's just
> > using objects for it's purpose. It does not mean its purely object oriented.
> To be clear, python does not force you to lay out your code according to
> some strict object-oriented paradigm.  But Python itself is still purely
> object-oriented, as is your script when parsed.
> This function without a class that you mentioned, is in fact an object
> with attributes.  You can pass a function around just like any other
> object.  Even calling a function is invoked like so:
> myfunc.__call__(params)
> So necessitating that code be inside a class has nothing to do with
> object-oriented programming.  Let's not forget that classes are
> themselves objects (metaobjects in smalltalk parlance if I recall
> correctly).
> Now python does not have any way besides lambda expressions of creating
> unbound function objects, but in practice this doesn't matter as I can
> rebind names freely.  I can still do:
> a=myfunc
> myfunc=some other expression or object
> > It all depends on implementation, I think even we can make "C" object
> > oriented with proper implementation.
> Indeed, any code based on gobject libraries can be object-oriented in
> design and function.

But it's only a faking, and things such as inheritance and
polymorphism are implemented clumsily (actually I'm not even sure
about polymorphism). And of course, there are still no private

More information about the Python-list mailing list