Re: [Tutor] Python 3.6.5 for MAC
On 24/04/18 03:34, Kentaro Hori wrote: > Hi > > can you take a screenshot after rebooting and trying one aging? Although you will need to post a link to the image since the list server will not send binary attachments. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Python Debugger shortcut to go to the last frame
Hi Please consider the following script: #!/usr/bin/env python3.6 #pdb_last_frame.py import pdb def recursive_function(n=5, output='default print'): if n > 0: recursive_function(n - 1) else: pdb.set_trace() print(output) return if __name__ == '__main__': recursive_function("space ham") For instance we run it as python3.6 -m pdb pdb_last_frame.py The following command sequence applied once the script stopped on bp: u u The question is there any command to go directly to the last frame instead of typing d d ? Thank you in advance. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] threading for each line in a large file, and doing it right
Greetings! Please consider this situation : Each line in "massive_input.txt" need to be churned by the "time_intensive_stuff" function, so I am trying to background it. import threading def time_intensive_stuff(arg): # some code, some_conditional return (some_conditional) with open("massive_input.txt") as fobj: for i in fobj: thread_thingy = thread.Threading(target=time_intensive_stuff, args=(i,) ) thread_thingy.start() With above code, it still does not feel like it is backgrounding at scale, I am sure there is a better pythonic way. How do I achieve something like this bash snippet below in python: time_intensive_stuff_in_bash(){ # some code : } for i in $(< massive_input.file); do time_intensive_stuff_in_bash i & disown : done Many thanks in advance, Thanks! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] threading for each line in a large file, and doing it right
> Please consider this situation : > Each line in "massive_input.txt" need to be churned by the > "time_intensive_stuff" function, so I am trying to background it. > > import threading > > def time_intensive_stuff(arg): ># some code, some_conditional >return (some_conditional) > > with open("massive_input.txt") as fobj: >for i in fobj: > thread_thingy = thread.Threading(target=time_intensive_stuff, args=(i,) > ) > thread_thingy.start() > > > With above code, it still does not feel like it is backgrounding at > scale, I am sure there is a better pythonic way. You might be looking for the multiprocessing library: https://docs.python.org/3.6/library/multiprocessing.html. Can you say more about the nature of the "time_intensive_stuff" part though? More context may help. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor