+ 1

please how can I write a list that contains numbers (-infinity to infinity) in python language.

eg: list= [-infinity, infinity]

28th Jan 2021, 6:02 PM
JICK JASON Wainfein
JICK JASON Wainfein - avatar
6 Réponses
+ 5
import math x = [-math.inf, math.inf]
28th Jan 2021, 8:56 PM
Lisa
Lisa - avatar
+ 3
you cannot make a list with infinitive items inside... but you could make a generator wich will yield items infinitively, since you define absolute start and step...
28th Jan 2021, 7:38 PM
visph
visph - avatar
+ 2
There is no general maximum array size in numpy. In your case, arange uses int64 bits, which means it is 16 times more, or around 43 GB. a 32 bits process can only access around 4 GB of memory
28th Jan 2021, 8:35 PM
Adamyan
Adamyan - avatar
+ 2
The program will run out of resources if it was possible.
28th Jan 2021, 10:07 PM
Sonic
Sonic - avatar
+ 1
Hmmmm okay
28th Jan 2021, 6:54 PM
JICK JASON Wainfein
JICK JASON Wainfein - avatar
+ 1
You simply cant, try ring buffer instead, It will give that feel :)
28th Jan 2021, 7:44 PM
Emre İRİŞ
Emre İRİŞ - avatar