[docs] Python 3 crc32 documentation clarifications (issue 22341)

storchaka at gmail.com storchaka at gmail.com
Fri Mar 20 23:30:33 CET 2015


http://bugs.python.org/review/22341/diff/14133/Doc/library/binascii.rst
File Doc/library/binascii.rst (right):

http://bugs.python.org/review/22341/diff/14133/Doc/library/binascii.rst#newcode129
Doc/library/binascii.rst:129: crc = binascii.crc32(b"hello", 0)
On 2015/03/20 22:56:39, vadmium wrote:
> On 2015/03/20 20:26:49, storchaka wrote:
> > Why 0 was added? I think it is better to left only one argument, for
> > demonstrating that the second argument is optional.
> 
> The first print() in the example already illustrates that the initial
CRC
> argument is optional.
> 
> Looking at this with fresh eyes, I think I would actually like to make
the
> second part look like the following, which is more like how you do
iterative CRC
> calculation in the real world:
> 
> crc = 0
> crc = binascii.crc32(b"hello", crc)
> crc = binascii.crc32(b" world", crc)

I think it only complicates the example. It creates an impression, that
you can omit the argument when calculate all checksum at a time, but
should specify it when calculate it incrementally.

http://bugs.python.org/review/22341/


More information about the docs mailing list