[rhythmbox: 1/2] Print command output's repr() instead of str()
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox: 1/2] Print command output's repr() instead of str()
- Date: Sun, 1 Sep 2019 05:31:48 +0000 (UTC)
commit 374479f451b3050cd885c5051eb4971646b18bbb
Author: Robbie Cooper <cooperra users noreply github com>
Date: Wed Oct 31 00:54:14 2018 -0400
Print command output's repr() instead of str()
This is how the original python console behaves. Using `repr` disambiguates output for certain types,
such as `str`.
Example before this commit: input is `str`, but output looks like `bool`:
```
>>> 'True'
True
```
Example after this commit:
```
>>> 'True'
'True'
```
plugins/pythonconsole/pythonconsole.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/plugins/pythonconsole/pythonconsole.py b/plugins/pythonconsole/pythonconsole.py
index 7d858bbc9..1be5f578f 100644
--- a/plugins/pythonconsole/pythonconsole.py
+++ b/plugins/pythonconsole/pythonconsole.py
@@ -393,7 +393,7 @@ class PythonConsole(Gtk.ScrolledWindow):
try:
r = eval(command, self.namespace, self.namespace)
if r is not None:
- print(r)
+ print(repr(r))
except SyntaxError:
exec(command, self.namespace)
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]