What's better about Ruby than Python?

Alex Martelli aleax at aleax.it
Thu Aug 21 10:53:30 CEST 2003


Joshua Marshall wrote:

> Alex Martelli <aleax at aleax.it> wrote:
> ...
> 
>> But with try/finally, or hopefully some syntax tweak making
>> try/finally semantics even easier to use, this is a kind of idiom
>> that's gonna stay.
> 
> What sort of syntax tweak?

Several possibilities have been discussed on python-dev in the
past.  E.g.,

<somenewkeyword> <someobject>:
    <block>

translating into:

<someobject>.begin()
try:
    try:
        <block>
    except:
        if <someobject>.exception_caught():
            raise
    else:
        <someobject>.correct_termination()
finally:
    <someobject>.end()

or variants thereon.


Alex







More information about the Python-list mailing list