Re: [Tutor] urllib

2009-12-07 Thread Senthil Kumaran
On Mon, Dec 07, 2009 at 08:38:24AM +0100, Jojo Mwebaze wrote: > I need help on something very small... > > i am using urllib to write a query and what i want returned is 'FHI=128%2C128& > FLO=1%2C1' > The way to use urllib.encode is like this: >>> urllib.urlencode({"key":"value"}) 'key=value' >

Re: [Tutor] urllib

2009-12-07 Thread Jojo Mwebaze
thanks, Senthil On Mon, Dec 7, 2009 at 11:10 AM, Senthil Kumaran wrote: > On Mon, Dec 07, 2009 at 08:38:24AM +0100, Jojo Mwebaze wrote: > > I need help on something very small... > > > > i am using urllib to write a query and what i want returned is > 'FHI=128%2C128& > > FLO=1%2C1' > > > > The wa

[Tutor] mod_python authentication

2009-12-07 Thread Rayon
How do I Check for an active login session on every page that requires authentication Been at this for days and it's holding me back can someone plz help me with some code examples. ___ Tutor maillist - Tutor@python.org To unsubscribe or change s

[Tutor] Question : Creating cribbage game

2009-12-07 Thread Christopher schueler
My name is Chris Schueler and i am having some troubles with my Python programming Our current project is to create the game of cribbage from scratch. The only problem is we are not allowed to use classes, only user-defind functions and arrays. I was wondering if anybody could give me tips

Re: [Tutor] mod_python authentication

2009-12-07 Thread Alan Plum
On Mo, 2009-12-07 at 09:35 -0400, Rayon wrote: > How do I Check for an active login session on every page that requires > authentication > > Been at this for days and it’s holding me back can someone plz help > me with some code examples. To understand sessions you first need to understand that

Re: [Tutor] mod_python authentication

2009-12-07 Thread aivars
Alan, I am very impressed! This one goes to my knowledge base. Thanks a lot. 2009/12/7 Alan Plum : > On Mo, 2009-12-07 at 09:35 -0400, Rayon wrote: >> How do I Check for an active login session on every page that requires >> authentication >> >> Been at this for days and it’s holding me back can s

Re: [Tutor] Question : Creating cribbage game

2009-12-07 Thread Tim Goddard
> Message: 2 > Date: Mon, 7 Dec 2009 02:30:30 -0400 > From: Christopher schueler > To: > Subject: [Tutor] Question : Creating cribbage game > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > > My name is Chris Schueler and i am having some troubles with my Python > programming >

Re: [Tutor] Question : Creating cribbage game

2009-12-07 Thread spir
Christopher schueler dixit: > > My name is Chris Schueler and i am having some troubles with my Python > programming > > > > Our current project is to create the game of cribbage from scratch. > > The only problem is we are not allowed to use classes, only user-defind > functions and arra

[Tutor] loops

2009-12-07 Thread Richard Hultgren
a = 0 b = 1 count = 0 max_count = 20 while count < max_count:     count = count + 1     # we need to keep track of a since we change it     old_a = a# especially here     old_b = b     a = old_b     b = old_a + old_b     # Notice that the , at the end of a print statement keeps it  

Re: [Tutor] loops

2009-12-07 Thread Kent Johnson
Is there a question here? Please skip the giant type size. Kent On Mon, Dec 7, 2009 at 2:53 PM, Richard Hultgren wrote: > a = 0 > b = 1 > count = 0 > max_count = 20 > while count < max_count: >     count = count + 1 >     # we need to keep track of a since we change it >     old_a = a   

[Tutor] functions--how long is too long?

2009-12-07 Thread Che M
I have some functions that seem kind of long to me. One of them, with white space, comments, print statements, and some commented-out lines, is 118 lines long. If I remove all that, it is 57 lines long. I get the sense that is inappropriately long for a Python function. The length of it is d

Re: [Tutor] functions--how long is too long?

2009-12-07 Thread Luke Paireepinart
If your code is not sensitive information, it might help us if you post it to pastebin or something so we can take a look. In general though, functions should be as long as they need to be (and no longer!). 57 lines is not inordinately long. If it's hard for you to read, though, you should refact

Re: [Tutor] functions--how long is too long?

2009-12-07 Thread Kent Johnson
On Mon, Dec 7, 2009 at 8:37 PM, Che M wrote: > I have some functions that seem kind of long to me.  One of them, with > white space, comments, print statements, and some commented-out lines, > is 118 lines long.  If I remove all that, it is 57 lines long.  I get the > sense > that is inappropriate

Re: [Tutor] mod_python authentication

2009-12-07 Thread Marc
> On Mo, 2009-12-07 at 09:35 -0400, Rayon wrote: > > How do I Check for an active login session on every page that > requires > > authentication > > > To understand sessions you first need to understand that HTTP is a > stateless protocol: you connect, send your request, receive a response > and th