Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danny Yoo
Followup: compare the previous interpreter code with this revision: https://gist.github.com/dyoo/5415464 and you'll see how it becomes easier now to add new command types into the system. ___ Tutor maillist - Tutor@python.org To unsubscribe or cha

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danny Yoo
Ok, good. This is _much_ more realistic code, and demonstrates why seeing context is important. My suggestion to do it computationally is totally invalid here. :P There's a lot of variation here, due to the access paths through the JSON that you're walking. You're essentially defining a very l

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danilo Chilene
On Thu, Apr 18, 2013 at 2:52 PM, Alan Gauld wrote: > On 18/04/13 18:14, Danilo Chilene wrote: > > for command in commands: >> if arg in commands: >> print commands[command] >> else: >> print 'Invalid command' >> > > I don't understand what you are doing here? Its almos

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Alan Gauld
On 18/04/13 18:14, Danilo Chilene wrote: for command in commands: if arg in commands: print commands[command] else: print 'Invalid command' I don't understand what you are doing here? Its almost a random selection mechanism? You print the command for every item in

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 01:14 PM, Danilo Chilene wrote: The following code has little to do with anything that happened before. So you should start a new thread for this new project. Below is the final code: import requests, json, sys r = requests.get('http://napmongo01.cvc.com.br:28017/_sta

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danilo Chilene
On Thu, Apr 18, 2013 at 10:31 AM, Dave Angel wrote: > On 04/18/2013 09:21 AM, Danilo Chilene wrote: > >> On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: >> >> >>> -- Forwarded message -- >>> From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re:

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 09:21 AM, Danilo Chilene wrote: On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: -- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is ch

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danilo Chilene
On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: > > -- Forwarded message -- >> From: Danilo Chilene >> Date: Wed, Apr 17, 2013 at 2:17 PM >> Subject: Re: [Tutor] Sys.argv read parameters >> To: Danny Yoo >> >> >> Hello Danny, >> >> The part that is changing is just the sys.a

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-17 Thread Dave Angel
-- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is changing is just the sys.argv[1] The vars will have always the same content. What I don't want is to hav

[Tutor] Fwd: Sys.argv read parameters

2013-04-17 Thread Danny Yoo
Forwarding message to Python-tutor mailing list. I did not realize that your reply didn't show up for the rest of Python tutor. Please use Reply to All in the future. -- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv