Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve StrRepr for numeric patterns #23

Open
waveform80 opened this issue May 16, 2022 · 0 comments
Open

Improve StrRepr for numeric patterns #23

waveform80 opened this issue May 16, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@waveform80
Copy link
Owner

The pattern handling in StrRepr is a bit rubbish, dealing with trivial bases in int, and with no clue about floating-point representations. We should have the ability to derive a %-format from a cohort of strings (just as we do for DateTime) for the Int and Float classes.

The Int detection you already know how to do; Float can be figured out. The tricky bit will be handling __eq__ and __str__ for those patterns. The current base merging is easy enough, but handling 0-prefix and length padding may turn out to be non-trivial, e.g. it needs to know that '%08x' == '%10x' and that '%08x' + '%10x' == '%08x', that '%#x' != '%x', etc.

@waveform80 waveform80 self-assigned this May 16, 2022
@waveform80 waveform80 added the enhancement New feature or request label May 16, 2022
@waveform80 waveform80 added this to the 1.0 milestone May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant