On Jul 13, 6:02 am, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> Alex Popescu a écrit :
> (snip)
>
>
>
> > You are defining the list in the class context and so it becomes a
> > class field/member.
>
> 'attribute' is the pythonic term.
Thanks! I'm just a couple of weeks Python old, so I am st
Adam Pletcher wrote:
> I'm curious (and somewhat new to Python)... What's the benefit of
> inheriting from 'object'?
>
> The docs aren't clear on that, nor is that used in the class examples
> I've seen.
> Thanks in advance.
>
Well, they are, but they are just not well integrated. Which they, t
Another one bitten by the 'missing' reply-to munging ;)
You might want to ensure that you always reply to python-list@python.org
intsead of the message author.
Original Message
Subject: RE: Lists in classes
Date: Thu, 12 Jul 2007 16:58:50 -0500
From: Ada
Alex Popescu a écrit :
(snip)
>
> You are defining the list in the class context and so it becomes a
> class field/member.
'attribute' is the pythonic term.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for clearing up the other incorrect answers! In true Python
fashion, I would also remind everyone of the *documentation* - in
particular the Python tutorial. These are very elementary mistakes to
be making - even worse as part of attempted answers.
The Python tutorial is at http://docs.pyth
Thanks for all the replies, very impressive. Got it now.
Jeremy.
On Jul 12, 4:23 pm, Jeremy Lynch <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Learning python from a c++ background. Very confused about this:
>
>
> class jeremy:
> list=[]
> def additem(self):
>
Bart Ogryczak wrote:
> On 12 jul, 17:23, Jeremy Lynch <[EMAIL PROTECTED]> wrote:
>
>> Hello,
>>
>> Learning python from a c++ background. Very confused about this:
>>
>>
>> class jeremy:
>> list=[]
>>
>
> You've defined list (very bad choice of a name, BTW), as a class
Jeremy Lynch wrote:
> Hello,
>
> Learning python from a c++ background. Very confused about this:
>
>
> class jeremy:
> list=[]
> def additem(self):
> self.list.append("hi")
> return
>
> temp = jeremy()
> temp.additem()
> temp.additem(
On Jul 12, 6:23 pm, Jeremy Lynch <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Learning python from a c++ background. Very confused about this:
>
>
> class jeremy:
> list=[]
> def additem(self):
> self.list.append("hi")
> return
>
> te
On 12 jul, 17:23, Jeremy Lynch <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Learning python from a c++ background. Very confused about this:
>
>
> class jeremy:
> list=[]
You've defined list (very bad choice of a name, BTW), as a class
variable. To declare is as instance variable
On Jul 12, 10:23 am, Jeremy Lynch <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Learning python from a c++ background. Very confused about this:
>
>
> class jeremy:
> list=[]
> def additem(self):
> self.list.append("hi")
> return
>
> t
On 12 jul, 17:23, Jeremy Lynch <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Learning python from a c++ background. Very confused about this:
>
>
> class jeremy:
> list=[]
> def additem(self):
> self.list.append("hi")
> return
>
> temp
Hello,
Learning python from a c++ background. Very confused about this:
class jeremy:
list=[]
def additem(self):
self.list.append("hi")
return
temp = jeremy()
temp.additem()
temp.additem()
print temp.list
temp2 = jeremy()
prin
13 matches
Mail list logo