Hi Stephen,
If you want to list all sympy symbols that you have created in a Python
script, one straightforward way is to use Python’s built-in globals() to
scan the current namespace and check for instances of sympy.Symbol.
Here's a simple example to illustrate:
>>> from sympy import Symbol>>> from sympy.abc import a, b, c
>>> x = Symbol('x')
>>> y = Symbol('y')
>>> z = 3 # this is not a SymPy symbol
>>> symbols_used = [name for name, obj in globals().items() if isinstance(obj,
>>> Symbol)]>>> print("Symbols used :", symbols_used)
This would output:
Symbols used : ['a', 'b', 'c', 'x', 'y']
But do let me know if you are looking for something more specific. Happy to
help further!
Best regards,
Krishnav Bajoria.
On Mon, Jun 23, 2025 at 8:07 PM Stephen Learmonth <
[email protected]> wrote:
> How do I list ALL sympy symbols created in a Python script?
>
> --
> 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 view this discussion visit
> https://groups.google.com/d/msgid/sympy/2f682bea-f462-4188-9873-82c9ebafe889n%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/2f682bea-f462-4188-9873-82c9ebafe889n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 view this discussion visit
https://groups.google.com/d/msgid/sympy/CAF0TZuszeNGv5nP%2B8Y7FypgnOVh-BShWb9pALAj0h3X2S1Mf_A%40mail.gmail.com.