Code works fine except...

John Yeung gallium.arsenide at
Tue May 5 01:12:03 EDT 2009

On May 4, 11:01 pm, Ross <ross.j... at> wrote:
> Anyways, I'm new to
> programming and this has been a good learning experience.

I'm glad that you've been trying, and seem to be sticking it out
despite sometimes getting negative feedback here.

> Next time around, I'll be sure to thoroughly comment
> my code before I ask for help on it.

The best documentation, especially for a language like Python, is
simply logical variable names and sensible conventions.  I bring this
up because I'm wary of the word "thoroughly".  When you're dealing
with experts, it's actually best to use inline comments sparingly;
they can figure out what code does.  The overall problem description
at the top is important, as well as explanation of "magic numbers" and

> I really appreciate all the help that you've offered so far.

You're welcome.  I'm not sure how much I've helped, especially as I'm
frankly not one of the stronger programmers here.

> Right now, I'm debating whether I should try to reinvent
> the round_robin generator part of the code or whether
> there still might be a way to shuffle the results of the
> generated output so that I can slice it effectively.

If you are going to typically have roughly enough courts for your
players (as implied by your test data), then maybe there's still a
chance for using extended slicing.  Just make sure you don't always
pick the first element.  If the number of players and the number of
courts can vary wildly, and won't always match up at least sort of
nicely, then the problem may require bigger guns (either much better
math or much more sophisticated programming).


More information about the Python-list mailing list