[Python-Dev] Re: Single- vs. Multi-pass iterability

Alex Martelli aleax@aleax.it
Fri, 19 Jul 2002 20:55:06 +0200


On Friday 19 July 2002 07:45 pm, David Abrahams wrote:
	...
> > dyed-in-the-wool Smalltalker in multiple inheritance, or anybody
> > *but* a CLOS-head or Dylan-head in multiple dispatch...:-).
>
> Ahem. *I'm* interested in multiple-dispatch (never used CLOS or Dylan). You
> might not have noticed that I mentioned multimethods in my post about
> supporting overloading in Boost.Python.

Sorry, I hadn't noticed.  I never did production work in CLOS or Dylan,
either, so I guess that enough C++ and templates warp one's brain
enough to increase ones' perceptivity (only way to account for both of us:-).


> > Other aspects of introspection help you implement other primitives
> > lacking in the language.  E.g. "make another like myself but not
> > initialized" can be self.__class__.__new__(self.__class__) -- not
> > the most elegant expression, but, hey, I've seen worse (such as
> > NOT being able to express it at all, in languages lacking the
> > needed ability to introspect:-).
>
> Is that really introspection? It doesn't seem to ask a question.

"What is this concrete object's actual runtime class?" is a question,
even though it may not look like one since the answer is in a
special attribute rather than being obtained from a method call.

Feel free to code type(self) instead of self.__class__ if this feels
more question-ish, of course.  Six of one, half a dozen of the other.

The object is "looking inside itself" -> introspection.  Specifically,
looking as its own metadata.


> > Looking at *ANOTHER* object this way isn't really INTROspection,
> > btw -- it's EXTRAspection, by the Latin roots of these words:-).
>
> Okay. I hope you won't be offended if I continue to use the wrong term so
> that everyone else can understand me ;-)

How depressingly pragmatic.


Alex