Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5958
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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; 'python': 0.08; '128': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'def': 0.12; 'wrote:': 0.14; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '1024': 0.16; '[gcc': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'file,': 0.22; 'code': 0.24; 'class': 0.29; 'from:addr:web.de': 0.30; 'print': 0.31; 'header:X-Complaints-To:1': 0.32; 'to:addr :python-list': 0.33; '...': 0.34; 'put': 0.37; 'received:org': 0.38; 'run': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; '2.7.1': 0.84; '256': 0.84; 'python2.7': 0.84; 'enlightened': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: count strangeness |
| Date | Sun, 22 May 2011 08:31:24 +0200 |
| Organization | None |
| References | <ira8ti$6no$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p50849a1d.dip.t-dialin.net |
| 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.1905.1306045890.9059.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1306045891 news.xs4all.nl 49183 [::ffff:82.94.164.166]:48084 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:5958 |
Show key headers only | View raw
James Stroud wrote: > tal 65% python2.7 > Python 2.7.1 (r271:86832, May 21 2011, 22:52:14) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > py> class C(object): > ... def __init__(self): > ... self.data = [] > ... def doit(self, count=0): > ... for c in self.data: > ... count += c.doit(count) > ... count += 1 > ... print count > ... return count > ... > py> c = C() > py> c.data.extend([C() for i in xrange(10)]) > py> c.doit() > 1 > 2 > 4 > 8 > 16 > 32 > 64 > 128 > 256 > 512 > 1024 > 1024 > > > > WTF? Put the code into a file, run it -- and be enlightened ;)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:02 -0700
Re: count strangeness Chris Rebert <crebert@ucsd.edu> - 2011-05-21 23:27 -0700
Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:32 -0700
Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:39 -0700
Re: count strangeness Chris Rebert <crebert@ucsd.edu> - 2011-05-21 23:55 -0700
Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-22 00:03 -0700
Re: count strangeness Peter Otten <__peter__@web.de> - 2011-05-22 08:31 +0200
Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:34 -0700
Re: count strangeness Peter Otten <__peter__@web.de> - 2011-05-22 09:13 +0200
Re: count strangeness James Stroud <jstroud@mbi.ucla.edu> - 2011-05-21 23:56 -0700
Re: count strangeness Roy Smith <roy@panix.com> - 2011-05-22 09:36 -0400
csiph-web