Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A couple things here I don't understand:

> if iter(data) is data:

Wouldn't it be cheaper like `if type(data) is iter:`?

And why convert `data` to a list at all, to check for length 0, given that `_sum(data)` will return the count?



Perhaps it's cheaper to just get the conversion and length check out of the way rather than have to execute _sum and find out from checking T.


But the path where the cost of _sum is extra is the error path; plus that'll end up being 0 iterations anyway.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: