From: "brightbits (Michael Baldry)" Date: 2021-12-16T09:07:34+00:00 Subject: [ruby-core:106710] [Ruby master Feature#18410] Proposal to make inspect include underscores on numerics Issue #18410 has been updated by brightbits (Michael Baldry). sawa (Tsuyoshi Sawada) wrote in #note-4: > In agreement with mame's comment, even if we can come to an agreement on the spec, I think it should be a property of pretty print rather than normal inspection. If there is need to make the numbers particularly readable to human, in such situations, pretty print should be used. To me, separating array or hash elements with space characters (i.e., what pretty print does) looks very similar to separating numerical digits with separators. > > Changing pretty print would probably have less impact than changing inspection, and also there might be room for locale/string format configuration. I think given the output of inspect is documented to be a human readable, it's not unreasonably to expect it to be so. I agree it would be nice for pretty print to do it but that doesn't have quite the same smooth experience of just getting nice readable numbers in IRB output by default. Saying that, is there a mechanism where IRB output gets formatted differently that isn't via inspect, something more localised to IRB? That may be a less far reaching change with the same end result ---------------------------------------- Feature #18410: Proposal to make inspect include underscores on numerics https://bugs.ruby-lang.org/issues/18410#change-95395 * Author: brightbits (Michael Baldry) * Status: Open * Priority: Normal ---------------------------------------- The documentation for inspect reads "Returns a string containing a human-readable representation of obj." but for large numerical values, while 964218442 is human-readable, 964_218_442 is a lot more readable. The language allows the use of underscores to make numbers more readable, so why should inspect not also honour this? Happy to provide a patch if this would be an acceptable change. -- https://bugs.ruby-lang.org/ Unsubscribe: