lac at strakt.com
Sat Feb 1 05:06:45 CET 2003
> >Only Python strings are a problem here, so IMO a stringlike
> >test like Alex suggested is what is wanted.
> IMO using a particular behaviour probe to infer general behavior
> and/or type info is fraught with pitfalls. E.g., that innocent '+'
> in Alex's probe changes the question from "will you act like a string"
> to "do you implement '+' with the other arg specifically being "''"
> without raising an exception. It is not the same question. Not to
> mention what an unknown object might do in terms of side effects
> and/or execution time when probed.
> I think there is more thinking to do ;-)
> Bengt Richter
Some more thoughts.
Which do you think is more likely to happen a) Somebody creates an
object which implements <something> with an other arg of <something
else> which when fed to that function does something which isn't
wanted or b) somebody creates an object that would have worked
perfectly with the object?
What will be easier to understand and fix as an error c) ooops, I
implemented <something> in this object but it doesn't behave like the
author of <that module> intended, or d) ooops, I am not a real
<whatever> and I got typetest. I wonder which methods, properties,
and other behaviours I need to implement before I am sufficiently
<whatever>-like for the module writer?
I don't think there is a one-size-fits-all answer.
The last one d) is the one that I always want to know, and I would be
happy if it happened automatically. But this might be the job for
the refactoring browser, not the language.
More information about the Python-list