[Types-sig] Re: Static typing considered HARD
Stephen Purcell
steve@websentric.com
Mon, 13 Dec 1999 11:00:53 +0100
Paul Prescod wrote:
>
> What can you do dynamically in Python that you cannot do with
> reflections and introspection? I've written "map", "apply" and the Y
> combinator in Java so I'm pretty confident that the issue is really just
> syntax and ease of use, not capabilities.
>
> You could prove me wrong by showing a Python programming pattern that
> could not be straightforwardly duplicated using Java reflection.
I have one: dynamic configuration of exception catching --
class Test:
FAILURE_ERROR_TYPE = AssertionError
def run(self, result):
try:
self.runTest()
except self.FAILURE_ERROR_TYPE:
result.failed(self)
except:
result.error(self)
else:
result.success(self)
This is a cut-down version of a real and justifiable example. Try doing
that in Java with reflection and without resorting to 'instanceof' or
'Class.isInstance()'.
-Steve
_______________________________________________
Steve Purcell Squadron Leader
WebSentric AG, http://www.websentric.com/
____"Would you like to look at my Python?"_____