Expanding on my previous answer, I found a way to save printlevel and 
restore it when I'm done.  The key idea is try to get a handle to a 
function that may not exist, then create it if it doesn't:

from sage.libs.singular.function import singular_function, lib
lib('normal.lib')
normal = singular_function('normal')
execute = singular_function('execute')

try:
    get_printlevel = singular_function('get_printlevel')
except NameError:
    execute('proc get_printlevel {return (printlevel);}')                   
                                                      get_printlevel = 
singular_function('get_printlevel')

saved_printlevel = get_printlevel()
execute('printlevel=-1')
pols_in_S = normal(S.ideal(g))[1][0]
execute('printlevel={}'.format(saved_printlevel))



-- 
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 post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/3ac7ad67-f861-4bc0-8c17-363366f549f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to