python=an object-based lang !! OO lang

By java/c++/c# definitions, Python is not strictly object-oriented (“—–“), but in a special sense, python is more object-based (“++++”) than the big 3.

– a class is a dictionary/hash, just like perl
– no declared type for each variable
– no type checking, less type safety
– no strict ctor
– no private/protected ie no access control
– java and c# disallows python’s freestanding, standalone functions.
– no static members
– unclear separation of instance field and class field.
– subclass ctor doesn’t always call base class ctor to initialize the inherited fields
– a regular object instance can have any undeclared field/method injected into it in broad daylight, bypassing any type check.

I think python is object-based more than object-oriented. Further,
I guess python is more dict-based than object-based. I guess many OO features are implemented using dict. I guess a lot of meta-programming uses the dict.

+ a namespace is accessed as an object (and also a dict)
+ a module is an object (and also a dict)
+ a function is an object (and also a dict with attributes)
+ a method is an object (and also a dict with attributes)
+ a built-in function is an object
+ a type is an object, and perhaps is used more than java reflection is
+ an int, float etc is an object (and probably a dict)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s