FEEDBACK WANTED: Type/class unification
tim.one at home.com
Sun Jul 29 00:37:46 CEST 2001
[Marcin 'Qrczak' Kowalczyk, to Guido]
> Type/class unification is definitely worth doing.
> But since you want some critic, here is one: the picture is
> complicated. Not that I know how to do it better, perhaps it's
> unavoidable. Nevertheless it's so complicated that details escape me.
I'm going to quote myself from Andrew Kuchling's "Python Warts" page, at
... you can program productively in Python for years before even
noticing [the type/class split]! It's a "deadly sin" to some old-
timers, and to many extension (in C) writers, but not to the
majority of Pythoneers (bless their ignorant little hearts <wink>).
The implementation of Python classes in C, and all current uses of the
metaclass hook/hack, routinely explode giant brains all over the planet.
It's difficult and error-prone stuff.
>From my POV, the real thrust of type/class unification is to ease life for
the relative handful of people who build the extension types and classes the
rest of us can then use without much thought. Their lives are 7 kinds of
hell today, and perhaps that can be reduced to 2 <wink>.
Guido is exposing the machinery so that it's usable *from* Python too, but
no matter how you cut it, metaclasses are plain confusing, and really
shouldn't be of interest to the majority of users (except as happy end-users
of code written by people who *have* to wrestle with stuff at this level).
So, yes, it *is* complicated, because you're down to the raw bones here.
Even efficiency isn't glossed over at this level, and that always
complicates life too. But before getting *too* panicked by that, people
should ask themselves whether they'll ever need to program at this level --
my bet is that most people don't need to, and indeed would be better off
steering clear of it. If you find yourself never caring about whether a
thing is "a type" or "a class" today (I've got almost no code that cares!),
you're not the primary audience.
reassuringly-but-perhaps-for-the-wrong-reasons-ly y'rs - tim
More information about the Python-list