-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Labels
triage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
I'm seeing an issue that apparently hasn't been reported yet. I have a fairly large dictionary in memory and when I want to get its length from the debug console it takes tens of seconds. Obviously, getting the repr of the dict takes that much time but I only want to get its length.
Code to reproduce:
from unittest import TestCase
from collections import defaultdict
import numpy as np
from types import SimpleNamespace
class MyTest(TestCase):
def test_large_defaultdict(self):
d = defaultdict(lambda: defaultdict(list))
for k in 'abcdef':
for l in 'ghijk':
for i in range(10000):
d[k][l].append(SimpleNamespace(
key = k,
cycle = np.arange(20),
value = np.zeros(20)
))
passSet breakpoint on pass and try to evaluate len(d) from the debug console after the breakpoint is hit. This warning is printed in the console:
pydevd warning: Computing repr of d (defaultdict) was slow (took 42.36s)
Customize report timeout by setting the `PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT` environment variable to a higher timeout (default is: 0.5s)
Yes, it is slow but why is repr called to print the number of items?
Metadata
Metadata
Assignees
Labels
triage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team