From b0cebb6cdb495409e43550c82c68258c3269d179 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 19 Apr 2016 12:32:54 +0300 Subject: [PATCH] init.py: minor refactoring: move displayhook --- lib/python/init.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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 -- 2.39.5