Preventing execution of a method

alex23 wuwei23 at
Thu Dec 11 18:25:16 CET 2008

On Dec 12, 3:22 am, alex23 <wuwe... at> wrote:
> On Dec 12, 2:35 am, rdmur... at wrote:
> > There is, however, also the possibility of prefixing the method name
> > with '__'.  The invokes 'name mangling', which makes it more difficult
> > (though not impossible, the idea is to avoid accidents) for the method
> > to be called from outside the class.
> That only works for methods, it has no effect on functions or classes
> within modules:

And of course -now- I realise that the OP was asking for protecting
methods. Please disregard my last post :)

More information about the Python-list mailing list