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 JPosthuma
Recipients JPosthuma, benjamin.peterson, djarb, exarkun, giampaolo.rodola, intgr, janssen, josiah.carlson, josiahcarlson, r.david.murray
Date 2009-07-13.15:46:52
SpamBayes Score 0.0
Marked as misclassified No
Message-id <02161F39-4180-43BA-87CC-C9AD621C5A22@gmail.com>
In-reply-to <1247499203.27.0.314005382859.issue1563@psf.upfronthosting.co.za>
Content
On 13 jul 2009, at 17:33, Jean-Paul Calderone wrote:
>
> Jean-Paul Calderone <exarkun@divmod.com> added the comment:
>
>> It's not 'that' clear you should only work with bytes on a socket.
>
> It's pretty clear to me. :)  That's what sockets can deal with -  
> bytes.

It's allso clear to me, but there are people that don't know that.

> If you want to transfer something other than bytes via a socket, then
> you need to convert it to bytes.  In the case of unicode, there are  
> many
> different choices which can be made for how to do this conversion.
> asyncore cannot know what the correct choice is in any particular
> situation, so it shouldn't try to make it.
>
> The attached patch forces the application to make this choice,
> fortunately.  However, since push_str is only one line, I'm not sure
> what the attraction is.  Why is push_str(foo, bar) preferable to
> push(foo.encode(bar))?

It's not, I was more thinking of push_str(foo), where it uses a  
default encoding. I think some people don't know what unicode or  
encoding is, or don't want to worry about it.

>
>> Maybe it's possible to do a default byte conversion when the user  
>> is working with strings.
>
> This definitely isn't reasonable and should not be done.  It's also  
> not
> what the last proposed patch does, so it doesn't seem to the direction
> the other interested parties have been working in.

It's not an attack ;), i'm pretty new to Python, and it was just  
something that i noticed (after changing from 2 to 3)
History
Date User Action Args
2009-07-13 15:46:53JPosthumasetrecipients: + JPosthuma, josiahcarlson, exarkun, janssen, giampaolo.rodola, djarb, josiah.carlson, benjamin.peterson, r.david.murray, intgr
2009-07-13 15:46:52JPosthumalinkissue1563 messages
2009-07-13 15:46:52JPosthumacreate