Terry J. Reedy added the comment:

I agree with Serhiy that the method is not needed in any case.

I was about to post the same missing rationale: people misunderstand 'bytes(7)' 
and write it expecting to get bytes([7]) == b(\x07'), so it would be better to 
make bytes(7) raise instead of silently accepting a buggy usage.  I was 
thinking that one rationale for bytes(n) might be that it is faster than b'\0' 
* n. Since Josh claimed the contrary, I tried to test with timeit.repeat (both 
console and Idle) and got this error message
  TypeError: source code string cannot contain null bytes
Both eval and compile emit this message. So it seems that one justification for 
bytes(n) is to avoid putting null bytes in source strings.

I think this issue should be closed. Deprecation ideas should really be posted 
of python-ideas and ultimately pydev for discussion and approval.

If Ethan wants to pursue the idea, he should research the design discussions 
for bytes() (probably on the py3k list) and whether Guido directly approved of 
bytes(n) or if someone else 'snuck' it in after the initial approval.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20895>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to