A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-July/081290.html below:

[Python-Dev] accepted bytearray items -- integers or numbers?

[Python-Dev] accepted bytearray items -- integers or numbers?Guido van Rossum guido at python.org
Thu Jul 17 01:42:16 CEST 2008
On Wed, Jul 16, 2008 at 4:20 PM, Georg Brandl <g.brandl at gmx.net> wrote:
> Guido van Rossum schrieb:
>>
>> On Wed, Jul 16, 2008 at 2:48 PM, Georg Brandl <g.brandl at gmx.net> wrote:
>>>
>>> Currently, most mutating bytearray methods only accept integers
>>> as items (in 3k, in 2.6 they also accept single-char strings, for
>>> a reason I can't remember).
>>>
>>> Single-index assignment accepts anything compatible with
>>> operator.index(). This should be made consistent, but in which
>>> direction?
>>
>> I think they should all made to go through operator.index().
>>
>> BTW, looking at the 3.0 code, I was initially a little confused. While
>> the term 'item' generally refers to the value of a list or sequence,
>> several functions in bytearrayobject.c seem to be using it for an
>> argument that can be either an index or a slice. Notably
>> bytes_subscript() and bytes_ass-subscript() have this confusing
>> terminology. This is unrelated but you might want to fix this too.
>
> OK, fixed in trunk and 3k. One consequence is that bytearray("xyz")
> is no error in 2.6 -- I hope this is what was intended in the first place.

Yes, since this is how you spell bytearray(b"xyz") in 2.6. :-)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4