[issue41749] Allow omission of imghdr.what file arg if bytes are given

2020-09-15 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

> The opening message confused me by using 'need' as 'currently required to 
> call' rather than 'required to compute (test) and necessarily needed to 
> call'; but after reading the code, I believe I understand and modified title 
> to match.

Sorry for my bad English, yes my idea was more likely your point of view. In 
the future I'll try to be more clear. 

> However, what is very problemmatic is requiring 1 of 2 different arguments.  
> For range, the first parameter is really 'start_or_stop', an int either way, 
> with the interpretation depending on the presence of a second.  This is a 
> nuisance for understanding, but a convenience in usage.  But I think 
> requiring an argument (usually) passed positionally or an argument that now 
> has to be passed by keyword, with an arbitrary letter name, is worse and less 
> justified.  So my current view is that this change should be rejected.

My intention is try to avoid a call like `what(None, b'...')`. IMO call a 
function that start with None seems a little weird (from my point of view). 
Sincerely, I don't know if for the people it's ok use `what(None, b'...')` or 
not, probably not because haven't changed since 1997.

Reading your opinion it's more clear for me that this patch should be rejected. 
So, I'll close this issue and the PR.

Thanks for the feedback, very appreciate.

--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue41749] Allow omission of imghdr.what file arg if bytes are given

2020-09-11 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The opening message confused me by using 'need' as 'currently required to call' 
rather than 'required to compute (test) and necessarily needed to call'; but 
after reading the code, I believe I understand and modified title to match.  
More simply, one could call what(h=b'...') after the change instead of 
what(None, b'...').  This is the change in the tests (but the old form must 
still be tested also).

I don't see how the change would affect correct legacy use.  (The TypeError to 
ValueError change is wrong, and I don't understand the other exception change.) 
 However, what('') should get the same error as currently (see additional 
change in review).

However, what is very problemmatic is requiring 1 of 2 different arguments.  
For range, the first parameter is really 'start_or_stop', an int either way, 
with the interpretation depending on the presence of a second.  This is a 
nuisance for understanding, but a convenience in usage.  But I think requiring 
an argument (usually) passed positionally or an argument that now has to be 
passed by keyword, with an arbitrary letter name, is worse and less justified.  
So my current view is that this change should be rejected.

--
nosy: +terry.reedy
title: Little improve on imghdr library -> Allow omission of imghdr.what file 
arg if bytes are given
type: behavior -> enhancement

___
Python tracker 

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