Changeset 5061cd6 in git for modules/python


Ignore:
Timestamp:
Sep 21, 2005, 9:49:17 AM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
535a90f86c2de40dedb322577e7a72036eb78b04
Parents:
f8d3784d894e063faf10053a22ff58e474036840
Message:
*bricken: automatic ring change


git-svn-id: file:///usr/local/Singular/svn/trunk@8636 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/python/interpreter.py

    rf8d378 r5061cd6  
    11from Singular import *
     2def debug_out(s):
     3  print s
    24#def build_arg_list(*args)
    35def list2arg_list(args):
     
    3537                    proc.print_type()
    3638                    raise Exception
     39                prepare_ring(args)
    3740                l=list2arg_list(args)
    38                 return call_interpreter_method(proc, l)
     41                erg= call_interpreter_method(proc, l)
     42                finish_ring()
     43                return erg
    3944            try:
    4045                fun_wrapper.__name__=name
     
    6166    l=list2arg_list(args)
    6267    return cbm(name,l)
     68
     69def find_rings(arglist):
     70  """FIXME: doesn't handle everything and depth"""
     71  for item in arglist:
     72    if isinstance(item,polynomial) or isinstance(item,ideal):
     73      return [item.ring()]
     74  return []
     75 
     76
     77oldrings=[]
     78def prepare_ring(arglist):
     79  rl=find_rings(arglist)
     80  debug_out("rl is" +str(rl))
     81  if len(rl)==1:
     82    r=rl[0]
     83    oldrings.append(ring())
     84    r.set()
     85  else:
     86    if len(rl)==0:
     87      oldrings.append(None)
     88    else:
     89      debug_out("Warning to many rings in call")
     90      oldrings.append(None)
     91def finish_ring():
     92  r=oldrings.pop()
     93  if r:
     94    r.set()
     95   
Note: See TracChangeset for help on using the changeset viewer.