Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87684
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'args': 0.07; 'subject:code': 0.07; 'dan': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'worse': 0.09; 'def': 0.12; 'language.': 0.14; 'chunks': 0.16; 'it;': 0.16; 'iterates': 0.16; 'itertools': 0.16; 'itself,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recipe': 0.16; 'work."': 0.16; 'weird': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '(the': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; "i've": 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'url:bugs': 0.29; 'points': 0.29; 'along': 0.30; "i'm": 0.30; 'code': 0.31; 'relies': 0.31; 'says': 0.33; 'url:python': 0.33; 'but': 0.35; 'subject:?': 0.36; 'url:org': 0.36; 'detail': 0.37; 'url:library': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'according': 0.40; 'ian': 0.60; 'url:3': 0.61; 'guarantee': 0.63; 'our': 0.64; 'zip': 0.64; 'charset:windows-1252': 0.65; 'here': 0.66; 'mar': 0.68; 'fact,': 0.69; 'url:4': 0.69; 'opinions': 0.70; 'article': 0.77; '"it': 0.84; '2015': 0.84; 'abc': 0.84; 'guaranteed.': 0.84; 'url:posts': 0.84; 'sitting': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: Brilliant or insane code? |
| Date | Wed, 18 Mar 2015 15:20:12 +0000 |
| References | <mailman.507.1426638964.21433.python-list@python.org> <meajh1$hr0$2@dont-email.me> <CALwzid=Y0uQLaPHa8g2fJko9uDJrMLp9-GK7966yXaRkx3TKWQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-92-24-220-174.ppp.as43234.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
| In-Reply-To | <CALwzid=Y0uQLaPHa8g2fJko9uDJrMLp9-GK7966yXaRkx3TKWQ@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.19 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4.1426692040.10327.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1426692040 news.xs4all.nl 2856 [2001:888:2000:d::a6]:45680 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 4784 |
| X-Received-Body-CRC | 2903072587 |
| Xref | csiph.com comp.lang.python:87684 |
Show key headers only | View raw
On 18/03/2015 14:59, Ian Kelly wrote:
> On Tue, Mar 17, 2015 at 7:14 PM, Dan Sommers <dan@tombstonezero.net> wrote:
>> On Wed, 18 Mar 2015 00:35:42 +0000, Mark Lawrence wrote:
>>
>>> I've just come across this
>>> http://www.stavros.io/posts/brilliant-or-insane-code/ as a result of
>>> this http://bugs.python.org/issue23695
>>>
>>> Any and all opinions welcomed, I'm chickening out and sitting firmly
>>> on the fence.
>>
>> According to the article itself, "it relies in an implementation detail
>> (the order the zip function iterates over the arrays) to work." Then
>> again, the article also points to the official docs that says that this
>> implementation detail is guaranteed.
>>
>> So it's no worse than depending on some weird but *documented* corner of
>> the IEEE-754 or POSIX spec.
>
> In fact, this is also a code recipe found in the itertools
> documentation. The official docs don't just guarantee it; they
> *recommend* it.
>
> def grouper(iterable, n, fillvalue=None):
> "Collect data into fixed-length chunks or blocks"
> # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
> args = [iter(iterable)] * n
> return zip_longest(*args, fillvalue=fillvalue)
>
> https://docs.python.org/3.4/library/itertools.html
>
Which is available here https://pypi.python.org/pypi/more-itertools
along with many other goodies.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Brilliant or insane code? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-18 00:35 +0000
Re: Brilliant or insane code? Dan Sommers <dan@tombstonezero.net> - 2015-03-18 01:14 +0000
Re: Brilliant or insane code? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-18 13:25 +1100
Re: Brilliant or insane code? Dan Sommers <dan@tombstonezero.net> - 2015-03-18 03:06 +0000
Re: Brilliant or insane code? Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-18 08:59 -0600
Re: Brilliant or insane code? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-18 15:20 +0000
csiph-web