简体   繁体   中英

Python : Variable size problems with Pyscripter

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM