Hi,

On Fri, Sep 10, 2010 at 06:08:46AM -0700, smichr wrote:
> Would it make sense to unify Function, Wild and Symbol creation so one
> could do
> 
> var('f:3', function=1) to get f0, f1, f2 functions, etc...? If there
> were a short keyword(sy?) for injecting or not inject the results then
> this could merge var and symbols, too.
> 
> var('x:z', sy=1) => symbols('x:z')
> 

In new symbols()/var() you have 'cls' keyword argument, so you can do:

In [1]: symbols('f:3', cls=Function)
Out[1]: (f0, f1, f2)

In [2]: map(type, _)
Out[2]: [<class 'sympy.core.function.FunctionClass'>, ... ]

In [3]: symbols('w:3', cls=Wild)
Out[3]: (w₀, w₁, w₂)

In [4]: map(type, _)
Out[4]: [<class 'sympy.core.symbol.Wild'>, ... ]

In [5]: var('f:3', cls=Function)
Out[5]: (f0, f1, f2)

In [6]: map(type, _)
Out[6]: [<class 'sympy.core.function.FunctionClass'>, ... ]

In [7]: var('w:3', cls=Wild)
Out[7]: (w₀, w₁, w₂)

In [8]: map(type, _)
Out[8]: [<class 'sympy.core.symbol.Wild'>, ... ]

(assuming that cls has certain properties).

When unifying symbols() and var(), I though about adding a keyword
argument to symbols(), say 'inject', which when set to True would
do var()'s job. This way var() would become just a simple wrapper.
However, as we disallow using var() in the library code, then it is
clearer, in my opinion, to have a separate function for the task,
than an argument to a function.

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

-- 
Mateusz

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to