Re: Private methods

2012-11-01 Thread Ian Kelly
On Tue, Oct 9, 2012 at 5:51 PM, Steven D'Aprano wrote: > On Tue, 09 Oct 2012 11:08:13 -0600, Ian Kelly wrote: > >> I tend to view name mangling as being more for avoiding internal >> attribute collisions in complex inheritance structures than for >> designating names as private. > > Really? I tend

Re: Private methods

2012-10-10 Thread Dieter Maurer
alex23 writes: > On 10 Oct, 17:03, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. > Procida) wrote: >> It certainly makes it quick to build a class with the attributes I need, >> but it does make tracing logic sometimes a pain in the neck. >> >> I don't know what the alternative is though. >

Re: Private methods

2012-10-10 Thread 88888 Dihedral
D.M. Procida於 2012年10月9日星期二UTC+8下午9時24分30秒寫道: > What exactly is the point of a private method? Why or when would I want > Private methods in the object level are searched first in the run time of python interpreter. I did turn some private methods in to c programs from time to time. --

Re: Private methods

2012-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2012 18:34:01 -0700, alex23 wrote: > On 10 Oct, 17:03, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. > Procida) wrote: >> It certainly makes it quick to build a class with the attributes I >> need, but it does make tracing logic sometimes a pain in the neck. >> >> I don't know

Re: Private methods

2012-10-10 Thread alex23
On 11 Oct, 02:14, Mark Lawrence wrote: > What language? I think he's objecting to "bitch". I had to block him on G+ because he kept asking me to self-censor posts that he had _chosen to read_. -- http://mail.python.org/mailman/listinfo/python-list

Re: Private methods

2012-10-10 Thread alex23
On 10 Oct, 17:03, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. Procida) wrote: > It certainly makes it quick to build a class with the attributes I need, > but it does make tracing logic sometimes a pain in the neck. > > I don't know what the alternative is though. Components. The examples

Re: Private methods

2012-10-10 Thread Grant Edwards
On 2012-10-10, Mark Lawrence wrote: > On 10/10/2012 16:56, Ramchandra Apte wrote: >> On Wednesday, 10 October 2012 18:38:04 UTC+5:30, Roy Smith wrote: >>> Public: I hereby declare that this method or attribute is part of the >>> promised never to change interface of this class. I might possibly

Re: Private methods

2012-10-10 Thread Mark Lawrence
On 10/10/2012 16:56, Ramchandra Apte wrote: On Wednesday, 10 October 2012 18:38:04 UTC+5:30, Roy Smith wrote: Public: I hereby declare that this method or attribute is part of the promised never to change interface of this class. I might possibly break that promise at some point in the future,

Re: Private methods

2012-10-10 Thread Ramchandra Apte
On Wednesday, 10 October 2012 18:38:04 UTC+5:30, Roy Smith wrote: > In article > > <1krpdak.u0qy9e1a4knspn%real-not-anti-spam-addr...@apple-juice.co.uk>, > > real-not-anti-spam-addr...@apple-juice.co.uk (D.M. Procida) wrote: > > > > > Mark Lawrence wrote: > > > > > > > On 09/10/2012 14:

Re: Private methods

2012-10-10 Thread Roy Smith
In article <1krpdak.u0qy9e1a4knspn%real-not-anti-spam-addr...@apple-juice.co.uk>, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. Procida) wrote: > Mark Lawrence wrote: > > > On 09/10/2012 14:24, D.M. Procida wrote: > > > What exactly is the point of a private method? Why or when would I wa

Re: Private methods

2012-10-10 Thread Robert Kern
On 10/10/12 12:51 AM, Steven D'Aprano wrote: On Tue, 09 Oct 2012 11:08:13 -0600, Ian Kelly wrote: On Tue, Oct 9, 2012 at 8:08 AM, Demian Brecht wrote: A single underscore semantically means private. A double underscore will name mangle the function such that it's only accessible strictly by n

Re: Private methods

2012-10-10 Thread D.M. Procida
Demian Brecht wrote: > On 12-10-09 04:51 PM, Steven D'Aprano wrote: > > Really? I tend to view name mangling as a waste of time, and complex > > inheritance structures as something to avoid. > > Yep, I've been coming around to this as of late. I have a lot of inheritance. I don't know whether y

Re: Private methods

2012-10-09 Thread Demian Brecht
On 12-10-09 04:51 PM, Steven D'Aprano wrote: Really? I tend to view name mangling as a waste of time, and complex inheritance structures as something to avoid. Yep, I've been coming around to this as of late. -- Demian Brecht @demianbrecht http://demianbrecht.github.com -- http://mail.python.o

Re: Private methods

2012-10-09 Thread Steven D'Aprano
On Tue, 09 Oct 2012 11:08:13 -0600, Ian Kelly wrote: > On Tue, Oct 9, 2012 at 8:08 AM, Demian Brecht > wrote: >> A single underscore semantically means private. A double underscore >> will name mangle the function such that it's only accessible strictly >> by name through the class that it's defi

Re: Private methods

2012-10-09 Thread Tim Chase
On 10/09/12 08:59, D.M. Procida wrote: >> On 09/10/2012 14:24, D.M. Procida wrote: >>> What exactly is the point of a private method? Why or when would I want >>> to use one? > > In Python, using an underscore is simply a convention to note that a > method is private - it doesn't actually hide it

Re: Private methods

2012-10-09 Thread Robert Kern
On 10/9/12 2:59 PM, D.M. Procida wrote: Mark Lawrence wrote: On 09/10/2012 14:24, D.M. Procida wrote: What exactly is the point of a private method? Why or when would I want to use one? Daniele Hardly a Python question but using a search engine could have got you here, and rather faster :

Re: Private methods

2012-10-09 Thread Demian Brecht
On 12-10-09 06:59 AM, D.M. Procida wrote: In Python, using an underscore is simply a convention to note that a method is private - it doesn't actually hide it from other things - correct? Daniele A single underscore semantically means private. A double underscore will name mangle the functio

Re: Private methods

2012-10-09 Thread D.M. Procida
Mark Lawrence wrote: > On 09/10/2012 14:24, D.M. Procida wrote: > > What exactly is the point of a private method? Why or when would I want > > to use one? > > > > Daniele > > > > Hardly a Python question but using a search engine could have got you > here, and rather faster :) > http://stackov

Re: Private methods

2012-10-09 Thread Mark Lawrence
On 09/10/2012 14:24, D.M. Procida wrote: What exactly is the point of a private method? Why or when would I want to use one? Daniele Hardly a Python question but using a search engine could have got you here, and rather faster :) http://stackoverflow.com/questions/2620699/why-private-method