From: Oleg Broytman Date: Tue, 19 Apr 2016 09:32:54 +0000 (+0300) Subject: init.py: minor refactoring: move displayhook X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=b0cebb6cdb495409e43550c82c68258c3269d179;p=dotfiles.git init.py: minor refactoring: move displayhook --- diff --git a/lib/python/init.py b/lib/python/init.py index 363a10a..642eb6c 100644 --- a/lib/python/init.py +++ b/lib/python/init.py @@ -114,17 +114,19 @@ def init(): try: locale.setlocale(locale.LC_ALL, '') - from pprint import pprint + except (ImportError, locale.Error): + pass # no locale support or unsupported locale - def displayhook(value): - if value is not None: - __builtin__._ = value - pprint(value) + # set displayhook - sys.displayhook = displayhook + from pprint import pprint - except (ImportError, locale.Error): - pass # no locale support or unsupported locale + def displayhook(value): + if value is not None: + __builtin__._ = value + pprint(value) + + sys.displayhook = displayhook # utilities