A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-March/013736.html below:

[Python-Dev] Simple generators, round 2

[Python-Dev] Simple generators, round 2Samuele Pedroni Samuele Pedroni <pedroni@inf.ethz.ch>
Mon, 19 Mar 2001 18:08:41 +0100 (MET)
Hi.

> > 2) Do not expose the resume and suspend methods to the
> >    Python user, and recode Generator.py as an extension
> >    module in C. This should prevent abuse of frames.
> 
> I like the frame methods.  However, this may be a good idea since
> Jython may implement things quite differently.

I should repeat this: (if we want to avoid threads for implementing
generators because for them that's really an overkill, especially
if those are used in tight loops): jython codebase have following 
limitations:

- suspensions point should be known at compilation time
 (we produce jvm bytecode, that should be instrumented
  to allow restart at a given point). The only other solution
  is to compile a method with a big switch that have a case
  for every python line, which is quite expensive.
  
- a suspension point can at most do a return, it cannot go up 
  more than a single frame even if it just want to discard them.
  Maybe there is a workaroung to this using exceptions, but they
  are expensive and again an overkill for a tight loop.

=> we can support  something like a supsend keyword. The rest is pain :-( .

regards.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4