Repository navigation
bpo-15873: Implement [date][time].fromisoformat #4699
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
Changes from 1 commit
b451a83
4ccef0a
13e8e48
6fa5c55
0d44220
327d0fc
52b2175
f1b78af
aeaa9ca
094ccf4
2a8120d
af9e6d0
cf802af
626d239
7c771e7
8fbd752
4d55e05
5a233fb
9fa91db
ffdb2af
18a5fa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -438,9 +438,9 @@ Other constructors, all class methods: | |
|
|
||
| .. classmethod:: date.fromisoformat(date_string) | ||
|
|
||
| Return a :class:`date` corresponding to a *date_string* in one of the ISO 8601 | ||
| formats emitted by :meth:`date.isoformat`. Specifically, this function supports | ||
| strings in the format(s) ``YYYY-MM-DD``. | ||
| Return a :class:`date` corresponding to a *date_string* in the format emitted | ||
| by :meth:`date.isoformat`. Specifically, this function supports strings in | ||
| the format(s) ``YYYY-MM-DD``. | ||
|
|
||
| .. caution:: | ||
|
|
||
|
|
@@ -837,8 +837,9 @@ Other constructors, all class methods: | |
| .. classmethod:: datetime.fromisoformat(date_string) | ||
|
|
||
| Return a :class:`datetime` corresponding to a *date_string* in one of the | ||
| ISO 8601 formats emitted by :meth:`datetime.isoformat`. Specifically, this function | ||
| supports strings in the format(s) ``YYYY-MM-DD[*HH[:MM[:SS[.mmm[mmm]]]]][+HH:MM[:SS[.ffffff]]]``, | ||
| formats emitted by :meth:`date.isoformat` and :meth:`datetime.isoformat`. | ||
| Specifically, this function supports strings in the format(s) | ||
| ``YYYY-MM-DD[*HH[:MM[:SS[.mmm[mmm]]]][+HH:MM[:SS[.ffffff]]]]``, | ||
| where ``*`` can match any single character. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be less ambiguous putting the time zone inside the optional time part. Test case: datetime(2017, 12, 18, 11, 0).isoformat(sep="+", timespec="minutes") -> "2017-12-18+11:00"
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm.. As much as I dislike the idea of timezone being part of the time component, this is fine I suppose (and in fact that is how it is currently implemented). That said, another design I considered is one where we take |
||
|
|
||
| .. caution:: | ||
|
|
@@ -1518,11 +1519,11 @@ In boolean contexts, a :class:`.time` object is always considered to be true. | |
|
|
||
| Other constructor: | ||
|
|
||
| .. classmethod:: time.fromisoformat(date_string) | ||
| .. classmethod:: time.fromisoformat(time_string) | ||
|
|
||
| Return a :class:`time` corresponding to a *time_string* in one of the ISO 8601 | ||
| Return a :class:`time` corresponding to a *time_string* in one of the | ||
| formats emitted by :meth:`time.isoformat`. Specifically, this function supports | ||
| strings in the format(s) ``HH[:MM[:SS[.mmm[mmm]]]]][+HH:MM[:SS[.ffffff]]]``. | ||
| strings in the format(s) ``HH[:MM[:SS[.mmm[mmm]]]][+HH:MM[:SS[.ffffff]]]``. | ||
|
|
||
| .. caution:: | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the colon after :MM be optional?