Re: count strangeness

2011-05-22 Thread Roy Smith
In article , 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): > ... se

Re: count strangeness

2011-05-22 Thread Peter Otten
James Stroud wrote: > Peter Otten wrote: >> James Stroud wrote: >>> WTF? >> >> Put the code into a file, run it -- and be enlightened ;) > > > tal 72% python2.7 eraseme.py > 1 > 2 > 4 > 8tal 73% cat eraseme.py > #! /usr/bin/env python > > class C: >def __init__(self): > self.data = []

Re: count strangeness

2011-05-22 Thread James Stroud
Chris Rebert wrote: On Sat, May 21, 2011 at 11:32 PM, James Stroud wrote: Chris Rebert wrote: WTF? Assuming your question is "Why is 1024 there twice?", the answer is The question is "Why is 1024 there at all?" It should be 10. Ah. This is why it's better to be more explicit about what you

Re: count strangeness

2011-05-22 Thread James Stroud
Peter Otten wrote: James Stroud wrote: WTF? Put the code into a file, run it -- and be enlightened ;) Compare the follower to the last. tal 77% cat eraseme.py #! /usr/bin/env python class C: def __init__(self): self.data = [] def doit(self, count=[0]): for c in self.data:

Re: count strangeness

2011-05-22 Thread Chris Rebert
On Sat, May 21, 2011 at 11:32 PM, James Stroud wrote: > Chris Rebert wrote: >>> >>> WTF? >> >> Assuming your question is "Why is 1024 there twice?", the answer is > > The question is "Why is 1024 there at all?" It should be 10. Ah. This is why it's better to be more explicit about what your quest

Re: count strangeness

2011-05-21 Thread James Stroud
James Stroud wrote: Chris Rebert wrote: WTF? Assuming your question is "Why is 1024 there twice?", the answer is The question is "Why is 1024 there at all?" It should be 10. James I mean 11, not 10--but you get the point. James -- http://mail.python.org/mailman/listinfo/python-list

Re: count strangeness

2011-05-21 Thread James Stroud
Peter Otten wrote: James Stroud wrote: WTF? Put the code into a file, run it -- and be enlightened ;) tal 72% python2.7 eraseme.py 1 2 4 8tal 73% cat eraseme.py #! /usr/bin/env python class C: def __init__(self): self.data = [] def doit(self, count=0): for c in self.data:

Re: count strangeness

2011-05-21 Thread James Stroud
Chris Rebert wrote: WTF? Assuming your question is "Why is 1024 there twice?", the answer is The question is "Why is 1024 there at all?" It should be 10. James -- http://mail.python.org/mailman/listinfo/python-list

Re: count strangeness

2011-05-21 Thread Peter Otten
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 = [] >

Re: count strangeness

2011-05-21 Thread Chris Rebert
On Sat, May 21, 2011 at 11:02 PM, 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__(

count strangeness

2011-05-21 Thread James Stroud
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): ...