OO in Python? ^^

Antoon Pardon apardon at forel.vub.ac.be
Thu Dec 15 15:37:27 CET 2005


Op 2005-12-15, Ben Sizer schreef <kylotan at gmail.com>:
>
> Antoon Pardon wrote:
>> Op 2005-12-15, Ben Sizer schreef <kylotan at gmail.com>:
>
>> So? I answered a question. That my answer is not usefull for
>> a specific purpose is very well prosible but is AFAIC irrelevant.
>
> The point being made was that your declarations such as these:
>
>   int: a
>   object: b
>
> would break the original idea (a module containing a sum() function
> that can take any object that has an addition operator).

1) a declaration as 

  object: b

Wouldn't break the original idea, since b would be basically a python
object as it is now.

2) Sure a declaration as

  int: a

would break the original idea, but that was just given as an example
of what kind of declarations one might possibly use. You are not obligated
to use declarations that limits you so much.

> Inheritance
> isn't good enough in this situation. I apologise if that isn't what you
> were answering, but that seems to have been the thread context.

No I wasn't answering that. I was just trying to give an idea from
a different angle. People seem to think that one uses static typing
or inheritance typing or duck typing. IMO the possibility of inheritance
typing doesn't have to prevent duck typing.

-- 
Antoon Pardon



More information about the Python-list mailing list