Ticket #534 (reopened enhancement)

Opened 3 years ago

Last modified 18 months ago

Optimise any(genexpr) and all(genexp)

Reported by: scoder Owned by: scoder
Priority: major Milestone: wishlist
Component: Optimization Keywords:
Cc:

Description

In the special case of all() and any(), generator expressions can be implemented as inlined loops. So the following would run without needing to instantiate a generator function:

all(i for i in range(1,20)
any(x for L in [[0,0], [0,1]] for x in L)

Change History

Changed 3 years ago by scoder

  • owner changed from somebody to scoder
  • status changed from new to assigned

Changed 3 years ago by scoder

  • status changed from assigned to closed
  • resolution set to fixed

Implemented here:

 http://hg.cython.org/cython-closures/rev/1cbd9345c4e1

The current scoping rules are those of Py2 list comprehensions. This needs fixing as soon as proper generator expression scopes are in place. See ticket #465.

Changed 18 months ago by scoder

  • status changed from closed to reopened
  • resolution fixed deleted
  • milestone changed from 0.13 to wishlist

Broken in 0.15, needs reimplementation.

Note: See TracTickets for help on using tickets.