Le lundi 04 juillet 2011 à 11:33 -0700, Adam Moore a écrit :
> So when I import x from sympy.abc, and then check its 'type', its type
> is <class 'sympy.core.symbol.Symbol'>
>
> What makes this so? In a project I'm working on, I'm trying to learn
> some lessons from sympy as to how variables and such are handled, but
> when I create my own Symbol class and execute
>
> x = Symbol('x')
>
> and then check the type, its type is <type 'instance'>
It looks like your Symbol class is an old-style class. You should only
use new-style classes, i.e. write 'class Symbol(object):' and not 'class
Symbol:'.
>
> What is the nature of a Symbol in sympy then if it is not also an
> instance of a class?
Symbols are instances of the class 'Symbol', which is precisely what
type(x) tells you.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.