On 13 March 2014 07:49, Chris Angelico <rosuav at 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 | ncoghlan at gmail.com | Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4