On Tue, Oct 31, 2017 at 3:50 PM, Ivan Pozdeev via Python-ideas
<[email protected]> wrote:
> On 30.10.2017 17:32, Guido van Rossum wrote:
>>
>> This is a key example of a case where code speaks. Can you write an
>> implementation of how you would want single() to work in Python code?
>>
>> On Mon, Oct 30, 2017 at 2:49 AM, Ivan Pozdeev via Python-ideas
>> <[email protected] <mailto:[email protected]>> wrote:
>>
>>     The initial post on the above link summarizes the suggested
>>     implementation pretty well.
>>
> |defsingle(i): try: ||v =i.next()
> |||exceptStopIteration:||||raiseException('No values')|||try: ||i.next()
> ||exceptStopIteration: ||returnv||else: ||raiseException('Too many values')|
> ||printsingle(name forname in('bob','fred')ifname=='bob')||| |
>
> ||

raise WhitespaceDamagedException from None

ChrisA
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to