yunruse / Noether

Just another units package
MIT License
9 stars 0 forks source link

REPL that handles e.g. `5m + 2in` #3

Closed yunruse closed 11 months ago

yunruse commented 1 year ago

This will require some slightly complex stuff to extend Python's syntax (or make a really comprehensive regex). Either way lies headaches!

yunruse commented 1 year ago

readline is a useful builtin module to check out

yunruse commented 1 year ago

One hack might involve codecs shenanigans.

The transformation is not complex – any [a-z][a-z_]+ after a unit should (in theory), capture, so long as we make sure that current syntax (eg 1e3) is not transformed.

yunruse commented 11 months ago

Implemented with tokenize in 01e89f77b71b57bac09cdfc9f4d8b5fcd55e9f0e