from numpy import ndarray
from .sequence import Sequence
from .nexpr import n

def seq(arg):

    if isinstance(arg, (tuple, list, ndarray)):
        nv = list(range(len(arg)))
        return Sequence(arg, nv, var=n)        

    s = arg
    if s.startswith('{'):
        if not s.endswith('}'):
            raise ValueError('Mismatched braces for %s' % s)
    
    parts = s.split(',')
    N = len(parts)

    vals = []
    m0 = None
    for m, item in enumerate(parts):
        if item.startswith('_'):
            if m0 is not None:
                raise ValueError('Cannot have multiple zero index indicators')
            m0 = m
            item = item[1:]
        try:
            val = int(item)
        except ValueError:
            try:
                val = float(item)
            except ValueError:
                val = complex(item)
        vals.append(val)

    if m0 is None:
        m0 = 0
        
    nv = list(range(-m0, N - m0))
    return Sequence(vals, nv, var=n)

@@ -19,16 +19,39 @@
 ndarray%0A
+from .expr import expr%0A
 from .se
@@ -682,187 +682,27 @@
 1:%5D%0A
-        try:%0A            val = int(item)%0A        except ValueError:%0A            try:%0A                val = float(item)%0A            except ValueError:%0A                val = complex
+%0A        val = expr
 (ite

Support symbolic args for seq