[ 
https://issues.apache.org/jira/browse/QPID-7423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15489884#comment-15489884
 ] 

Lorenz Quack commented on QPID-7423:
------------------------------------

The chunking code:
{code}
      start = 0
      remaining_size = len(content.body)
      while remaining_size > 0:
        chunk_size = min(frame_max, remaining_size)
        chunk = content.body[start:start + chunk_size]
        self.write(Body(chunk))
        start += chunk_size
        remaining_size -= chunk_size
{code}
can be expressed more concise:
{code}
      for chunk in (content.body[i:i+frame_max] for i in xrange(0, 
len(content.body), frame_max)):
        self.write(Body(chunk))
{code}
I'll leave it to others to judge which version is more readable

> [0-8...0-91] Chunk message content that exceeds the capacity of a single 
> frame into multiple frames
> ---------------------------------------------------------------------------------------------------
>
>                 Key: QPID-7423
>                 URL: https://issues.apache.org/jira/browse/QPID-7423
>             Project: Qpid
>          Issue Type: Bug
>          Components: Python Client
>            Reporter: Keith Wall
>            Assignee: Keith Wall
>
> The legacy Python client [0-8..0-91] currently will send an oversize message 
> content frame if the application supplied content exceeds the configured 
> frame size.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to