homepage

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.

Author kristjan.jonsson
Recipients gregory.p.smith, kristjan.jonsson, pitrou, rbcollins
Date 2009年05月11日.08:56:22
SpamBayes Score 9.998474e-11
Marked as misclassified No
Message-id <1242032185.57.0.437214445534.issue5804@psf.upfronthosting.co.za>
In-reply-to
Content
Well, yes and no.
I agree that it is annoying to have to add another parameter to get a 
returning tuple. But you have to weigh that against adding another 
conveinence API.
On the other hand, I think the offset argument is quite convenient. If 
we were to add a "decompress2" function, I would like to keep the 
offset because it removes the extra overhead of having to create a 
temporary buffer object, at no extra cost.
Also, note that your example code becomes more complex, for a loop. 
You would need to:
results = []
used =0
while used<len(source):
 r, u = zlib.decompress2(buffer(source, used))
 used += u
 results.append(r)
as opposed to:
 r, used = zlib.decompress2(source, used)
 results.append(r)
You have to make sure you add the buffer's hidden offset to the output 
offset.
There is a third option. The "offset" could be a list containg the 
offset in its 0th position, a sort of "byref" passing, but that is not 
in the general Python spirit, is it?
This would give us the loop:
o = [0]
while len(source)>o[0]
 results.append(zlib.decompress(source, offset=offsetlist))
History
Date User Action Args
2009年05月11日 08:56:25kristjan.jonssonsetrecipients: + kristjan.jonsson, gregory.p.smith, pitrou, rbcollins
2009年05月11日 08:56:25kristjan.jonssonsetmessageid: <1242032185.57.0.437214445534.issue5804@psf.upfronthosting.co.za>
2009年05月11日 08:56:24kristjan.jonssonlinkissue5804 messages
2009年05月11日 08:56:23kristjan.jonssoncreate

AltStyle によって変換されたページ (->オリジナル) /