Re: python terminology on classes

2010-08-04 Thread Rhodri James
On Wed, 04 Aug 2010 19:28:48 +0100, Steve Ferg wrote: Seriously, we can't keep doing your thinking for you. The answers to all your questions are section 9 of the tutorial. This is is just the kind of newbie-hostile smart-ass reply that we do not want to see on comp.lang.python. Let's try

Re: python terminology on classes

2010-08-04 Thread Steve Ferg
> Seriously, we can't keep doing your thinking for you.  The answers > to all your questions are section 9 of the tutorial. This is is just the kind of newbie-hostile smart-ass reply that we do not want to see on comp.lang.python. Let's try again: I think that the answers to all your questions a

Re: python terminology on classes

2010-07-28 Thread Terry Reedy
On 7/27/2010 1:28 PM, John Nagle wrote: Python 2.6 has a recently added "with" clause, borrowed from LISP, for associating actions with scopes. This is supported for files and locks, but setting your own object up for "with" requires adding special methods to the object. "with" is less convenien

Re: python terminology on classes

2010-07-27 Thread John Nagle
On 7/27/2010 12:17 AM, Bruno Desthuilliers wrote: destructor Python has no real destructor. You can implement a __del__ method that will _eventually_ be called before the instance gets garbage-collected, but you'd rather not rely on it. Also, implementing this method will prevent cycle detecti

Re: python terminology on classes

2010-07-27 Thread Bruno Desthuilliers
Peng Yu a écrit : Hi I'm still kind of confused about the terminology on classes in python. Could you please let me know what the equivalent terms for the following C++ terms? C++ and Python having very different semantics and object models, there's not necessarily a straight one to one mapp

Re: python terminology on classes

2010-07-26 Thread Steven D'Aprano
On Tue, 27 Jul 2010 01:15:08 +0200, Thomas Jollans wrote: > http://docs.python.org/py3k/reference/datamodel.html should answer all > your questions. It should, but as far as I can tell it doesn't. If it defines "attribute" or "method", I can't find it. -- Steven -- http://mail.python.org/ma

Re: python terminology on classes

2010-07-26 Thread Steven D'Aprano
On Mon, 26 Jul 2010 16:52:06 -0500, Peng Yu wrote: > Could you please let me know what the equivalent terms for the following > C++ terms? > > constructor > destructor > member function > member variable > virtual member function > function (1) Python new-style classes have a constructor __new_

Re: python terminology on classes

2010-07-26 Thread Tim Chase
On 07/26/10 18:15, Thomas Jollans wrote: destructor http://docs.python.org/py3k/reference/datamodel.html#object.__del__ One small caveat -- IIRC, in Java/C++ the destructor is guaranteed to be called with a certain amount of context. I find Python's __del__ almost useless since things it m

Re: python terminology on classes

2010-07-26 Thread Rhodri James
On Mon, 26 Jul 2010 22:52:06 +0100, Peng Yu wrote: Hi I'm still kind of confused about the terminology on classes in python. Could you please let me know what the equivalent terms for the following C++ terms? Seriously, we can't keep doing your thinking for you. The answers to all your que

Re: python terminology on classes

2010-07-26 Thread Thomas Jollans
On 07/26/2010 11:52 PM, Peng Yu wrote: > Hi > > I'm still kind of confused about the terminology on classes in python. > > Could you please let me know what the equivalent terms for the > following C++ terms? > > constructor constructor. This consists of the class constructor method, __new__,