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

Skip to content

Commit 424d0f2

Browse files
committed
Fixed calls to if_(), adding lambda where needed.
1 parent 3fb5563 commit 424d0f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def printf(format, *args):
554554
"""Format args with the first argument as format string, and write.
555555
Return the last arg, or format itself if there are no args."""
556556
sys.stdout.write(str(format) % args)
557-
return if_(args, args[-1], format)
557+
return if_(args, lambda: args[-1], lambda: format)
558558

559559
def caller(n=1):
560560
"""Return the name of the calling function n levels up in the frame stack.
@@ -626,7 +626,7 @@ def print_table(table, header=None, sep=' ', numfmt='%g'):
626626
justs = [if_(isnumber(x), 'rjust', 'ljust') for x in table[0]]
627627
if header:
628628
table = [header] + table
629-
table = [[if_(isnumber(x), lambda: numfmt % x, x) for x in row]
629+
table = [[if_(isnumber(x), lambda: numfmt % x, lambda: x) for x in row]
630630
for row in table]
631631
maxlen = lambda seq: max(map(len, seq))
632632
sizes = map(maxlen, zip(*[map(str, row) for row in table]))

0 commit comments

Comments
 (0)