[Tutor] New programmer, need some help getting started on my first project

Kent Johnson kent37 at tds.net
Wed May 17 11:48:23 CEST 2006


Chris Delgado wrote:
> Hello all,
> 
> I have been studying python tutorials and have a couple beginning python 
> books that I have worked through. I have a very specific project in mind 
> and I want to ask a couple questions. The project in question is this:
> 
> I am making a Hand History converter for online poker players. This 
> takes the textual record of how a hand played and turns into a more 
> readable format suitable for posting at various websites where people 
> discuss how the hand was played. Id like to start with the converter 
> working for one particular online poker site (every site formats their 
> hand histories somewhat differently) and expand it so that it can 
> recognize the site a hand history came from and format accordingly.

I would pick one input format and work on a program that reads it and 
generates some kind of events for everything significant that happens. 
At first the events could be just print statements, later they can 
reformat the data to the required output format.

 From your description it sounds like there is no need to create an 
internal data format that holds all the data for a hand. A simple loop 
to read an event, parse the event and output it in the new format might 
be enough. It would help a lot to see some sample data.

For a project of this (small) scale I don't do much design ahead of 
time, I let the design emerge from the code as I solve the problem. I 
would start by writing the simplest program that could possibly work to 
convert a single format. When that is working then look at what is 
needed to add a format. This will probably involve some refactoring, 
introducing functions or classes that are specific to your problems. 
When you have two or three formats working you should have a tool set 
that will make subsequent formats easier.

If the data format is complex a parsing library like pyparsing might be 
helpful. But without seeing some data and trying to parse it there is no 
way to know.

Kent



More information about the Tutor mailing list