
Bruce Leban wrote:
None of these answers address the original suggestion. Matt didn't say that he only wanted this for numbers of the form 10^N; he just gave that as an example.
Consider these examples instead:
* 1_234_000 * 9.876_543_210 * 0xFEFF_0042
I'm not advocating this change (nor against it); I just think the discussion should be focused on the actual idea. I do have a question:
Is _ just ignored in numbers or are there more complex rules?
* 1_2345_6789 (can I use groups of other sizes instead?) * 1_2_3_4_5 (ditto) * 1_234_6789 (do all the groups need to be the same size?) * 1_ (must the _ only be in between 2 digits?) * 1__234 (what about multiple _s?) * 9.876_543_210 (can it be used to the right of the decimal point?) * 0xFEFF_0042 (can it be used in hex, octal or binary numbers?) * int('123_456') (do other functions accept this syntax too?)
I would say it's ignored. Have the rule be something like number_string.replace('_',''). The only wrinkle is that currently '_1' is usable name, and that should probably be disallowed if the above change took place. I'm +1 on the idea. ~Ethan~