On 22/02/2014 02:08, Glenn Linderman wrote:
On 2/21/2014 5:06 PM, Jan Kaliszewski wrote:
Or even (still being my favorite):
msg = seq[i] except (IndexError: "nothing")
This syntax actually has a benefit: the parenthesized syntax after
except could become a list, to allow handling different exceptions
from the tried expression with different results:
msg = seq[dictionary[i]] except (IndexError: "nothing", KeyError:
"serious problems")
It shouldn't be a true list. We need lazy evaluation of the default
values. And if an unlisted exception is raised, we don't want any of
the defaults evaluated.
Rob Cliffe
And still allows nesting:
msg = seq[i] except (IndexError: dictionary[i] except (KeyError: "no
fallback data for %s" % i))
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/rob.cliffe%40btinternet.com
No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 2012.0.2247 / Virus Database: 3705/6616 - Release Date: 02/22/14
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com