It is true that my answer elides over some things, but the underlying point is that there isn't a real comparison available between languages because in Java you should pretty much never need this. Yes, technically you could work yourself into a position where you might need that question answered and have to go through the reflection, but that is truly a last resort, whereas in Python it's sort of the first.
(I say "sort of" because even in Python this is a weird thing; the traditional answer to the question "can I call this as a function" is to simply try it and catch the exception if it fails.)
well of course. Its a last resort in python too. while it's much easier to do in python, its far from idiomatic. It's getting into 'too much magic' territory.
Comments
It is true that my answer elides over some things, but the underlying point is that there isn't a real comparison available between languages because in Java you should pretty much never need this. Yes, technically you could work yourself into a position where you might need that question answered and have to go through the reflection, but that is truly a last resort, whereas in Python it's sort of the first.
(I say "sort of" because even in Python this is a weird thing; the traditional answer to the question "can I call this as a function" is to simply try it and catch the exception if it fails.)
well of course. Its a last resort in python too. while it's much easier to do in python, its far from idiomatic. It's getting into 'too much magic' territory.