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

We need to talk about IFormattable.ToString() #154

Open
chrisimcevoy opened this issue May 30, 2024 · 2 comments
Open

We need to talk about IFormattable.ToString() #154

chrisimcevoy opened this issue May 30, 2024 · 2 comments

Comments

@chrisimcevoy
Copy link
Owner

#152 added a TODO because python's __format__ allows us to specify a format_spec (which in the context of Pyoda Time constitutes a "pattern", standard or otherwise).

What it doesn't allow us to do is specify a CultureInfo, naturally.

Maybe we should implement a def to_string(self, pattern, format_provider) equivalent to IFormattable.ToString()?

@chrisimcevoy
Copy link
Owner Author

That said, this needs to fit into a wider discussion around CultureInfo usage and what exactly we want to expose publicly...

@chrisimcevoy
Copy link
Owner Author

There are some types like Duration where the tests don't seem to explicitly cover IFormattable.ToString(), or even object.ToString(), explicitly.

I suspect the coverage comes from this section of code in Noda Time.

It's currently a TODO in Pyoda Time, so we'll wanna implement that too if an IFormattable protocol materialises in the codebase.

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