Closed
Description
The changes introduced in this PR: #236
Make it impossible to parse 'angstrom', since the built in function str
partially matches 'angstrom' and is therefore in
that string, see this code snippet from quantities/registry.py
/example that reproduces the issue:
import builtins
string = 'angstrom'
all_builtins = dir(builtins)
# because we have kilobytes, other bytes we have to remove bytes
all_builtins.remove("bytes")
# have to deal with octet as well
all_builtins.remove("oct")
# have to remove min which is short for minute
all_builtins.remove("min")
for builtin in all_builtins:
if builtin in string:
raise RuntimeError(f"String parsing error for `{string}`. Enter a string accepted by quantities")
Can in
be chnaged to ==
to avoid partial matches like this?
This is somewhat similar to the inability to parse min
mentioned here: #242
Metadata
Metadata
Assignees
Labels
No labels