Hi,
On Tue, Sep 3, 2013 at 8:08 PM, Gilbert Gede <
gilbe...@gmail.com> wrote:
> I think there were concerns on adding additional arguments to lambdify. That
> was why I added the dummify flag to the lower-level lambdastr instead, and
> tried to keep lambdify's interface simple.
>
> I think the logic could be re-written to be a little more robust - maybe not
> dummifying if a dictionary or 'sympy' is explicitly passed in or implemented
> functions are provided, and only dummifying if the numeric outputs are going
> to take precedence over the symbolic outputs?
Would you mind giving an example where it would be a very bad idea to
dummify? I read the pull request discussion, but I think the really
nasty examples Stefan gave actually raise errors with dummify. I ask
only because I didn't entirely understand the problem.
For guessing, my guess would be that someone wanted numerical
evaluation if there is:
* a dictionary first argument
* any other namespace than sympy as first argument
* an implemented function anywhere
But I think this is a typical example of zen of Python :
$ python -c 'import this' | grep guess
In the face of ambiguity, refuse the temptation to guess.
> I suppose the question is: Are there use cases where dummification is
> needed, and there are implemented functions or the desired module is
> 'sympy'? If so, we should add dummification as a flag.
Let's say the user does want:
y = x(t)
lambdify(y, 2 * y)
to work. Then, at the moment, they have to guess how we are guessing
that they will tell us that.
Whereas:
lambdify(y, 2 * y, dummify=True)
with a good docstring, seems like it's not much extra work or extra
complexity in the signature, for the reasonably large gain in clarity.
Cheers,
Matthew