[Python-Dev] accumulator display syntax
Skip Montanaro
skip at pobox.com
Fri Oct 24 08:37:38 EDT 2003
More information about the Python-Dev mailing list
Fri Oct 24 08:37:38 EDT 2003
- Previous message: [Python-Dev] accumulator display syntax
- Next message: [Python-Dev] accumulator display syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tim> squares = (f(x)**2 for x in inputs) # assuming reiterability here
Tim> for f in math.sin, math.cos, math.tan:
Tim> plot(squares)
How much more expensive would this be than
for f in math.sin, math.cos, math.tan:
squares = (f(x)**2 for x in inputs)
plot(squares)
which would work without reiterability, right? The underlying generator
function could still be created at compile-time and it (or its code object?)
stored in the current function's constants. 'f' is simply an argument to it
when the iterator is instantiated.
Skip
- Previous message: [Python-Dev] accumulator display syntax
- Next message: [Python-Dev] accumulator display syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list