[Python-3000] why interfaces shouldn't be trusted
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Wed May 10 22:16:56 CEST 2006
"tomer filiba" <tomerfiliba at gmail.com> writes:
> one thing that worries me with generic methods is, they would
> dispatch based on types... which means my proxies would all break.
> please, think of the proxies! ;)
OTOH proxies generated by my Python<->Kogut bridge would break if
hasattr was used to determine interfaces. For example if obj is a
Kogut object wrapped in a Python object, then obj.__iter__ always
succeeds, but calling the resulting function fails if the underlying
object doesn't actually support iteration.
(Types aren't currently reflected either, so type-based interface
discovery would fail too, but I plan to change that.)
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-3000
mailing list