[program-l] Python, any way to return values when using the cmd module without using Globals?

  • From: Al Puzzuoli <alpuzz@xxxxxxxxx>
  • To: Program L <program-l@xxxxxxxxxxxxx>
  • Date: Thu, 25 Oct 2012 22:14:04 -0400

First of all, many thanks to everyone who is helping me along my path by ansering countless questions on this list. I am resolving issues, learning a bit more every day. Of course, the more I learn, the more I realize I don't know. My latest issue yet again has to do with the cmd module. The problem is that I was hoping to use it to implement for example, a method called do_new (). Do_new would prompt for a ticker symbol, read the data into a Pandas DataFrame, and then return the DataFrame. However, cmd's methods apparently don't return values other than success or failure codes. I can make this work if I declare my DataFrame as a global variable but of course, I assume there must be a better way?

Thanks,

Al

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: