Status: New
Owner: renato.c...@gmail.com
Labels: Type-Enhancement Priority-Medium

New issue 2406 by renato.c...@gmail.com: improve Tuple constructor
http://code.google.com/p/sympy/issues/detail?id=2406

I've just recently discovered Tuple and find it very useful, but there are two things I would find useful when constructing a Tuple:

* Sympify the arguments. If Tuple is a container for Basic, it's natural that all elements should be so. For instance, if you try:

Tuple(x, 1).subs(x, 0)

you get AttributeError: 'int' object has no attribute '_eval_subs'

* Behave more like the builtin tuple: automatically denest one level of lists and tuples (if it's the only argument) and evaluate generators. What you get now is:

Tuple(i for i in range(4))
Tuple(<generator object <genexpr> at 0x41e30a0>)
[instead of Tuple(0, 1, 2, 3)]

Tuple([x, y, z])
Tuple([x, y, z])
[instead of Tuple(x, y, z)]

This behavior is the same as always calling Tuple(*tuple(arg)) instead of Tuple(arg).

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to