문제

I am using Pyscripter to script and execute Python codes. I have a scenario where I'm population a tuple in a loop. And, at the end of the program I have 10 such variables with 1 Million elements in each. Pyscripter hangs when I try to call any variable after this.

Any tips how to overcome this? Are there any limitations on the size of variables in workspace? I have sufficient space in my disk to support the data.

도움이 되었습니까?

해결책

If you are adding to a tuple in a loop, you might be better off starting with a list, then converting it to a tuple later:

mylist = []
for i in range(million):
    mylist.append(something)
mytup = tuple(mylist)

But if you're appending to something a million times, it's possible that your program just takes time to populate the tuple...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top