Method Chaining

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Fri Jun 17 04:38:32 EDT 2016


On Friday, June 17, 2016 at 8:13:50 PM UTC+12, Ned Batchelder wrote:
> But the unchained version is more explicit, and avoids
> the awkward parenthesis.

What if it had been

    the_context.move_to((p1 + p2a) / 2)
    the_context.line_to(p1 + (p2 - p1) * frac)
    the_context.line_to((p1 + p1a) / 2)
    the_context.stroke()
    the_context.move_to((p2 + p2a) / 2)
    the_context.line_to(p2 + (p1 - p2) * frac)
    the_context.line_to((p2 + p1a) / 2)
    the_context.stroke()

?


More information about the Python-list mailing list