[SciPy-Dev] usage of inspect.getargspec ?
Sat Jan 7 04:34:13 CST 2012
On Sat, Jan 7, 2012 at 05:21, <email@example.com> wrote:
> On Fri, Jan 6, 2012 at 10:05 PM, Travis Oliphant <firstname.lastname@example.org> wrote:
>> For the record, I don't think you are being inappropriately grumpy. Your feedback is exactly the kind required and valued. If you think something stinks, you should speak up. Olfactory sensors can be damaged in others.
>> This discussion is about at least 2 things as far as I can see:
>> 1) Using an API that allows a single callable to have different signatures and purposes
>> 2) Using inspect.getargspec
>> Clearly inspect is seen as too fragile. I don't disagree. I don't weight the impact of that as highly as others in this particular case.
>> But, is it also felt that #1 is untenable?
> My feeling is that #1 is much more a taste question (compared to #2),
> if it can be made to be robust enough.
> I don't like it and I still don't really see the reason for merging
> the two functions in an internal function, _minimize_newtoncg. I agree
> with both Nathaniel, that these are clearly two different call back
> functions, and with Robert, that given the docstring the usage of hess
> versus hess_p should be pretty clear.
> (if they are two different functions, don't call them the same thing, or so.)
> On the other hand we are using type checking in scipy (and
> statsmodels) to dispatch to different code paths. But my imagination
> is not good enough to see how robust for example the "try ... except
> TypeError ... else ..." is, (in contrast to inspect which I know will
> create problems with high probability, and type checking which is
> pretty predictable. Or, to paraphrase Warren, in the latter case, the
> developer doesn't get confused about what the function is doing in
> different cases.)
I'm pretty sure it's going to be robust enough. There are all kinds of
reasons a TypeError could be raised that have nothing to do with the
I don't think that #1 is necessarily "untenable", per se, but I also
don't think that's the determining question. I do think that of all of
the alternatives, the original two arguments is the best, simplest,
easiest to understand, most robust approach.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-Dev