Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5856e4

Browse files
authored
Fix wrong u-prefix for strings in magics docs. (#14161)
`%precision` doesn't output `u'%r'` on Python 3, but `'%r'`. (Note that the point of this PR is explicitly not to remove u-prefixes on all strings -- something that would likely be better done by automated tooling anyways -- but only on those occurring within some docstrings that end up in the rendered docs, which would more likely not have been found by tooling.)
2 parents 2286980 + 72cb62c commit f5856e4

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

IPython/core/magics/basic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def alias_magic(self, line=''):
122122
Created `%whereami` as an alias for `%pwd`.
123123
124124
In [6]: %whereami
125-
Out[6]: u'/home/testuser'
125+
Out[6]: '/home/testuser'
126126
127127
In [7]: %alias_magic h history "-p -l 30" --line
128128
Created `%h` as an alias for `%history -l 30`.
@@ -537,25 +537,25 @@ def precision(self, s=''):
537537
In [1]: from math import pi
538538
539539
In [2]: %precision 3
540-
Out[2]: u'%.3f'
540+
Out[2]: '%.3f'
541541
542542
In [3]: pi
543543
Out[3]: 3.142
544544
545545
In [4]: %precision %i
546-
Out[4]: u'%i'
546+
Out[4]: '%i'
547547
548548
In [5]: pi
549549
Out[5]: 3
550550
551551
In [6]: %precision %e
552-
Out[6]: u'%e'
552+
Out[6]: '%e'
553553
554554
In [7]: pi**10
555555
Out[7]: 9.364805e+04
556556
557557
In [8]: %precision
558-
Out[8]: u'%r'
558+
Out[8]: '%r'
559559
560560
In [9]: pi**10
561561
Out[9]: 93648.047476082982

0 commit comments

Comments
 (0)