[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-08-02 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +20856
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/21712

___
Python tracker 

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



[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-07-09 Thread Anthony Sottile


Anthony Sottile  added the comment:

awesome, I'm going to work through this with someone in my discord as a demo / 
mentorship opportunity -- hope that's ok!

--

___
Python tracker 

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



[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-07-09 Thread Paul Ganssle


Paul Ganssle  added the comment:

I think a positional-only argument would be the best option if we could do it, 
but it would be a backwards-incompatible change and it's probably not worth the 
hassle.

If anyone is using the keyword argument, they're probably using `format=` 
rather than `fmt=`, since it's pretty rare for anyone to use the pure python 
version of datetime. PyPy uses it, but I think they tend to aim for consistency 
with the C API of CPython, and it seems like they already patch s/fmt/format/ 
themselves: 
https://foss.heptapod.net/pypy/pypy/-/blob/branch/default/lib_pypy/datetime.py#L781

If anyone wants to make a PR I think we can fix this for 3.10, though 
unfortunately because it is an API change it can't be backported. I think in 
typeshed they can safely change from `fmt` to `format` even today (which would 
almost certainly be more accurate to end user use cases).

--
nosy:  -rkm
stage:  -> needs patch

___
Python tracker 

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



[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-07-09 Thread Ruairidh MacLeod


Change by Ruairidh MacLeod :


--
nosy: +rkm

___
Python tracker 

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



[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-07-09 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-07-09 Thread Anthony Sottile


New submission from Anthony Sottile :

C:

https://github.com/python/cpython/blob/8b33961e4bc4020d8b2d5b949ad9d5c669300e89/Modules/_datetimemodule.c#L3183

pure python:

https://github.com/python/cpython/blob/8b33961e4bc4020d8b2d5b949ad9d5c669300e89/Lib/datetime.py#L927


this makes it difficult to properly type in mypy:

https://github.com/python/typeshed/blob/209b6bb127f61fe173a60776e23883ac450cf1c8/stdlib/2and3/datetime.pyi#L55

and calling with `.strftime(fmt=...)` or `.strftime(format=...)` is inconsistent

(that said, it should _probably_ be a positional-only argument)

--
components: Extension Modules, Library (Lib)
messages: 373407
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: datetime: strftime method takes different keyword argument: fmt (pure) 
or format (C)
type: behavior
versions: Python 3.10

___
Python tracker 

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