[Python-ideas] Accessing the result of comprehension's expression from the conditional
ben+python at benfinney.id.au
Sat Jun 20 04:45:01 CEST 2009
Jim Jewett <jimjjewett at gmail.com> writes:
> On Fri, Jun 19, 2009 at 3:39 AM, Lie Ryan<lie.1296 at gmail.com> wrote:
> > res = [x**x as F for x in nums if F < 100]
> This, I have wanted.
You have it:
res = [f for f in (x**x for x in nums) if f < 100]
In addition to the fact that this works now in existing Python, I find
it clearer than the above syntax you say you want.
\ “It's my belief we developed language because of our deep inner |
`\ need to complain.” —Jane Wagner, via Lily Tomlin |
More information about the Python-ideas