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

Martin Maly Martin.Maly at microsoft.com
Wed Dec 21 20:06:25 CET 2005


I believe this should be quite easy to fix. Barring any unexpected surprises, we should have fix for this soon.

Thanks for the report!
Martin

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Stanislas Pinte
Sent: Wednesday, December 21, 2005 1:28 AM
To: users at lists.ironpython.com
Cc: simpy-users at lists.sourceforge.net
Subject: [IronPython] Simpy not working on IronPython because of type(generator) problem

Hello,

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?

thanks,

Stan.




_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list