[New-bugs-announce] [issue36705] Unexpected Behaviour of pprint.pprint

Gavin D'souza report at bugs.python.org
Tue Apr 23 08:47:49 EDT 2019


New submission from Gavin D'souza <gavin18d at gmail.com>:

For a simple string input, pprint would be expected to return an output similar to print. However, the functionality differs

### Code:
import time
from pprint import pprint

start = time.time()
time.sleep(0.5)
object_made = time.time()
time.sleep(0.5)
done = time.time()
time.sleep(0.5)
shown = time.time()

pprint(
    f"Time to create object: {object_made - start}s\n" +
    f"Time to insert 100000 rows: {done - object_made}s\n" +
    f"Time to retrieve 100000 rows: {shown - done}s\n"
)

### Output Received:
('Time to create object: 0.5010814666748047s\n'
 'Time to insert 100000 rows: 0.5010972023010254s\n'
 'Time to retrieve 100000 rows: 0.501101016998291s\n')

### Expected Output:
Time to create object: 0.5010814666748047s
Time to insert 100000 rows: 0.5010972023010254s
Time to retrieve 100000 rows: 0.501101016998291s

----------
components: Library (Lib)
messages: 340720
nosy: Gavin D'souza, fdrake
priority: normal
severity: normal
status: open
title: Unexpected Behaviour of pprint.pprint
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36705>
_______________________________________


More information about the New-bugs-announce mailing list