You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
datetime.date.replace() description not clear enough #115684
In documentation explanation to command date.replace() is not clear enough.
I'm not that experienced, so it's maybe look from junior perspective, but since documentation quite needed for beginers i think my opinion might be valuable.
In documentation description to this function says "Return a date with the same value, except for those parameters given new values by whichever keyword arguments are specified." and gives an examle:
But it confused me, since it looks like you can change datetime object and as documentation says - datetime objects are immutable, so i had to check and of course you can't change variable like that, the only way that works if you create a new variable (for example: d2 = d.replace(day=26))
So i propose to make this part that there won't be any confusion for anyone by rephrasing it.
For example:
Return a new date object with the same value as initial, except for those parameters given new values by whichever keyword arguments are specified.
Activity
Clarify datetime `replace` documentation
Clarify datetime `replace` documentation
Clarify datetime `replace` documentation
Privat33r-dev commentedon Mar 14, 2024
Thank you for creating this issue, you are right that the documentation is not concise enough.
Rule of thumb for the future: usually if something is returning a value, it doesn't change the original element.
gh-115684: Clarify datetime `replace` documentation (#116519)
pythongh-115684: Clarify datetime `replace` documentation (pythonGH-1…
[3.12] pythongh-115684: Clarify datetime `replace` documentation (pyt…
pythongh-115684: Clarify datetime `replace` documentation (python#116519
[3.12] gh-115684: Clarify datetime `replace` documentation (GH-116519) (
[3.13] gh-115684: Clarify datetime `replace` documentation (GH-116519) (