Preventing execution of a method

alex23 wuwei23 at gmail.com
Thu Dec 11 12:25:16 EST 2008


On Dec 12, 3:22 am, alex23 <wuwe... at gmail.com> wrote:
> On Dec 12, 2:35 am, rdmur... at bitdance.com 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