You can wrap lambdify into a new function: def get_lambda(expr, modules="numpy", **kwargs): from sympy.utilities.iterables import ordered signature = list(ordered(expr.free_symbols)) return signature, lambdify(signature, expr, modules=modules, **kwargs)
With it, the argument are sorted alphabetically. You can easily see the list of arguments by printing signature. Davide. Il giorno gio 9 lug 2020 alle ore 11:08 Roberto < franceschini.robe...@gmail.com> ha scritto: > I have seen that lambdify wants a list for the arguments to be treated as > symbols. This list can be also give as a python set, e.g. {x,y,z }, which > is exactly what would be returned by a .free_symbol property. If lambdify > is feed a set like that of the output of .free_symbol it may change their > order in the conversion from set to list. This is done silently and may > cause major disfunction in the use of the lamdified function because you > think x is x, but is y instead and so on. > I would like to ask developers to check for the type of the lambdify list > of arguments and throw a warning to flag that a set is being converted and > that the ordering is not guaranteed. > Given that .free_symbols returns a set, not a list, this is very common > pitfall in my opinion and must be prevented. > > -- > 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 sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/c1517b79-490b-4a1b-b526-3e3842b55fbco%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/c1517b79-490b-4a1b-b526-3e3842b55fbco%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAO%3D1Z09sTVnnD3jxJi4UdDDkis7R5Dwh8NHDY0PMOYESmK79gA%40mail.gmail.com.