Le 17/08/2014 19:41, Raymond Hettinger a écrit : > > The APIs have been around since 2.6 and AFAICT there have been zero > demonstrated > need for a special case for a single byte. We already have a perfectly > good spelling: > NUL = bytes([0]) That is actually a very cumbersome spelling. Why should I first create a one-element list in order to create a one-byte bytes object? > The Zen tells us we really don't need a second way to do it (actually a > third since you > can also write b'\x00') and it suggests that this special case isn't > special enough. b'\x00' is obviously the right way to do it in this case, but we're concerned about the non-constant case. The reason to instantiate bytes from non-constant integer comes from the unfortunate indexing and iteration behaviour of bytes objects. Regards Antoine.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4