'Check if Symbol is negative in sympy

In sympy you can check if a number is negative using the is_negative attribute, however this returns None for a Symbol. I want to be able to check whether a Symbol is preceded by a minus sign or not. I can do this with:

from sympy import Symbol

x = Symbol("-G")

if str(x)[0] == "-":
    print("Value is preceded by a minus sign")

but is there a better way than just looking string representation of the Symbol?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source