Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '[0]': 0.09; 'lines:': 0.09; 'to:addr:comp.lang.python': 0.09; 'used.': 0.09; 'cc:addr :python-list': 0.11; 'def': 0.12; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'returned': 0.30; 'larry': 0.31; 'subject:lists': 0.35; 'received:google.com': 0.35; 'two': 0.37; 'list': 0.37; '8bit%:86': 0.38; 'from:addr:googlemail.com': 0.38; 'new': 0.61; 'line!': 0.84 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:path:newsgroups:date:in-reply-to:complaints-to :injection-info:nntp-posting-host:references:user-agent :x-google-web-client:x-google-ip:mime-version:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=j0yaJJ/Ucbh5huIJFcIU1cVh4WlIvGPW1w5TaxTB030=; b=pzlmC9dCbEzXsanWXjWwT+M3lTGMPQg+VKW5s5FCz51m1ta8tq6yUBeI+tHxlNUybQ M2iOkUwfpXtcbaIC94XW8hJC7h90VEA5itQoFk07JNoK1vRl9h0rCAIlugqDRlQIWmpA sgSp6CtYgr0qta1X11cDpgSOYRhGo0R0xQmHeIjYqNPm/+OrzgMqHpkngUYEGeS4EkaN k+mm1htLxCRiK+tLYi1pD45FrGaRDbMuR15kwBdv9J0c7XZRleSqfHimrtxNm9U+Cx9+ LYoQqGs3ZCg6KEVr2NisewvkekbnqnQ3YumU84UvJpSO7/qx8bWApUyBqDvCr+t5tf1s hMIA== X-Received: by 10.50.109.228 with SMTP id hv4mr1232139igb.2.1366215037577; Wed, 17 Apr 2013 09:10:37 -0700 (PDT) Newsgroups: comp.lang.python Date: Wed, 17 Apr 2013 09:10:37 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw References: <2rGdndNcINM-tvPMnZ2dnUVZ_jqdnZ2d@giganews.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 123.192.32.215 MIME-Version: 1.0 Subject: Re: a couple of things I don't understand wrt lists From: 88888 Dihedral To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366215818 news.xs4all.nl 2250 [2001:888:2000:d::a6]:58484 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43767 Serhiy Storchaka=E6=96=BC 2013=E5=B9=B44=E6=9C=8817=E6=97=A5=E6=98=9F=E6=9C= =9F=E4=B8=89UTC+8=E4=B8=8B=E5=8D=885=E6=99=8235=E5=88=8607=E7=A7=92=E5=AF= =AB=E9=81=93=EF=BC=9A > 17.04.13 07:57, Larry Hudson =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2(= =D0=BB=D0=B0): >=20 > > So using a list comprehension you can do it in two lines: >=20 > > >=20 > > def get_rule(num): >=20 > > bs =3D bin(num)[2:] >=20 > > return [0] * (8 - len(bs)) + [int(i) for i in bs] >=20 >=20 >=20 > You can do it in one line! >=20 >=20 >=20 > def get_rule(num): >=20 > return list(map(int, '{:08b}'.format(num))) Well, a new object is returned and can be used.=20 Then who is going to clean up the object when required?