Hi all,

I'm wondering about the section on creating symbols in https://github.com/sympy/sympy/wiki/Idioms-and-Antipatterns#strings-as-input .

It is mildly discouraging importing from sympy.abc because an accidental "from sympy.abc import *" would clobber I and Q (and possibly others), and recommends
>>> import symbols
>>> x, y, z = symbols('x y z')
instead.

Now in https://github.com/sympy/sympy/pull/9219 , I applied this advice to
>>> from sympy.abc import t, w, x, y, z, n, k, m, p, i
and got
>>> t, w, x, y, z, n, k, m, p, i = symbols('t w x y z n k m p i')
I think that's actually really dangerous, because it's easy to swap two letters without noticing so you essentially get the equivalent of
>>> p = Symbol('i')
>>> i = Symbol('p')
with the devious consequence that everything would still work but any outputs would be utterly confusing because it would print 'p' wherever the user expects 'i' and vice versa.

So... should I change the wiki to recommend sympy.abc over symbols()?

Regards,
Jo

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/551916B5.8090808%40durchholz.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to