sympy

Ben Finney ben+python at benfinney.id.au
Wed Mar 30 07:29:14 EDT 2016


Poul Riis <priisdk at gmail.com> writes:

> Is it possible to transfer results from sympy to 'normal' python.

Is Sympy not “normal Python”? What transfer are you intending?

> In the case below I think my intention is clear enough but it does not
> work as intended. How can it be done?

First: no, your intention is not clear. Please write idiomatic Python:
spaces around operators, names which describe the meaning. Follow the
coding style guide PEP 8 <URL:https://www.python.org/dev/peps/pep-0008/>.

Second: no, the intent is obscured because you are using ‘from sympy
import *’. This clobbers the global namespace, making it much more
difficult to tell which names come from a different namespace. Instead,
do ‘import sympy’ and qualify names ‘sympy.Symbol’, etc.

Third: if the code “does not work as intended”, then the answer can be
no better than “change it until it works as intended”. If you want more
detail, please provide more detail on what it *is* doing, and what you
think it *should* do instead.

-- 
 \       “I bet one legend that keeps recurring throughout history, in |
  `\              every culture, is the story of Popeye.” —Jack Handey |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list