[New-bugs-announce] [issue45814] Use same function signature for datetime.time.strftime

Yevhenii Hyzyla report at bugs.python.org
Tue Nov 16 05:40:29 EST 2021


New submission from Yevhenii Hyzyla <hyzyla at gmail.com>:

Method datetime.time.strftime in Python and C implementation has different signature. Python implementation use `fmt` as argument and C implementation use `format` as argument. 

Python implementation:
```python
def strftime(self, fmt):
  ...
```

C implementation
```C
static PyObject *
time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw)
{
    PyObject *result;
    PyObject *tuple;
    PyObject *format;
    static char *keywords[] = {"format", NULL};

    if (! PyArg_ParseTupleAndKeywords(args, kw, "U:strftime", keywords,
                                      &format))
        return NULL;
```

My suggestion to use the same argument name for both implementations, for example to use `format` as in C implementation.

----------
components: Library (Lib)
messages: 406395
nosy: hyzyla
priority: normal
severity: normal
status: open
title: Use same function signature for datetime.time.strftime
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45814>
_______________________________________


More information about the New-bugs-announce mailing list