Comment #5 on issue 2307 by [email protected]: Duplicate methods: as_coeff_mul and as_coeff_Mul
http://code.google.com/p/sympy/issues/detail?id=2307

Like this?

    h[1] >>> def em(eq):
         ...   c, x = eq.as_coeff_mul()
         ...   if len(x) and x[0].is_Number:
         ...     c *= x[0]
         ...     x = x[1:]
         ...   return c, x
         ...
    h[1] >>> em(4.*x)
    (4.00000000000000, (x,))
    h[2] >>> em(-3*x)
    (-3, (x,))
    h[3] >>> em(-3.0*x)
    (-3.00000000000000, (x,))
    h[3] >>> em(-3.0*pi*x)
    (-3.00000000000000, (pi, x))
    h[4] >>> (-3.0*pi*x).as_coeff_Mul()
    (-3.00000000000000, pi*x)
    h[5] >>>

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues?hl=en.

Reply via email to