Short answer: no.

Workaround: conceive some prefix to make a really unlikely name; something 
like _my_internal_symbol_t_ or so.

Ameliorating circumstance: for the most part, symbolic variables are just 
immutable place-holders, so it shouldn't matter who uses them. Probably the 
most serious case is when your code interacts with user-supplied symbolic 
expressions and you need to ensure that the variable you use is distinct 
from the ones that occur in the supplied expressions. A prefix should 
handle that (this is also how sage tries to avoid collisions when shipping 
symbols to maxima: it prefixes them with _sage_var_). There is some global 
state in the form of assumptions that can affect the meaning of symbols in 
SR.

If you need multiple "unique" expressions you could go with a symbol 
generating function. A very primitive one:

def gensym_generator():
    i=1
    while True:
        yield SR.symbol("gensym%o"%i)
        i+=1
gensym=gensym_generator().next

Every time you call gensym() you'll get a new symbol. Beware that these 
symbols are not unique across sessions, so if you intend to use parallel 
processing you already need to do something else (hash time in milliseconds 
plus process ID together or something like that)

Also: don't overuse that kind of thing: symbolic variable are leaky (they 
don't really get garbage collected).

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/b986e9ef-1729-41d2-8576-e7fa5285321f%40googlegroups.com.

Reply via email to