[issue46592] Undocumented behavior in strptime for ISO week dates

2022-01-31 Thread Jonatan Skogsfors


New submission from Jonatan Skogsfors :

Consider the following code :
Python 3.10.2 (main, Jan 31 2022, 12:03:48) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.strptime("2021-53-1", "%Y-%W-%w").strftime("%c")
'Mon Jan  3 00:00:00 2022'

And also:
>>> datetime.strptime("2021-53-1", "%G-%V-%u").strftime("%c")
'Mon Jan  3 00:00:00 2022'

2021 is a "short year" with 52 weeks (e.g. since December 31 is on a Friday). 
The 53rd week of 2021 is interpreted by Python as week 1 of 2022. This can be 
convenient but as I understand it, it is not a part of ISO 8601 and it is not 
documented as a deviation in the documentation for datetime.

As a comparison, the special behavior of week 0 (also not part of ISO 8601) is 
documented. In the documentation for format directive "%W" it is stated that 
"All days in a new year preceding the first Monday are considered to be in week 
0."

If the behavior for week 53 is intended (as opposed to raising an error) I 
think it should be documented.

--
components: Library (Lib)
messages: 412200
nosy: Jonatan Skogsfors
priority: normal
severity: normal
status: open
title: Undocumented behavior in strptime for ISO week dates
type: behavior
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue46592>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41646] Outdated shutil.copy documentation

2020-08-27 Thread Jonatan Skogsfors


New submission from Jonatan Skogsfors :

In the 3.8.5 documentation for shutil.copy it says that "src and dst should be 
strings". However, the implementation doesn't seem to have any problem with 
path objects.

--
assignee: docs@python
components: Documentation
messages: 375983
nosy: Jonatan Skogsfors, docs@python
priority: normal
severity: normal
status: open
title: Outdated shutil.copy documentation
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue41646>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27936] Inconsistent round behavior between float and int

2016-09-01 Thread Jonatan Skogsfors

New submission from Jonatan Skogsfors:

Theo error handling for round is different for float and int. 

Python 3.5.1 (default, Apr 18 2016, 11:46:32) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> round(1.0, None)
1
>>> round(1, None)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'NoneType' object cannot be interpreted as an integer

--
messages: 274205
nosy: Jonatan Skogsfors
priority: normal
severity: normal
status: open
title: Inconsistent round behavior between float and int
type: behavior
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue27936>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com