On 2015-04-30, Dave Angel <da...@davea.name> wrote:
> On 04/30/2015 07:31 PM, Jon Ribbens wrote:
>> On 2015-04-30, Dave Angel <da...@davea.name> wrote:
>>> But the real reason I didn't like it was it produced a much larger
>>> set of happy_numbers, which could clog memory a lot sooner.  For
>>> 10**7 items, I had 3250 happy members, and 19630 unhappy.  And Jon
>>> had 1418854 happy members.
>>
>> Er, what? You're complaining that mine is less efficient by not
>> producing the wrong output?
>
> It's not intended as a criticism;  you solved a different problem.  The 
> problem Cecil was solving was to determine if a particular number is 
> happy.  The problem you solved was to make a list of all values under a 
> particular limit that are happy.
>
> Both produce identical results for the Cecil purpose, and yours is 
> faster if one wants all the values.  But if one wants a sampling of 
> values, his function will fetch them quickly, and even if you want them 
> all, his function will use much less memory.

I must admit, I'm still not understanding. If you want to know only
whether or not int(1e7) is happy then the calculation takes no
measurable time or memory.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to