Yeah, I guess if you don't like typing so many parentheses you could
define a helper function like that. You could even make an odd number
of arguments make the last argument be the otherwise condition. I
think this is how Maple's piecewise() works. I personally like the
tuple syntax because it keeps things organized and makes it easier to
read, especially when there are a lot of conditions. Unfortunately, we
can't allow both types of syntax in Piecewise itself because there
could potentially be ambiguity if you wanted to use a Tuple or some
kind of iterable object as an expression.

Aaron Meurer

On Thu, Oct 31, 2013 at 10:55 PM, Chris Smith <[email protected]> wrote:
> To use an OrderedDict is just the same as using Piecewise since you have to
> give it a list of key,value pairs. So a better workaround for anyone that
> cares about this is to just define your own little helper:
>
> ```
>>>> pw=lambda *l: Piecewise(*unflatten(l, 2))
>>>> pw(
> ... x,x<0,
> ... y,x>=0)
> Piecewise((x, x < 0), (y, x >= 0))
> ```
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to