On 13 March 2014 07:49, Chris Angelico <ros...@gmail.com> wrote: > > Umm, yeah, that one. Why did I think hasattr was the only way around > that? Anyway, that just means I picked a bad example. There are others > where you have to go for the full try/except.
You may have been thinking of item lookup on sequences. Attribute lookup can switch to getattr (at the cost of becoming more opaque to the compiler and static analysers), and mappings can fall back to get(), but there's no such alternative for sequences. Anyway - exemplary work on the PEP, even though Guido remained unconvinced. Not only does it become a useful resource if anyone else comes forward with a similar proposal, it becomes something we can point to and perhaps revisit next time someone asks for implicit exception handling to be added to yet another API :) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ 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