"What is the name of the function/method that called me?"

Gordon McMillan gmcm at hypernet.com
Sun Oct 24 10:54:58 EDT 1999


[Cameron summarizes my comments on introspection]

> Thanks.  Our current status is therefore that all
> known demands for introspection-goop either
> 1.  can be satisfied by __*__ references,
>     which we all recognize as slightly out-
>     side normal operations, or
> 2.  are the result of a misdesign for which
>     we can exhibit a superior alternative,
>     often involving disciplined polymorphism
>     or an interface from an explicit class
>     definition.
> This feels slightly alien to me, but I can get over
> it.  I think it's particularly valuable to write up
> explanations of the form, "If you find yourself
> wanting to XX, take it as a hint to study your design
> in search of a YY, which will yield a better design."

You have summarized just a tad more strongly than I would 
have. I certainly leave open the possibility that today's outre 
techniques become tomorrow's accepted ones.

OTOH, I'm one of the few people who occaisionally writes 
metaclasses (publicly, at least), which is an area where 
introspection merges with rape-and-pillage. Now metaclasses 
were invented (by the infamous Don Beaudry) based on 
certain abstract ideas about object models. But I have 
concluded that the only known usage for metaclasses is 
playing __getattr__ tricks, which can be played (a bit more 
crudely) without all the theoretical trappings that come with 
metaclasses. 

I am thus inclined to try to see behind the arguments about 
introspection to find out what people are actually trying to do.

I'll-pay-for-caller-ID-when-it's-free-ly y'rs

- Gordon




More information about the Python-list mailing list