I am having a relatively large list of all primes below 10000 in my script. Browsing the script is almost impossible now, I suspect Pythonista's line-wrapping as a possible cause of this. Is there any way to switch off line-wrapping in the editor?
Forum Archive
Turn off line-wrapping
jugisto135
Mar 03, 2013 - 17:37
omz
Mar 03, 2013 - 16:54
You can't turn off line-wrapping. I would recommend that you either generate the list of primes dynamically (takes about 1.5 seconds on an iPad mini, if you use a fast algorithm) and/or store the list in an external file that you then load in your script.
Here's an example of how you could do that:
https://gist.github.com/omz/5076605
The first time the script is run, it generates the prime numbers and stores them in a data file. Later, just that data file is read, using the marshal module (which is one of the fastest options for built-in types like a list).
jugisto135
Mar 03, 2013 - 17:37
Thanks, that's even better.