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)


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

您正在使用您的 账号评论。 登出 /  更改 )

Google photo

您正在使用您的 Google 账号评论。 登出 /  更改 )

Twitter picture

您正在使用您的 Twitter 账号评论。 登出 /  更改 )

Facebook photo

您正在使用您的 Facebook 账号评论。 登出 /  更改 )

Connecting to %s