codecs.getencoder encodes entire string ?
- From: "nicolas_riesch" <nicolas.riesch@xxxxxxxxxxxx>
- Date: 28 Jul 2005 08:42:57 -0700
When I use an encoder function from codecs module, documentation says
that it encodes the object input and returns a tuple (output object,
length consumed).
>>> import codecs
>>> enc=codecs.getencoder('iso-8859-1')
>>> enc(u'asdf')
('asdf', 4)
>>>
I just don't understand why it returns the "length consumed".
Does it means that in some case, the input string can be only partially
converted ?
What can be the use of the "length consumed" value ?
And a last question: can I call this "enc" function from multiple
threads ?
.
- Follow-Ups:
- Re: codecs.getencoder encodes entire string ?
- From: "Martin v. Löwis"
- Re: codecs.getencoder encodes entire string ?
- From: Jeff Epler
- Re: codecs.getencoder encodes entire string ?
- Prev by Date: Re: Rich Graphics?
- Next by Date: Re: Create a variable "on the fly"
- Previous by thread: baffling error-handling problem
- Next by thread: Re: codecs.getencoder encodes entire string ?
- Index(es):