Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43767
| 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 | <dihedral88888@googlemail.com> |
| 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 | <mailman.718.1366191316.3114.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw |
| References | <mailman.668.1366126626.3114.python-list@python.org> <2rGdndNcINM-tvPMnZ2dnUVZ_jqdnZ2d@giganews.com> <mailman.718.1366191316.3114.python-list@python.org> |
| 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 <dihedral88888@googlemail.com> |
| 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 <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> |
| Message-ID | <mailman.728.1366215818.3114.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
Serhiy Storchaka於 2013年4月17日星期三UTC+8下午5時35分07秒寫道:
> 17.04.13 07:57, Larry Hudson написав(ла):
>
> > So using a list comprehension you can do it in two lines:
>
> >
>
> > def get_rule(num):
>
> > bs = bin(num)[2:]
>
> > return [0] * (8 - len(bs)) + [int(i) for i in bs]
>
>
>
> You can do it in one line!
>
>
>
> def get_rule(num):
>
> return list(map(int, '{:08b}'.format(num)))
Well, a new object is returned and can be used.
Then who is going to clean up the object when required?
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
a couple of things I don't understand wrt lists aaB <mecagonoisician@gmail.com> - 2013-04-16 17:37 +0200
Re: a couple of things I don't understand wrt lists John Gordon <gordon@panix.com> - 2013-04-16 16:43 +0000
Re: a couple of things I don't understand wrt lists Larry Hudson <orgnut@yahoo.com> - 2013-04-16 21:57 -0700
Re: a couple of things I don't understand wrt lists Serhiy Storchaka <storchaka@gmail.com> - 2013-04-17 12:35 +0300
Re: a couple of things I don't understand wrt lists 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-17 09:10 -0700
Re: a couple of things I don't understand wrt lists Ned Batchelder <ned@nedbatchelder.com> - 2013-04-17 14:36 -0400
Re: a couple of things I don't understand wrt lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-18 04:46 +1000
Re: a couple of things I don't understand wrt lists Chris Angelico <rosuav@gmail.com> - 2013-04-18 04:42 +1000
Re: a couple of things I don't understand wrt lists 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-17 09:10 -0700
csiph-web