Make it possible to convert sciform
output strings back into SciNum
objects.
#104
Labels
sciform
output strings back into SciNum
objects.
#104
This is an idea to make a parser that is used by the
SciNum
object which convertssciform
output strings back intoSciNum
objects. There is a such a diversity ofsciform
outputs it is not obvious if this is possible. The parser would need to determine if it is looking at a number or number/uncertainty pair. The parser would also need to determine what type of exponent is being used, including standard or custom possible SI/IEC or parts per conversions. Then it would need to extract the exponent and the mantissa(s) and construct theSciNum
object. It would also need to parse different user-selected separators. All of these means the parser should be dependent on format options. Perhaps if the parser was constrained to depend on both an input string and format options the problem would be more tractable. I.e. it will only look for superscript formatted exponents if the corresponding format options supplied hassuperscript=True
. Perhaps the parsing could be applied from the scope of aFormatter
rather thanSciNum
.It would be nice if this operation round tripped
str
->SciNum
->str
under the global options. It is impossible for it to round tripSciNum
->str
->SciNum
because theSciNum
->str
conversion (involving aFormatter
) in general rounds the number.The text was updated successfully, but these errors were encountered: