[Python-ideas] where statement in Pyret
David Mertz
mertz at gnosis.cx
Sun Nov 10 19:55:08 CET 2013
On Sun, Nov 10, 2013 at 10:37 AM, Ron Adam <ron3200 at gmail.com> wrote:
> def sum(iterable):
>
>> # implementation of sum
>>
>> assert sum([]) == 0
>> assert sum([1, 2, 3]) == 6
>>
>
> A mechanism to say "always execute assert statements in this module
>> regardless of optimisation level" could also be useful.
>>
>
> That change *along with* a way to "always execute asserts in this scope"
> would make asserts more useful.
>
assert not test_mode or sum([]) == 0
assert not test_mode or sum([1, 2, 3]) == 6
--
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons. Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131110/69bbfb02/attachment-0001.html>
More information about the Python-ideas
mailing list