From 6005fde964ba8abfe48160c36b224dadd2bdc741 Mon Sep 17 00:00:00 2001 From: Fred Wright Date: Sun, 10 Apr 2016 19:29:06 -0700 Subject: Fixes Python programs to use new-style classes. Although this isn't strictly a Python 3 requirement, using the new-style class definition syntax improves consistency between Python 2 and Python 3. Old-style classes have been deprecated since Python 2.2, but many such definitions linger on. Python 3 eliminates old-style classes, but instead of complaining about old-style definitions, it simply unconditionally and silently makes all classes new-style. The only incompatible differences are quite subtle and rarely matter in practice, but things are more consistent across versions if the new-style definitions are used. Also, the preferred method for subclasses to invoke parent init methods is via the super() construct, which is only available with new-style classes. Using super() is especially useful with multiple inheritance, which it handles automatically (provided that the init methods have compatible signatures). TESTED: Using an SConstruct patched to run the build helpers with the target Python, ran "scons build-all check ", as well as gpsprof and xgps, with all six supported Python versions (except 2.6 for xgps). --- gpsprof | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gpsprof') diff --git a/gpsprof b/gpsprof index 5c9c52d6..d0aad600 100755 --- a/gpsprof +++ b/gpsprof @@ -21,7 +21,7 @@ import sys import time -class Baton: +class Baton(object): "Ship progress indication to stderr." def __init__(self, prompt, endmsg=None): @@ -55,7 +55,7 @@ class Baton: return -class plotter: +class plotter(object): "Generic class for gathering and plotting sensor statistics." def __init__(self): -- cgit v1.2.1