Python How to make scientific notation the default in the Python interpreter?

Click For Summary
The discussion centers on the challenges of reading large numbers in Python, specifically the difficulty of interpreting figures like 695500000 and the impracticality of using scientific notation (%e). A suggestion is made to utilize Python's interactive mode, which operates as a REPL loop, allowing users to create a custom REPL loop for better control over output formatting. A link to a blog post about writing an interactive REPL in Python is provided, although there is a sentiment that modifying the interpreter's code might be a more complex solution than desired.
andresordonez
Messages
65
Reaction score
0
Hi, I'm tired of reading numbers like 695500000, and using %e all the time is not a practical solution.

Thanks.
 
Technology news on Phys.org
The Python "interactive mode" is just a REPL loop. You can write your own REPL loop in python pretty easily, and then you will have full control over how output is printed.

http://blog.hackthology.com/writing-an-interactive-repl-in-python
 
Last edited by a moderator:
Thanks, though I thought it could be easier than that. I guess I could modify somehow some code of the interpreter.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 11 ·
Replies
11
Views
946
  • · Replies 10 ·
Replies
10
Views
3K
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 25 ·
Replies
25
Views
6K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
55
Views
6K