Re: [Tutor] Feedback on coding style

2010-12-09 Thread Albert-Jan Roskam
Hi, Re: coding style, I can *really* recommend the book 'Code Complete' (http://cc2e.com/). It doesn't focus on Python specifically, but it's a wonderful book. You can find a pdf checklist of the book if you Google a bit.  Cheers!! Albert-Jan ~~

Re: [Tutor] role playing game - help needed

2010-12-09 Thread ALAN GAULD
Can you explain this in a little more detail? > > sure. > >for name in attributes.keys(): > attributes[name] = int( input("How many points do you want to assign to %s " > % >name) ) > >Where did you get 'name' from? > I made it up. The for loop takes the form for in : where the

Re: [Tutor] Feedback on coding style

2010-12-09 Thread Alan Gauld
"Albert-Jan Roskam" wrote Re: coding style, I can *really* recommend the book 'Code Complete' (http://cc2e.com/). It doesn't focus on Python specifically, but it's a wonderful book. I'll second that. I haven't read the 2nd Ed but the first edition was one of the few (5 or 6?) books I've re

Re: [Tutor] Feedback on coding style

2010-12-09 Thread howit...@archlinux.us
Thanks a lot for the very friendly and constructive comments. I can't wait to start overhauling the script with the comments received here. If I could repay the friendliness to anyone, let me know. Adrian ___ Tutor maillist - Tutor@python.org To unsub

Re: [Tutor] Save file in a specific directory

2010-12-09 Thread Susana Iraiis Delgado Rodriguez
Thank you Jerry! The suggestion you told me make my code worked! > > > > dbf = Dbf(d,new=False, readOnly=True) > > > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] updating databases with null values

2010-12-09 Thread Rance Hall
I have a set of questions that ask about a customers name, address, email, etc. some of these values are allowed to be null, and others aren't. Some are required to have specific formats when they aren't null. I'm happy with the code Ive written and its question asking routine, but I need help u

Re: [Tutor] updating databases with null values

2010-12-09 Thread bob gailer
On 12/9/2010 11:46 AM, Rance Hall wrote: I have a set of questions that ask about a customers name, address, email, etc. some of these values are allowed to be null, and others aren't. Some are required to have specific formats when they aren't null. I'm happy with the code Ive written and its

[Tutor] Calling Program within Program

2010-12-09 Thread patty
Hello: I would like to know how to call a program from within a program and what directory I should place one small program file in. I am running Python 2.6.6 and Windows 7. I have a directory called C:\Users\StarShip\PyProgs and it has the files BreakersCafe.txt and BreakersCafe.py. This is

[Tutor] Increment by string, Array

2010-12-09 Thread lmhosie
Hello, I have a large code that I am using for ARC GIS I know could be much smaller but it works like it is. I have programmed in C++ but am just beginning with python I believe the answer would be to do a parallel array however I am having trouble keeping the SQL statment in the string format

Re: [Tutor] Increment by string, Array

2010-12-09 Thread Joel Goldstick
Can you use something like this: for i in range(1,201): s = str(i) Then Path = '1' can become Path = s On Thu, Dec 9, 2010 at 2:39 PM, wrote: > Hello, > I have a large code that I am using for ARC GIS I know could be much > smaller but it works like it is. I have programmed in C++ but am

[Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Alex Hall
Hi all, I am reading the source of a project I hope to help with (http://www.qwitter-client.net). I sometimes see something like: val=val or 1 I am guessing that val is an int. If val==0, the 'or' kicks in and val=1, else the or is not needed and val=val. Am I close? Can other words or symbols be u

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Adam Bark
On 10/12/10 00:51, Alex Hall wrote: Hi all, I am reading the source of a project I hope to help with (http://www.qwitter-client.net). I sometimes see something like: val=val or 1 I am guessing that val is an int. If val==0, the 'or' kicks in and val=1, else the or is not needed and val=val. Am I

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Alan Gauld
"Alex Hall" wrote val=val or 1 I am guessing that val is an int. If val==0, the 'or' kicks in and val=1, else the or is not needed and val=val. Am I close? Yes this is a combination of what is known as short circuit evaluation of boolean expressions and a quirk of Python that returns

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Alex Hall
Thanks to all for the quick responses. Python always surprises me with its shortcuts... On 12/9/10, Alan Gauld wrote: > > "Alex Hall" wrote > >> val=val or 1 > >> I am guessing that val is an int. If val==0, the 'or' kicks in and >> val=1, else the or is not needed and val=val. Am I close? > > Y

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Hugo Arts
On Fri, Dec 10, 2010 at 2:07 AM, Alan Gauld wrote: > > "Alex Hall" wrote >> >> val=val or 1 > >> I am guessing that val is an int. If val==0, the 'or' kicks in and >> val=1, else the or is not needed and val=val. Am I close? > > Yes this is a combination of what is known as short circuit evaluati

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Steven D'Aprano
Hugo Arts wrote: Doesn't short-circuit evaluation refer specifically to the behavior where arguments are only evaluated if they need to be? It's a very useful feature, but not technically required for the "val = val or 1" behavior to work. Yes, exactly. Some languages (Pascal comes to mind) d

Re: [Tutor] Calling Program within Program

2010-12-09 Thread Modulok
Patty, I didn't read through your code, but to call an external program see the 'subprocess' module in the standard library: http://docs.python.org/library/subprocess.html -Modulok- On 12/9/10, pa...@cruzio.com wrote: > > Hello: > > I would like to know how to call a program from within a prog