What I was trying to say is that the easiest to "code and understand" way is also likely to be the fastest way. And I was encouraging that. It really doesn't matter how good/bad the detailed implementation of abs() is, the time to execute the worst imaginable implementation is likely faster than making decisions about default behavior in light of an exception (the '-') and also suppressing normal exception behavior. I also suspect that either choice is completely dwarfed by the by the split operation and creation of the list of individual numbers.
I don't think any benchmarking or further optimization is warranted here. I vote for the easy to understand way. | [reply] |