[IronPython] Simpy not working on IronPython because of type(generator) problem

Stanislas Pinte stan at phidani.be
Wed Dec 21 10:27:44 CET 2005


Internally we use a wonderful simulation framework written in python: http://simpy.sourceforge.net/

I cannot make it work on python because it rests on generators...

the main loop of simpy uses type(myFunction) == types.GeneratorType) to determine if it is a
generator or not...

> if not (type(process) == types.GeneratorType):
>         raise Simerror("Fatal SimPy error: activating function which"+
>                        " is not a generator (contains no 'yield')")

However, in IronPython:

>>> import types
>>> def gentest():
      for i in range(0,10):
        yield i
>>> print type(gentest)

<type '__main__+gentest0'>

whereas in CPython it returns 

<type 'generator'>

Any idea if we can fix this easely?



More information about the Ironpython-users mailing list