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

Update description for string type in Standard Library Types documentation section #7238

Merged
merged 1 commit into from Aug 24, 2023

Conversation

15498th
Copy link
Contributor

@15498th 15498th commented Aug 23, 2023

Change Summary

Remove sentence about coercion of numeric types to str.

According to #6045, coercion int->str is not supported in v2, yet https://docs.pydantic.dev/latest/usage/types/standard_types/ states:

Strings are accepted as-is. int, float, and Decimal are coerced using str(v). bytes and bytearray are converted using v.decode(). Enums inheriting from str are converted using v.value. All other types cause an error. See String Types for more details.

String types section (https://docs.pydantic.dev/latest/usage/types/string_types/) it links to seems to be correct in this regard.

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Remove bit about coercion of numeric types to str since it is not the case for v2 (pydantic#6045)
Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks so much.

@davidhewitt since you're on open source today, please could you check the enum bit of the sentence is right too.

@davidhewitt
Copy link
Contributor

Confirmed (which includes StrEnum from Python 3.11).

@davidhewitt davidhewitt merged commit 9d2a225 into pydantic:main Aug 24, 2023
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants