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 [email protected].
To post to this group, send email to [email protected].
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/a019db9a-c6c8-4df5-9865-157ddbb60258%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to