Re: [Tutor] func-question_y_n.py

2013-03-16 Thread Christopher Emery
Hello All, OS = Raspbain Wheezy & Ubuntu 12.10 (both updated daily) Python Version = 3.2 & 3.3 Python Understanding = Beginner (very basic - just started) Code does not give any errors. Okay here is my code for func-question_P_N() it has three args to pass though the function "question", "Positi

Re: [Tutor] func-question_y_n.py

2013-03-16 Thread Christopher Emery
Hello Alan and Mark, Thank you, I didn't realize that it was not needed, I had seen some other code on the net that showed it with, however its like the if or for statement they don't need () thank you. Thanks Alan for your tip, once I had my code working in the best way I was going to add the .l

Re: [Tutor] Fixing Globals

2013-03-16 Thread Alan Gauld
On 16/03/13 19:04, ke...@kendy.org wrote: Global constants and variables are bad. Really? Do you know why? If you understand why then the measures to avoid them become more palatable - the lesser of 2 evils. Read-only globals are much less of a problem than read/write ones. And in Python we l

Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
On Sat, Mar 16, 2013 at 2:53 PM, Peter Otten <__pete...@web.de> wrote: > Abhishek Pratap wrote: > >> I am trying to use itertools.izip_longest to read a large file in >> chunks based on the examples I was able to find on the web. However I >> am not able to understand the behaviour of the following

Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Peter Otten
Abhishek Pratap wrote: > I am trying to use itertools.izip_longest to read a large file in > chunks based on the examples I was able to find on the web. However I > am not able to understand the behaviour of the following python code. > (contrived form of example) > > > > for x in itertools.izi

Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
On Sat, Mar 16, 2013 at 2:32 PM, Oscar Benjamin wrote: > On 16 March 2013 21:14, Abhishek Pratap wrote: >> Hey Guys >> >> I am trying to use itertools.izip_longest to read a large file in >> chunks based on the examples I was able to find on the web. However I >> am not able to understand the beh

Re: [Tutor] help with itertools.izip_longest

2013-03-16 Thread Oscar Benjamin
On 16 March 2013 21:14, Abhishek Pratap wrote: > Hey Guys > > I am trying to use itertools.izip_longest to read a large file in > chunks based on the examples I was able to find on the web. However I > am not able to understand the behaviour of the following python code. > (contrived form of examp

[Tutor] help with itertools.izip_longest

2013-03-16 Thread Abhishek Pratap
Hey Guys I am trying to use itertools.izip_longest to read a large file in chunks based on the examples I was able to find on the web. However I am not able to understand the behaviour of the following python code. (contrived form of example) for x in itertools.izip_longest(*[iter([1,2,3])]*2)

Re: [Tutor] Fixing Globals

2013-03-16 Thread kendy
Wow! Quick response. I'll study the responses. THANK YOU! Ken ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fixing Globals

2013-03-16 Thread Mitya Sirenef
On 03/16/2013 03:04 PM, ke...@kendy.org wrote: START = '<' > END = '>' > > def getargs(): > getops() > if > in_filename_1 = > in_filename_2 = > out_filename_1 = > out_filename_2 = > flag1 = > verbose = > > def this(): > open_for_read() > stuff() > > def open_for_read(filename): > in_filehandle =

Re: [Tutor] Fixing Globals

2013-03-16 Thread Dave Angel
On 03/16/2013 03:04 PM, ke...@kendy.org wrote: Dear Tutor Global constants and variables are bad. First, let me define my own "rule." Global constants should be all uppercase, and global variables should be avoided. Trivial and buggy scripts may ignore both rules. A trivial script is typic

Re: [Tutor] Fixing Globals

2013-03-16 Thread Kwpolska
On Sat, Mar 16, 2013 at 8:04 PM, wrote: > Dear Tutor > > Global constants and variables are bad. But what's better? I've heard some > suggestions, but haven't seen much actual code showing how to improve > globals. I > don't like: > > * Passing a lot of individual arguments. > * Creating a struc

[Tutor] Fixing Globals

2013-03-16 Thread kendy
Dear Tutor Global constants and variables are bad. But what's better? I've heard some suggestions, but haven't seen much actual code showing how to improve globals. I don't like: * Passing a lot of individual arguments. * Creating a structure with unrelated elements. * Passing a structure, as an

Re: [Tutor] File-Fetcher (cmdline-parser)

2013-03-16 Thread Peter Otten
Christopher Emery wrote: > Hello Peter, > > Thank you this is much appreciated! It is much clear now. Thank you > > PO: Also, if you make it a habit to keep long option and dest in sync > (something you get for free if you only specify the option) you can > deduce the attribute name used in the

Re: [Tutor] Script to generate statements

2013-03-16 Thread Peter Otten
Charles Leviton wrote: > I was recently given this task. it's a very IBM mainframe specific task > so > I'm not sure how to find equivalent terms in another environment. I will > just use the mainframe terminology and hopefully y'all can figure out what > I mean. > > Given a list of DBRM member