PEP 245

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Apr 2 12:51:18 EDT 2001


Sun, 1 Apr 2001 23:30:32 +0000 (UTC), Alex Shindich <alex at shindich.com> pisze:

> > To get better error messages early, instead of cryptic errors raised
> > deep where the object was finally actually used.
> 
> Try this:
> class MyInterface:
>     def foo (self):
>         """
>         """
>         raise UnimplementedMethodException ("Method foo is not implemented.")

It doesn't change a message that an internal function i never
heard about tried to call an object which is not callable into
a message that a function I called expects a predicate.

> All it guarantees is that the concrete class has methods with the
> same names as those in the interface.

No framework can *guarantee* more. Any framework can be misused by
providing useless instances of generic concepts.

> Hmm... I happened to like to Java... It's just that I use it when
> I need strong typing.  And I totally love Python,  and I use it
> whenever I can...

A flaw in Java's approach to specifying interfaces is that it requires
to specify all of them during definition of a class. It's not necessary
(no matter if typing is static or dynamic) and Python will surely not
require it.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list