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

Feature Request: let generate_formatter also support the keyword args from format #79

Open
schlichtanders opened this issue Feb 28, 2024 · 1 comment

Comments

@schlichtanders
Copy link

I find the format function awesome. It is very intuitive. And sometimes, I even like to put it into a kind of generate_formatter, like myformat(x) = format(x, width=3). This is slow as said in the README. Hence it would be awesome if generate_formatter(width=3, ...) would work to create an efficient version of this.

@ScottPJones
Copy link
Member

I'm not sure how this could be accomplished, because format (and fmt) work by looking at the type of x, and the format is based on that. generate_formatter looks up a fixed format string, and either uses a cached FormatSpec, or creates one and caches it.

I'll try to think of a way that it could be optimized - it would need additional information not in FormatSpec to support all of the options such as autoscale, fractionsep, fractionwidth, mixedfraction, mixedfractionsep, parens, stripzeros, suffix, tryden.

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

2 participants