What do you mean by "return value"?

Based on the context that you have posted questions about the compiler before I'm going to answer what list comprehension is compiled to.

List comprehension (in python in general, both CPython and Jython) is compiled to:
1. Create an empty list
2. Iterate through the iterator(s) of the comprehension expression
3. for each iteration evaluate the elt and add this value to the list created in step 1
4. when the evaluation of the list comprehension is over, the list created at step 1, that now contains additional elements is left on the stack.

This is done in org.python.compiler.CodeCompiler#visitListComp line 2107.

The code in visitListComp restructures the list comprehension to an equivalent (nested) for loop where the append method of the result list is stored in a temporary variable and invoked in the body. The result list is left on the stack throughout the entire iteration, and is still there when the for loop ends.

/Tobias

On Mon, Jan 11, 2010 at 3:17 AM, Philip Cannata <Phil.Cannata@sun.com> wrote:
Hello, can anyone tell me where in the code the return value is set
for listcomprehension?
thanks
phil


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Jython-dev mailing list
Jython-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev