[Tutor] Another set question

Phil phil_lor at bigpond.com
Mon May 1 00:55:56 EDT 2017


On Sun, 30 Apr 2017 15:58:13 +0100
Alan Gauld via Tutor <tutor at python.org> wrote:

> I would probably combine both such that for each cell you
> have a tuple containing the given number and the set of
> candidates. In some cases the number may be a sentinel
> (such as -1) to indicate no number yet, and for some
> cells the set will be empty.
> 
> But by always having both available your data handling
> becomes consistent, you always know that you get a tuple
> and you know can easily test the sentinel to see3 if
> the value is set or not. And you never need to
> test types.


Thank you again Alan,

During the intervening period between when my question appeared on the mailing list, plus our time zone difference, I had come to almost the same conclusion. All numbers are now sets, the likely candidates and the given numbers. No more fooling around with different types, they're all sets. I now have a working solution.

Many of the methods have very similar code to each other and I'm currently working on making the code simpler and less confusing. After that I'll give programming a rest for awhile.

-- 
Regards,
Phil


More information about the Tutor mailing list