Zbigniew Jędrzejewski-Szmek <zbyszek <at> in.waw.pl> writes: > if sys.version_info[0] < 3: > raise NotImplementedError('This hook is implemented for Python 3 only') > > Wouldn't it be better if the hook did nothing when on python 2? > I think it'll make it necessary to use something like Actually I've realised the guard won't be invoked on Python 2, anyway: I later added a "raise ImportError() from e" in an exception handler, which leads to a syntax error in Python 2 before the guard even gets executed. So, I'll remove the guard (as it does nothing useful anyway) and think a bit more about not failing on Python 2. Perhaps - not use the "from" syntax in the exception handler, and do a no-op in register_hook if on Python 2. > Also: have you though about providing a context manager which does > register_hook() in __enter__() and unregister_hook() in __exit__()? Of course, things like this can be added without too much trouble. Thanks for the feedback. Regards, Vinay Sajip
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