#18109: Restructure IntegerListLex code
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.10
Component: combinatorics | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers: Travis Scrimshaw
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/tscrim/refactor_integer_lists_lex-18109|
2e5e9691da0c2003d7eb3ddcf6c5c5010281f4dc
Dependencies: #15525 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by tscrim):
Replying to [comment:86 jdemeyer]:
> Two details:
> 2. Why this change? I find the old version more readable.
> {{{
> #!diff
> - good_sum = (nu >= p.min_sum and nu <= p.max_sum)
> - good_length = (l >= p.min_length and l <= p.max_length)
> - no_trailing_zeros = (l <= max(p.min_length,0) or mu[-1] != 0)
> - return good_sum and good_length and no_trailing_zeros
> + return (nu >= p.min_sum and nu <= p.max_sum # Good sum
> + and l >= p.min_length and l <= p.max_length # Good
length
> + and (l <= max(p.min_length,0) or mu[-1] != 0)) # No
trailing zeros
> }}}
> If this is for performance reasons, you can instead `cdef bint` the
variables `good_sum`, `good_length` and `no_trailing_zeros`.
It was for performance reasonings, but not the reason you're thinking of:
short circuiting.
--
Ticket URL: <http://trac.sagemath.org/ticket/18109#comment:88>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.