3 ms·
so you'd expect this behavior? sum("abc") = sum(ord(c) for c in "abc") = sum([97, 98, 99]) = 294 because wow, i... can't think of why you'd ever actua
by uryga 6y ago
so you'd expect this behavior?
sum("abc") =
sum(ord(c) for c in "abc") =
sum([97, 98, 99]) =
294
because wow, i... can't think of why you'd ever actually want that. (though it'd be perfectly natural for byte arrays)
- stouset 6y agoByte arrays sure. Not strings. This is why having clear types is important! Strings aren't just byte arrays. Characters aren't just bytes.