[Python-3000] iostack and Oh Oh

tomer filiba tomerfiliba at gmail.com
Thu Nov 30 21:45:03 CET 2006


> http://wiki.python.org/moin/AbstractBaseClasses

NOOOOOOOO!  so many baseclasses, who can remember all that?!

now whenever i wish to implement, say, MyFunnyDict, i'll have to
go over the manual, see all the standard interfaces (which may
reach hundreds of classes), and think which interfaces i desire
for my class to "adhere to". that's very bad programming.
they have a name for that in CS: java.

you have to manually declare things, before doing them.
with these ABCs, instead of a simple "def __something__",
you first have to declare everything you'll possibly want to do
(either by explicitly inheriting from, or another syntax such as
__implements__ = ...).

and with all that reliance on the *type* of objects, how would proxies
work?

for example, in RPyC i use local proxy objects that refer to remote
objects (in another process/machine). just like weakref.proxy, you get
another object that behaves exactly the same as the real object,
but your code needn't be aware of that:
if the object's has all the attributes, it's a duck.

now, the proxy object will have to "inherit" all of the interfaces the
real object has, in order for dispatching/isinstance to work.
and that's bad. for weakrefs that may be simple, but in RPyC
we are talking about objects from different processes, which
is not simple at all (types compare by object id, for once).

to sum it up -- if it looks like java and limps like java, it's java!


-tomer

P.S, i took a look over my post, and it's seems rather angry. i'm not.
sorry if it does, but i'm too tired to rewrite it. it's been a long day
and i'm a moment from bed, so no offense in advance.


More information about the Python-3000 mailing list