'isa' keyword
phil hunt
zen19725 at zen.co.uk
Thu Sep 1 12:52:34 EDT 2005
On 1 Sep 2005 00:52:54 -0700, talin at acm dot org <viridia at gmail.com> wrote:
>
>The "isa" operator would of course be overloadable, perhaps by an
>accessor functions called __isa__, which works similarly to
>__contains__. The potential uses for this are not limited to
>isinstance() sugar, however. For example:
>
> if image isa gif:
> elif image isa jpeg:
> elif image isa png:
What's wrong with:
if image.isa(gif):
elif image.isa(jpeg):
elif image.isa(png):
In short, I see no need to add further complexity to Python's
grammar.
It could be argued of course, that an OOPL should allow methods to
be sent with a grammar:
receiver selector argument
(which is almost what Smalltalk does), but you're not arguing for
that (and I'm not sure it would work with the rest of python's
grammar).
--
Email: zen19725 at zen dot co dot uk
More information about the Python-list
mailing list