What does your CG subclass from? If it's a Function, I think it
should automatically work, like
In [50]: a = Wild('a')
In [51]: f(1, 2).match(f(a, 2))
Out[51]: {a: 1}
Aaron Meurer
On Thu, Jun 30, 2011 at 3:04 PM, Sean Vig <[email protected]> wrote:
> Hi everyone,
> For a part of my project I tried using pattern matching with .match and
> Wild, as described
> hereĀ http://docs.sympy.org/0.7.0/tutorial.html#pattern-matching, to match
> some instances of a class I am working on, however it does not currently
> work as I'd hoped in trying to match objects of CG, which subclasses Expr.
> For example, I'd like to be able to get
>>>> x = Wild('x')
>>>> (CG(1,1,1,1,1,1)).match(CG(x,1,1,1,1,1)
> {x: 1}
> However it currently gives None. I assume I need to implement some function
> (maybe matches or _matches), but if someone knows a bit more about pattern
> matching that could advise me here, I'd appreciate it. Thanks.
> Sean
>
> --
> 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.
>
--
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.