[Tutor] Is context manager the answer to synchronous function calls?

2015-09-16 Thread John Wong
Hi Here is the code: def create_vm(.): # returns vm object def modify_vm(.): return new vm object def get_vm_status(.): return status # Constraints: # I cannot modify vm until vm is finished, # I also cannot modify VM while the VM is being updated. # Obviously it looks u

Re: [Tutor] Debugging in Python

2015-11-17 Thread John Wong
On Mon, Nov 16, 2015 at 12:48 PM, Alan Gauld wrote: > > > The correct fix is to exit() from the python3 shell and start it again. >> > > He's tried that and didn't find it satisfactory. That's why > he wants a "better" workflow. > > Alternatively, add some main code at the end of your file and use

Re: [Tutor] Noob: nested if-clauses

2016-01-29 Thread John Wong
On Fri, Jan 29, 2016 at 3:13 PM, Alan Gauld wrote: > > When I first heard that python was white-space sensitive I > thought, oh no! But now I see it as a huge strength of the > language. Once you get used to it you will find it helps > far more than it hinders - just avoid tabs and/or map your >

Re: [Tutor] wiped file

2016-07-14 Thread John Wong
Alan made really good points, standard practice, however, on Linux and MacOSX, usually if you use editors like VIM, a temporary file is always created. For Windows, I am not sure 100%. Check your editor, your editor may have saved a cache file but marked as hidden file. For example, Notepad++ has t

Re: [Tutor] Book recommendation

2016-08-01 Thread John Wong
On Sun, Jul 31, 2016 at 7:14 PM, D Wyatt wrote: > Hello. I've been a member of this group for a very long time and have > played with Python for years, but have never gotten past being a beginner > for various reasons. I just discovered a very good, free book, that is > answering many of the qu