Re: [Tutor] Dictionaries

2006-01-25 Thread Kent Johnson
Jon Moore wrote: > Hi > > Is there anyway to print informtation from dictionaries better than this?: > > >>> pairs = {"Jon Moore": "Tony Moore", > "Simon Nightingale": "John Nightingale", > "David Willett": "Bernard Willet", > "John Jackson": "Stuart Jackson", >

Re: [Tutor] strings & splitting

2006-01-25 Thread Kent Johnson
Liam Clarke wrote: > Hi, > > Thanks Kent, I'll check out the CSV module. I had a go with Pyparsing > awhile ago, and it's clocking in at the 3 minute mark also. > > Alan - the data is of the form - > > a = { > b = 1 > c = 2 > d = { e = { f = 4 g = "Ultimate Showdown of Ultimate Destiny" } h =

Re: [Tutor] Dictionaries

2006-01-25 Thread John Fouhy
On 26/01/06, Jon Moore <[EMAIL PROTECTED]> wrote: > Hi > > Is there anyway to print informtation from dictionaries better than this?: Well, you can print the value too if you want :-) eg: >>> pairs = {"Jon Moore": "Tony Moore", ... "Simon Nightingale": "John Nightingale", ... "

Re: [Tutor] mod_python and other web frameworks

2006-01-25 Thread Ben Vinger
--- Intercodes <[EMAIL PROTECTED]> wrote: > List: I am still open to suggestions. Being also keen to write better web apps in Python, I've spent a considerable amount of time reading about this (and it is indeed confusing), I've opted to try out something like Pylons or Turbogears. One thing I w

Re: [Tutor] mod_python and other web frameworks

2006-01-25 Thread Intercodes
Thanks for the input guys. I think ill go with Quixotemod_pythonpostgresXHTMLIll let you know if I have done something useful with the above four :DTYIntercodes >If you're looking to do some Python coding to put your site together,>you might take a gander at Quixote>(http://www.mems-exchange.org/so

[Tutor] Dictionaries

2006-01-25 Thread Jon Moore
Hi Is there anyway to print informtation from dictionaries better than this?:   >>> pairs = {"Jon Moore": "Tony Moore", "Simon Nightingale": "John Nightingale", "David Willett": "Bernard Willet", "John Jackson": "Stuart Jackson", "James Southey": "Richard Southey", 

Re: [Tutor] Controling my loops and redundant code?!?

2006-01-25 Thread Jon Moore
Alan   Many thanks, that is really useful.   I will go through this a bit at a time over the next few days to ensure I understand what I am doing!   I think functions come in the next chapter!   Jon  On 25/01/06, Alan Gauld <[EMAIL PROTECTED]> wrote: Hi Jon,> 1. I am sure I have written far more co

Re: [Tutor] mod_python and other web frameworks

2006-01-25 Thread Gabriel S Farrell
On Thu, Jan 26, 2006 at 02:07:43AM +0530, Intercodes wrote: > Lolo, > > Thanks for the boost up. I am looking at PSP now and it seems promising. 3 > days is impossible for me :) ...maybe a week or more. I will certainly have > a look at 'mighty' once I am familiar with mod_python. > > List: I am

Re: [Tutor] strings & splitting

2006-01-25 Thread Alan Gauld
Liam wrote: Alan - the data is of the form - a = { b = 1 c = 2 d = { e = { f = 4 g = "Ultimate Showdown of Ultimate Destiny" } h = { i j k } } } Everything is whitespace delimited. I'd like to turn it into ["a", "=", "{", "b", "=", "1", "c", "=", "2", "d", "=", "{",

Re: [Tutor] mod_python and other web frameworks

2006-01-25 Thread Intercodes
Liam, I checked the wiki video sometime back. If my memory wont fail me, the guy there never used a single line of python code ;) (I may be wrong) It seemed a totally new language that he used to create that wiki. Iam more inclined to code a lot rather than deal with such high abstraction, as I wou

Re: [Tutor] mod_python and other web frameworks

2006-01-25 Thread Liam Clarke
On 1/26/06, Intercodes <[EMAIL PROTECTED]> wrote: > Liam, > > I checked the wiki video sometime back. If my memory wont fail me, the guy > there never used a single line of python code ;) (I may be wrong) It seemed > a totally new language that he used to create that wiki. > > Iam more inclined to

Re: [Tutor] strings & splitting

2006-01-25 Thread Liam Clarke
Hi, Thanks Kent, I'll check out the CSV module. I had a go with Pyparsing awhile ago, and it's clocking in at the 3 minute mark also. Alan - the data is of the form - a = { b = 1 c = 2 d = { e = { f = 4 g = "Ultimate Showdown of Ultimate Destiny" } h = { i j k } } } Everything is whitespace d

Re: [Tutor] mod_python and other web frameworks

2006-01-25 Thread Intercodes
Lolo,Thanks for the boost up. I am looking at PSP now and it seems promising. 3 days is impossible for me :) ...maybe a week or more. I will certainly have a look at 'mighty' once I am familiar with mod_python. List: I am still open to suggestions.Thank You.Intercodes--

