On May 26, 2006, at 4:56 PM, Guido van Rossum wrote:

> On 5/26/06, martin.blais <[EMAIL PROTECTED]> wrote:
>> Log:
>> Support for buffer protocol for socket and struct.
>>
>> * Added socket.recv_buf() and socket.recvfrom_buf() methods, that  
>> use the buffer
>>   protocol (send and sendto already did).
>>
>> * Added struct.pack_to(), that is the corresponding buffer  
>> compatible method to
>>   unpack_from().
>
> Hm... The file object has a similar method readinto(). Perhaps the
> methods introduced here could follow that lead instead of using two
> different new naming conventions?

(speaking specifically about struct and not socket)

pack_to and unpack_from are named as such because they work with objects
that support the buffer API (not file-like-objects). I couldn't find any
existing convention for objects that manipulate buffers in such a way.
If there is an existing convention then I'd be happy to rename these.

"readinto" seems to imply that some kind of position is being  
incremented.
Grammatically it only works if it's implemented on all buffer  
objects, but
in this case it's implemented on the Struct type.

-bob

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to