Reinhold Birkenfeld wrote:
> Noam Raphael wrote:
>
>>On 5/4/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote:
>>>resource = opening("file.txt")
>>>resource:
>>> (...)
>>>
>>>The latter would have to be forbidden.
>>
>>Can you explain why it would have to be forbidden please?
>
>
> Well, with it you could create suites with _any_ introducing
> identifier. Consider:
> [...]
>
> transaction:
> (...)
>
>
> Do you understand my concern? It would be very, very hard to discern
> these "user-defined statements" from real language constructs.
For each block statement, it is necessary to create a *new* iterator,
since iterators that have stopped are required to stay stopped. So at a
minimum, used-defined statements will need to call something, and thus
will have parentheses. The parentheses might be enough to make block
statements not look like built-in keywords.
PEP 340 seems to punish people for avoiding the parentheses:
transaction = begin_transaction()
transaction:
db.execute('insert 3 into mytable')
transaction:
db.execute('insert 4 into mytable')
I expect that only '3' would be inserted in mytable. The second use of
the transaction iterator will immediately raise StopIteration.
Shane
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com