Re: [Tutor] mod_python and other web frameworks

2006-01-25 Thread Liam Clarke
Hi, I recommend checking out the Turbogears 20 minute Wiki tutorial, although I'd hold off using it until the 0.9 release comes out with some useful changes. When you use it, it sits behind mod_python and responds to requests made. You can see a Turbogears error message here - :D http://digitalso

[Tutor] mod_python and other web frameworks

2006-01-25 Thread Intercodes
Hello everyone,Disclaimer:  Beginner.I have an idea of coding a web application and decided to do it entirely with python (reddit style). I started looking for web programming in python and somehow I saw mod_python first. Iam perusing the help document now. Few minutes of browsing confused my mind

Re: [Tutor] Controling my loops and redundant code?!?

2006-01-25 Thread Alan Gauld
Hi Jon, > 1. I am sure I have written far more code than required. > Where could I have made some shorcuts? Probably but shortcuts are not necesasarily a good thing if they obscure readability... However one area that would clean it up a bit is if you were to use a dictionary rather than list

Re: [Tutor] strings & splitting

2006-01-25 Thread Alan Gauld
Hi Liam, I'm not sure I really understand what you are trying to get to here. Can you provide a short sample of before/after data so we can see what we are trying to achieve? Alan G - Original Message - From: "Liam Clarke" <[EMAIL PROTECTED]> To: "Python Tutor" Sent: Wednesday, Janu

[Tutor] Controling my loops and redundant code?!?

2006-01-25 Thread Jon Moore
Hi,I have written the program below as an exercise from a book I am working my way through.Objective from book:Write a character creator program for a role-playing-game. The player should be given a pool of 30 points to spend on four attributes: strength, health, wisdom and dexterity. The player sh

Re: [Tutor] strings & splitting

2006-01-25 Thread Kent Johnson
Liam Clarke wrote: > Hi all, > > I have a large string which I'm attempting to manipulate, which I find > very convenient to call > large_string.split(" ") on to conveniently tokenise. > > Except, however for the double quoted strings within my string, which > contain spaces. > > At the moment I

[Tutor] strings & splitting

2006-01-25 Thread Liam Clarke
Hi all, I have a large string which I'm attempting to manipulate, which I find very convenient to call large_string.split(" ") on to conveniently tokenise. Except, however for the double quoted strings within my string, which contain spaces. At the moment I'm doing a split by \n, and then loopin

Re: [Tutor] : unexpected behavior with assignment in __init__

2006-01-25 Thread Orri Ganel
Kent Johnson wrote: variable, it has no effect outside the method; inside a method, self is just a method parameter, nothing more. There is some magic that gives self its value for the call. When __init__() is called the new instance has already been created, you are just initializing it

Re: [Tutor] : unexpected behavior with assignment in __init__

2006-01-25 Thread Kent Johnson
Orri Ganel wrote: > Hello all, > I was just messing around with a suggestion w chun (wescpy at gmail > dot com) gave (to make a class that handles time, ie: > >> >> import myTime >> >> c = myTime.myTime(10,30) >> >> print c > 10:30 >> >> d = myTime.myTime(8,45) >> >> print c + d > 19:15 > >

Re: [Tutor] Why doesn't this work?

2006-01-25 Thread Brian van den Broek
Christopher Spears said unto the world upon 23/01/06 02:41 PM: > I copied this code from Learning Python while learning > about extending types by subclassing: > I'm pretty sure I copied this exactly from the book, > so I'm not sure what is not working. >