Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5614

Re: Python 3.x and bytes

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.04; 'way:': 0.05; 'constructor': 0.07; 'object.': 0.09; 'pm,': 0.11; 'wrote:': 0.14; 'furman': 0.16; 'bytes': 0.19; 'tue,': 0.20; 'header:In-Reply-To:1': 0.22; 'way?': 0.23; 'received:209.85.161.46': 0.26; 'received:mail- fx0-f46.google.com': 0.26; 'skip:b 20': 0.27; 'message- id:@mail.gmail.com': 0.28; 'received:209.85.161': 0.29; '17,': 0.31; 'to:addr:python-list': 0.32; 'received:209.85': 0.37; 'received:google.com': 0.38; 'question,': 0.39; 'though,': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; '2011': 0.62
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=Rdiy7lzkkHZkskHo7yswbQzo6Gv44MtZU6gntYHEUaQ=; b=kQmsS1H+YyZS3g45uEXVxxKrVgPjDF27O1UTgmFRrZ4hakhdqNzSNqlf9yV3+2V8uu VEsK+gCNgKdnHsKkrM0v6eXmtYz8yOV/Z1JtucmvF4+cxN6hI2ngWzrEK5/ui0Ai2fac YoESxPkOKh8zJyGPqbOF2Bil6UWR0HrmYZ2OA=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=Yp/cre6EfUPy51Yx1c9tDcPSCa3ToxdTWsCvToODYHXZnmX432yWX7OtWu2sZ20cXQ 3SkJ2ZDs+2gKiQHKXBvpBUck7MjG0D9tNBrmD9PEukO7IOv+Esyf63RWbftxO4nLfekt 2gwaJTfnzG7kGbAnUzZeVxgJE5tSywowAxnRk=
MIME-Version 1.0
In-Reply-To <4DD2D89D.4000303@stoneleaf.us>
References <4DD2C2A5.3080403@stoneleaf.us> <BANLkTimvzZeN5dmm2xHP5xV8Kpw2Nb9kuQ@mail.gmail.com> <4DD2D89D.4000303@stoneleaf.us>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 17 May 2011 14:52:43 -0600
Subject Re: Python 3.x and bytes
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1715.1305665594.9059.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 82.94.164.166
X-Trace 1305665594 news.xs4all.nl 49175 [::ffff:82.94.164.166]:40602
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5614

Show key headers only | View raw


On Tue, May 17, 2011 at 2:20 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
> The big question, though, is would you do it this way:
>
> some_var = bytes(23).replace(b'\x00', b'a')
>
> or this way?
>
> some_var = bytes(b'a' * 23)

Actually, I would just do it this way:

some_var = b'a' * 23

That's already a bytes object.  Passing it into the constructor is redundant.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python 3.x and bytes Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-17 14:52 -0600

csiph-web