[Python-ideas] 'where' statement in Python? (original) (raw)

Bruce Leban bruce at leapyear.org
Wed Jul 21 17:51:26 CEST 2010


I'm unconvinced of the value at this point but notwithstanding that let me toss in an alternative syntax:

given:
    suite
do:
    suite

This executes the two suites in order with any variable bindings created by the first suite being local to the scope of the two suites. I think this is more readable than the trailing clause and is more flexible (you can put multiple statements in the second suite) and avoids the issue with anyone wanting the where clause added to arbitrary expressions.

FWIW, in math it's more common to list givens at the top.

--- Bruce (via android) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100721/78e45395/attachment.html>



More information about the Python-ideas mailing list