[BangPypers] Object Oriented Programming in python

Saager Mhatre saager.mhatre at gmail.com
Mon Oct 21 07:25:01 CEST 2013


On Oct 15, 2013 4:10 AM, "Dhananjay Nene" <dhananjay.nene at gmail.com> wrote:
>
> On Tue, Oct 15, 2013 at 1:46 AM, Pranav Raj <pranav09032 at hotmail.com>
wrote:
> > Hi fellow python lovers,
> >
> > I wanted to do OOPS programming in python, but i just found out that
there are no private variables in python. Does anyone know why python
classes have no private variables and why python's OOPS concept are a lot
different from other programming languages?
>
> http://stackoverflow.com/a/1641236/12754
>

Meh! Weak arguments, strongly made.

> I am not sure what the history or reasoning was. But encapsulation is not
considered particularly desirable or useful.
>

Which generally lead to poor (or at least poorer) abstractions; but I
digress.

> I think OOPs concepts across a number of languages are quite different.
You will find python having superior constructs eg. metaclasses etc. if you
were comparing Python OOP to C++/Java.

Superior constructs implemented inferiorly. Meteclasses are much^3 more
powerful in Groovy, Ruby and SmallTalk (where some would claim Python
borrowed them from; but that's just not true.) Trust me, I spent almost a
week trying to wrap my head around this before I figured out that Python
Metaclasses are just Class Decorators done differently (read- requiring you
to understand more of the internals without providing too much more
benefit.)

> Just start using the features and over a period of time you will gain a
> reasonable understanding of the subtleties.
> >
> >
> > thank you, Pranav Raj
> >

Pranav,
I'd suggest you keep an open mind and go with what the language/platform
provides you. Python is one of those 'get stuff done' kind of languages and
has a sweet spot, but OO isn't quite all in that spot. There is some
overlap, but it can be hard to find.


More information about the BangPypers mailing list