Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.unit0.net!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'algorithm': 0.03; 'attribute': 0.05; '3),': 0.09; '[1,': 0.09; 'get.': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'interfaces': 0.15; '(2,': 0.16; '/expected/': 0.16; '3],': 0.16; '[none,': 0.16; 'anyone?': 0.16; 'chris,': 0.16; 'dig': 0.16; 'expect,': 0.16; 'happy.': 0.16; 'intuition': 0.16; 'true:': 0.16; 'wrote:': 0.17; 'test.': 0.17; 'not,': 0.21; 'logical': 0.22; 'work,': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'monday,': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'interface': 0.27; 'chris': 0.28; 'run': 0.28; 'probably': 0.29; 'initially': 0.30; '11,': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'list': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'next': 0.35; 'list.': 0.35; 'but': 0.36; 'compare': 0.36; 'method': 0.36; 'too': 0.36; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'think': 0.40; 'your': 0.60; 'most': 0.61; 'personal': 0.62; 'different': 0.63; 'perfect': 0.63; 'more': 0.63; 'show': 0.63; 'results': 0.65; 'talking': 0.66; 'news': 0.68; 'topic,': 0.78; '2013': 0.84; 'intuit': 0.84; 'why?': 0.84 X-Received: by 10.49.96.196 with SMTP id du4mr1191102qeb.37.1360644928146; Mon, 11 Feb 2013 20:55:28 -0800 (PST) Newsgroups: comp.lang.python Date: Mon, 11 Feb 2013 20:55:28 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.196.64.201; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj References: <680e50a4-6569-49cf-b369-0be450545d50@googlegroups.com> <5115c455$0$6574$c3e8da3$5496439d@news.astraweb.com> <511784b3$0$29988$c3e8da3$5496439d@news.astraweb.com> <6b7d7299-7ce3-401f-a950-04cea18af399@googlegroups.com> <51183d05$0$29992$c3e8da3$5496439d@news.astraweb.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 70.196.64.201 MIME-Version: 1.0 Subject: Re: LangWart: Method congestion from mutate multiplicty From: Rick Johnson To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360645521 news.xs4all.nl 6868 [2001:888:2000:d::a6]:43211 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38724 On Monday, February 11, 2013 7:27:30 AM UTC-6, Chris Angelico wrote: > So... > flatten([None, 23, [1, 2, 3], (2, 3), ["spam", "ham"]]) >=20 > would return >=20 > [None, 23, 1, 2, 3, (2, 3), "spam", "ham"] >=20 > I think that's even more unexpected. Why? Are you over-analyzing? Show me a result that /does/ make you happy.= =20 Do you remember when i was talking about how i attempt to intuit interfaces= before reading any docs? Well i have news for you Chris, what you are doin= g is NOT "intuiting" how flatten will work, what you are doing is "projecti= ng" how flatten will work; these are two completely different concepts Chri= s. The word "flatten" is too ambiguous to intuit the /exact/ "result". The onl= y intuit-able attribute of flatten is that calling list.flatten() will resu= lt in a list that probably looks different than the current list. Intuition= is your friend; not your own personal "clairvoyant side-kick"! To learn the interface you need to initially "intuit", but then you need to= test. Run a few example sequences and see what results you get, compare th= ose results to what you /expected/ to get. If it works the way you expect, = move on to the next topic, if not, dig deeper.=20 You can't procrastinate over this method forever because NEWSFLASH you will= /never/ find a perfect flatten algorithm that will please /everyone/, so j= ust pick the most logical and consistent, and MOVE ON!=20 Infinite recursion anyone? while obj.repeat is True: obj.lather() obj.rinse() obj.repeat =3D True =20