##// END OF EJS Templates
Simplify IPython.utils.NLPrinter
Thomas Kluyver -
Show More
@@ -17,8 +17,6 b' from __future__ import print_function'
17 import sys
17 import sys
18 import tempfile
18 import tempfile
19
19
20 from IPython.external.Itpl import itpl, printpl
21
22 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
23 # Code
21 # Code
24 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
@@ -268,12 +266,13 b' class NLprinter:'
268
266
269 for idx in range(start,stop):
267 for idx in range(start,stop):
270 elem = lst[idx]
268 elem = lst[idx]
269 newpos = pos + str(idx)
271 if type(elem)==type([]):
270 if type(elem)==type([]):
272 self.depth += 1
271 self.depth += 1
273 self.__call__(elem,itpl('$pos$idx,'),**kw)
272 self.__call__(elem, newpos+",", **kw)
274 self.depth -= 1
273 self.depth -= 1
275 else:
274 else:
276 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
275 print(kw['indent']*self.depth + newpos + kw["sep"] + repr(elem))
277
276
278 nlprint = NLprinter()
277 nlprint = NLprinter()
279
278
General Comments 0
You need to be logged in to leave comments. Login now