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

Fredrik Lundh fredrik at pythonware.com
Tue Dec 27 13:26:35 CET 2005

J. Merrill wrote:

> I have not checked if that would work (in either current CPython or IronPython),
> and if it does that's what should be in simpy -- but isinstance wasn't added until
> 2.2 (I think) and simpy was probably built before that.

you got that backwards: GeneratorType was added in Python 2.2, but isinstance
has been around for a long time (1.5 or so).

> You might want to look at this (long) thread:
> http://www.gossamer-threads.com/lists/python/python/365821?nohighlight=1#365821
> which (it seems to me) somewhat suggests using
>    if not hasattr(process, '__iter__'):
> in this case.

without looking at SimPy, it sounds like the best way would simply be to remove
the type test.  if the code uses generators in the usual way, it will simply fail on the
first __iter__ or next call if it's given the wrong kind of object...

cheers /F 

More information about the Ironpython-users mailing list