diff options
author | Christophe Vu-Brugier <cvubrugier@yahoo.fr> | 2013-10-18 22:44:33 +0200 |
---|---|---|
committer | Christophe Vu-Brugier <cvubrugier@yahoo.fr> | 2013-10-18 22:44:33 +0200 |
commit | 9fdde09ed8ec0e31a3e4577daedb6bdd9f781d51 (patch) | |
tree | 1e42a216c03ee8e0d0a7cc805c6c1e1a7a5ee967 | |
parent | 9a2f993add2c7cc8f1ecc3d3aea06486a8d5d233 (diff) | |
download | configshell-fb-9fdde09ed8ec0e31a3e4577daedb6bdd9f781d51.tar.gz |
Fix an integer division on Python 3
With Python 2, '/' returns the floor of the mathematical result of
division if the arguments are ints. With Python 3, the operator
returns a reasonable approximation of the mathematical result of the
division.
This commit uses '//', which is the floor division operator in both
Python 2 and Python 3, so that the result can be safely used to index
an array.
For more details, see PEP 238 "changing the division operator"
http://www.python.org/dev/peps/pep-0238
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
-rw-r--r-- | configshell/shell.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/configshell/shell.py b/configshell/shell.py index 054c7ca..4349f50 100644 --- a/configshell/shell.py +++ b/configshell/shell.py @@ -742,7 +742,7 @@ class ConfigShell(object): prompt_length = self.prefs['prompt_length'] if prompt_length and prompt_length < len(prompt_path): - half = (prompt_length-3)/2 + half = (prompt_length - 3) // 2 prompt_path = "%s...%s" \ % (prompt_path[:half], prompt_path[-half:]) |