Weird Language Features
Erno Kuusela
erno-news at erno.iki.fi
Sun Feb 18 13:15:47 EST 2001
In article <nnhv8t4obq30ljfgseplp7pi4khhsf9g9n at 4ax.com>, Dave Cross
<dave at dave.org.uk> writes:
| 1/ The programmer calls a function that doesn't actually exist within
| the application (or libraries). Is the a feature whereby the
| programmer can create a "catch-all" function which is called in cases
| like these? Can this function examine the list of existing functions
| and call the most appropriate one? Or create a new function on the fly
| and install it into the application?
python: i can't think of a way to do this for functions,
but you can easily do it for methods - __getattr__ is the magic
method.
see <URL:http://www.python.org/doc/current/ref/attribute-access.html>.
| 2/ Can you filter the input source code before compilation
python does not allow you to do this.
| Of course, if you'd like to tell me just why you consider it's a good
| thing that your language of choice doesn't have these features, then
| I'd be only too happy to hear that too.
as far as i'm concerned language features are guilty (of being
superfluous) before proven innocent :).
-- erno
More information about the Python-list
mailing list