[Tutor] Long post: Request comments on starting code and test code on chess rating project.

Alan Gauld alan.gauld at yahoo.co.uk
Tue Aug 15 13:29:38 EDT 2017


On 15/08/17 15:09, Neil Cerutti wrote:

>> There are a variety of reports that I would like to be able to
>> print to screen or paper.  Things such as a "Top x List" of
>> rated players, full rating list sorted from highest rating to
>> lowest, rating lists for the current school year only or a
>> particular past school year, and so.  ...

> You really can do it, but to me this requirement argues for going
> back to a database backend. Why rewrite SQL?

I agree with Neil, this is exactly what SQL is good for and
would make this part of the project much easier and would have
the added benefit of introducing you to one of the trickiest,
but most common, bits of OOP - object persistence...

You might even find yourself writing some class methods! ;-)

And using SQLite, (even using in-memory mode if you don't
want to keep a database file) is about as easy as SQL gets.

If you do want to do it by hand consider using the itertools
module. (eg. its filterfalse(), dropwhile()/takewhile()
combinations() and groupby() functions.)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list