On 8/31/06, Brett Cannon <[EMAIL PROTECTED]> wrote:
> On 8/31/06, Calvin Spealman <[EMAIL PROTECTED]> wrote:
> > On 8/31/06, Brett Cannon <[EMAIL PROTECTED]> wrote:
> > > So this feels like the Perl idiom of using die: ``open(file) or die``
> > "Ouch" on the associated my idea with perl!
> =) The truth hurts.
Isn't this almost the opposite of "or die"? Unless I'm having a very
bad day, the die idiom is more like a SystemExit, but this proposal is
a way to recover from expected Exceptions.
> func(ags) || die(msg)
means
>>> if not func(args):
... raise SystemExit(msg)
This proposal, with the "a non-dict mapping might not have get" use case:
>>> ((mymap[k] except KeyError then default) for key in source)
means
>>> def __temp():
... for element in source:
... try:
... v=mymap[k]
... except KeyError:
... v=default
... yield v
>>> __temp()
-jJ
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com