Christian Heimes <[email protected]> added the comment:
You are using a list comprehension that consumes a LOT of memory very fast. The
line requires more physical RAM than available on a typical user system. This
causes your computer to become unresponsive to input.
You can rewrite tie list comprehension as generator expression:
sum(i for i in range(10**8 + 10**9))
It will consume far less memory, but it's slow and inefficient. You could use
the triangular number algorithm instead:
n = 10**8 + 10**9
n * (n-1) // 2
----------
nosy: +christian.heimes
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43161>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com