Behaviour of prepend!() with SymPy

Is the following behaviour intended?

prepend!([Sym("A"),Sym("B")],Sym("C")) # returns Vector{SymPy.Sym}: [C,B]
prepend!([Sym("A"),Sym("B")],"C") # returns Vector{SymPy.Sym}: [67,A,B]

In the first case, A is replaced by C.
For the second case: Is there a prepend function without conversion to get a Vector{Any}?

prepend! eventually iterates over the object passed to it in the second position. When the string “C” is iterated over, you get Char values that don’t convert to symbolic objects. Try instead to call with ["C"] in place of "C". BTW, you’d see the same issue if you just used string objects.

Thanks for the info!

prepend!([Sym("A"),Sym("B")],[Sym("C")]) works.

Before, I used this “workaround”: a = [Sym("C"), a]

For a single term, you should consider unshift!, as it is less verbose: unshift(a, "C")

Thanks again!

Side note: unshift!() has been renamed to pushfirst!() in v0.7, see