Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: Pyhon 2.x or 3.x, which is faster? Date: Mon, 7 Mar 2016 22:51:50 -0500 Lines: 28 Message-ID: References: <87d1r6iltx.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de pj54//GdmWvtglK0BVYBMgUBQSL8j1hHiOZpgTm0xfPA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bytes.': 0.07; 'bytearray': 0.09; 'bytes,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:which': 0.09; 'python': 0.10; 'jan': 0.11; "'data'": 0.16; '3.3,': 0.16; 'effect,': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'useless.': 0.16; 'wrote:': 0.16; 'string': 0.17; 'byte': 0.18; 'file:': 0.22; 'code,': 0.23; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'sense': 0.26; 'array': 0.29; 'skip:d 20': 0.34; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'no,': 0.38; 'mean': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'still': 0.40; 'received:96': 0.63; '(is': 0.84; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104322 On 3/7/2016 7:22 PM, BartC wrote: > (Is a byte string the same as a byte array? No, if by 'byte array' mean (mutable) bytearray. Yes, in the sense that a byte string is an (immutable) array of ints in range(256). > Is a byte array the same as an array.array? No, if by 'byte array' you mean the same as bytes. Yes, if you mean bytearray and array.array('B'), in the sense that bytearray is based on array.array('B'). > If I remove this line from my code, where 'data' has > just been read from a file: > > data=array.array('B',data) > > then it still works - Python 3. In 3.3, data = bytearray(data) would have the same effect, and the only effect is to make data mutable, but if you do not mutate the image bytes, that is useless. -- Terry Jan Reedy