Correct type for a simple "bag of attributes" namespace object

Terry Reedy tjreedy at udel.edu
Sun Aug 3 18:55:13 EDT 2014


On 8/3/2014 10:51 AM, Marko Rauhamaa wrote:
> Peter Otten <__peter__ at web.de>:
>
>> i. e. you have a per-class and per-instance memory consumption. The
>> latter is smaller, so with regards to memory consumption instantiating
>> only pays off when there is more than one employee.
>
> I've reached a point where I think classes are a superfluous OO concept.
> You only need objects.
>
> Python is close to that reality. The "class" keyword really creates a
> function that creates objects, and the objects' class membership is
> ignored in ducktyping.

The object class is used to implement duck typing.  It is the delegation 
of operations to class instance methods that makes extensible duck 
typing possible.

'a + b' is equivalent to type(a).__add__(a, b)

-- 
Terry Jan Reedy




More information about the Python-list mailing list