[Python-Dev] PEP 461 updates

Ethan Furman ethan at stoneleaf.us
Thu Jan 16 16:09:47 CET 2014


On 01/16/2014 04:49 AM, Michael Urman wrote:
> On Thu, Jan 16, 2014 at 1:52 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
>>> Is this an intended exception to the overriding principle?
>>
>>
>> Hmm, thanks for spotting that.  Yes, that would be a value error if anything
>> over 255 is used, both currently in Py2, and for bytes in Py3.  As Carl
>> suggested, a little more explanation is needed in the PEP.
>
> FYI, note that str/unicode already has another value-dependent
> exception with %c. I find the message surprising, as I wasn't aware
> Python had a 'char' type:
>
>>>> '%c' % 'a'
> 'a'
>>>> '%c' % 'abc'
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> TypeError: %c requires int or char

Python doesn't have a char type, it has str's of length 1... which are usually referred to as char's.  ;)

--
~Ethan~


More information about the Python-Dev mailing list