Skip to content

Commit

Permalink
Make sympy.abc more understandable
Browse files Browse the repository at this point in the history
Generating symbols through the compiler is not understood by analysis tools,
so they will generate an error for every use of something imported from
sympy.abc.
  • Loading branch information
toolforger committed Apr 11, 2015
1 parent 1bcbdd0 commit 0e6031d
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions sympy/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,36 @@

import string

from .core import Symbol
from .core import Symbol, symbols
from .core.alphabets import greeks
from .core.compatibility import exec_

a, b, c, d, e = symbols('a, b, c, d, e')
f, g, h, i, j = symbols('f, g, h, i, j')
k, l, m, n, o = symbols('k, l, m, n, o')
p, q, r, s, t = symbols('p, q, r, s, t')
u, v, w, x, y, z = symbols('u, v, w, x, y, z')

A, B, C, D, E = symbols('A, B, C, D, E')
F, G, H, I, J = symbols('F, G, H, I, J')
K, L, M, N, O = symbols('K, L, M, N, O')
P, Q, R, S, T = symbols('P, Q, R, S, T')
U, V, W, X, Y, Z = symbols('U, V, W, X, Y, Z')

alpha, beta, gamma, delta = symbols('alpha, beta, gamma, delta')
epsilon, zeta, eta, theta = symbols('epsilon, zeta, eta, theta')
iota, kappa, lamda, mu = symbols('iota, kappa, lamda, mu')
nu, xi, omicron, pi = symbols('nu, xi, omicron, pi')
rho, sigma, tau, upsilon = symbols('rho, sigma, tau, upsilon')
phi, chi, psi, omega = symbols('phi, chi, psi, omega')

_latin = list(string.ascii_letters)
# COSINEQ should not be imported as they clash; gamma, pi and zeta clash, too
_greek = list(greeks) # make a copy, so we can mutate it
# Note: We import lamda since lambda is a reserved keyword in Python
_greek.remove("lambda")
_greek.append("lamda")

for _s in _latin + _greek:
exec_("%s = Symbol('%s')" % (_s, _s))

def clashing():
"""Return the clashing-symbols dictionaries.
Expand Down

0 comments on commit 0e6031d

Please sign in to comment.