[Tutor] Sample python file/module templates?

2009-05-31 Thread Allen Fowler
Hello, In terms of in-code documentation of function / section headers, change logs, etc. Are there well-done sample files I can use as inspiration? Thank you, :) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listi

Re: [Tutor] Challenge supporting custom deepcopy with inheritance

2009-05-31 Thread Kent Johnson
On Sun, May 31, 2009 at 5:35 PM, Michael H. Goldwasser wrote: > > Yesterday, I posted a question to python-list involving custom > deepcopies in an inheritance hierarchy.  I haven't received any > responses, so I thought I'd cross-post to see if anyone on tutor > has any thoughts. > > To avoid spl

[Tutor] Challenge supporting custom deepcopy with inheritance

2009-05-31 Thread Michael H . Goldwasser
Yesterday, I posted a question to python-list involving custom deepcopies in an inheritance hierarchy. I haven't received any responses, so I thought I'd cross-post to see if anyone on tutor has any thoughts. To avoid splitting the thread, I'll simply reference the original post at http://mail.p

Re: [Tutor] Class Tips

2009-05-31 Thread Alan Gauld
"David" wrote OK, this is what I came up with, how else could I do it so as not to use sys.exit() ? You don;t need the exit(), The program will just drop off the end silently without it. Thre are several other redundant bits you could just miss out: class FertRate: def __init__(self,

Re: [Tutor] Class Tips

2009-05-31 Thread David
W W wrote: One thing that's probably not in the scope of the program but really usually a good idea is error checking. i.e. this line: rate = float(raw_input("Enter rate i.e. (0.5) : ")) could be converted to something like: try: rate = float(raw_input("Enter rate...")) except ValueErr

Re: [Tutor] converting xls to csv

2009-05-31 Thread Richard Lovely
2009/5/31 Nick Burgess : > Got it. > > the row is not a string or buffer but the cell is.. > > for row in spamReader: >    for cell in row: >        if pattern.search(cell): >            print ', '.join(row) > > Alternatively, if you know that the string you want to search for only appears in a sin

Re: [Tutor] converting xls to csv

2009-05-31 Thread Nick Burgess
Got it. the row is not a string or buffer but the cell is.. for row in spamReader: for cell in row: if pattern.search(cell): print ', '.join(row) On Sun, May 31, 2009 at 5:09 AM, Nick Burgess wrote: > Thank you for your response and my apologies for the non-useful > out

Re: [Tutor] converting xls to csv

2009-05-31 Thread Nick Burgess
Thank you for your response and my apologies for the non-useful output. After searching again this task has been done by pyExcelerator, the tool xls2csv-gerry.py does this great. I am now trying to parse through the csv's and return the rows containing the matching strings. Python is looking for

Re: [Tutor] Class Tips

2009-05-31 Thread David
ALAN GAULD wrote: but I get an error here; def main(): frate = FertRate(get_inputs()) File "./fert_class.py", line 15, in main frate = FertRate(get_inputs()) TypeError: __init__() takes exactly 5 arguments (2 given) Sorry my mistake. Because get_inputs() returns a tuple you h

Re: [Tutor] converting xls to csv

2009-05-31 Thread Alan Gauld
"Nick Burgess" wrote I am trying to make this code work. I don't have any experience with defining things and this is my second program. The error returmed is "SyntaxError: invalid syntax" Please post the whole error message, much of the useful stufff - like the location of the problem!

Re: [Tutor] Why does it display traceback info here and not there?

2009-05-31 Thread Alan Gauld
"xbmuncher" wrote I'd like to use notepad++ to execute the scripts I edit, is there a way to solve this problem? Thats really a question for Notepad++ users! You might be able to use a shortcut to Notepad++ and change that Startup folder to be the one where your python scripts live? Beyond