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

Reconsider __str__ behavior #1

Open
Aran-Fey opened this issue Dec 11, 2024 · 0 comments
Open

Reconsider __str__ behavior #1

Aran-Fey opened this issue Dec 11, 2024 · 0 comments

Comments

@Aran-Fey
Copy link
Owner

Currently, __str__ automatically finds a suitable unit. Some people have said they don't like this behavior, and would rather see it printed "as-is" (like __repr__ does).

Perhaps it would be wise to implement __format__, allowing users to choose a unit or use * for auto-conversion. Examples:

f'{download_speed}'  # use the current unit
f'{download_speed:*}'  # automatically find the most suitable unit
f'{download_speed:*/s}'  # find a suitable unit given the constraint `/s`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant