Quoth [EMAIL PROTECTED] (Alex Martelli): | Jens Theisen <[EMAIL PROTECTED]> wrote: ... |> What do you do when you want to no if a certain method or function is |> actually used from somewhere, say "foobar", it a language which allows |> (and even encourages) that it could be called by: |> |> getattr(obj, "foo" + "bar")() |> |> ? | | "Encourages"? What a silly assertion. Python makes introspection | easier than Java's Reflection, C#'s similar capabilities, and C/C++'s | primitive dlopen/dlsym, but the existence of similar dynamic name | resolution abilities in each of these languages reflects similar | underlying real needs. The functionality is there for those cases in | which it's needed, but it's silly to use it when not needed.
Silly indeed, and why would such a thing ever be needed? Yet it does in fact occur in widely used Python software, in an application where it of course wasn't really needed, rather was sort of convenient. This is like the C enthusiast who tells you that any self-respecting programmer won't mind accounting for storage, or the Perl enthusiast who tells you that there's nothing about the language that encourages hard-to-read code. Give people a feature like this, and they will find a need for it, to the detriment of comprehensibility. I'm not saying that we should therefore use C++ !, but let's be realistic about the costs of Python's benefits. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list