Giampaolo Rodola' added the comment:

> 1) I really don't like the use_fallback argument
> Apart from complicating the prototype, what do this bring?

My initial thought was that the user might want to know *why* a file cannot be 
sent by using the fastest method and hence wants to see the original exception. 
Anyway, I have not strong opinions about this so I guess we can also drop it.


> A useful parameter instead would be to support sending only part of the file, 
> so adding a count argument.

Have you read my patch? This is already provided by the "offset" parameter.


> I really don't like the blocksize argument.
> I've *never* seen code which explicitly uses a blocksize

Both sendfile() and TransmitFile provide a "blocksize" parameter for very good 
reasons therefore it seems natural that an API built on top of them exposes the 
same parameter as well.
Some examples in the stdlib which comes to mind using a blocksize are 
asynchat.async_chat.ac_out_buffer_size and ftplib.FTP.storbinary and I'm sure 
if you grep for "blocksize" you'll find others.
Providing a blocksize is also necessary to tell how many bytes to read from 
file in case send() is used, 'cause it's *crucial* that you don't read the 
whole file into memory.
I will also give a real world example: if your app wants to limit the transfer 
speed you will want to explicitly transmit smaller chunks of data and then 
"sleep", and the only way to do that is by manipulating the blocksize. So yes: 
a blocksize parameter *is* necessary, so please stop beating that horse. 
As for using a bigger value: I made some benchmarks by using different sizes 
and I didn't notice any noticeable difference.

----------

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

Reply via email to