This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Rename parameter name of imghdr what
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: corona10, serhiy.storchaka, xtreak
Priority: normal Keywords:

Created on 2019-06-16 04:55 by corona10, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg345727 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-06-16 04:55
Still https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/imghdr.py#L11 signature is def what(file, h=None).

I 'd like to suggest to update it into def what(filename, h=None)
Also, the doc of imghdr represents it as the filename.
https://docs.python.org/3/library/imghdr.html

note that sndhdr is already using this name.
https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/sndhdr.py#L52

If this proposal is accepted, I'd like to send a patch for it.
msg345728 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-06-16 05:52
file can be a positional or keyword argument. Someone might be using it as a keyword argument and this would require a deprecation period before renaming could be done.

./python.exe
Python 3.9.0a0 (heads/master:7a68f8c28b, Jun 15 2019, 21:00:05)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect, imghdr
>>> imghdr.what(file="README.rst")
>>> imghdr.what("README.rst")
>>> inspect.signature(imghdr.what).parameters['file'].kind.description
'positional or keyword'
msg345729 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-06-16 06:24
Inlike to sndhdr.what(), imghdr.what() accepts not only file names, by file objects theirself. The feature was added at 1997 in 45ac47c0b2798cc3a29cf5111694aba5e9347e08.
History
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81484
2019-06-16 06:24:06serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg345729

resolution: rejected
stage: resolved
2019-06-16 05:52:18xtreaksetnosy: + xtreak

messages: + msg345728
versions: - Python 3.5, Python 3.6, Python 3.7, Python 3.8
2019-06-16 04:55:09corona10create