set ipython's default scientific notation threshold

前端 未结 2 1139
眼角桃花
眼角桃花 2021-01-04 11:25

How can I modify the point at which python decides to print in scientific notation?

E.g. I\'d like everything > 1e4 or < 1e-4 to be p

2条回答
  •  猫巷女王i
    2021-01-04 12:12

    Actually it has nothing to do with IPython as it simply calls __str__. Sadly, float, being a built-in type, is implemented in C and you can't monkeypatch C types. So your only options are modifying __str__ implementation in cpython or patching IPython to be smarter than just calling __str__.

提交回复
热议问题