Defining a method final
Emile van Sebille
emile at fenx.com
Tue Jun 11 09:01:30 EDT 2002
"Fabio Corneti" <fcorneti at libero.it> wrote in message
news:phmN8.36164$K4.893500 at twister2.libero.it...
> I would like to define a method for a class which has
> not to be overriden. Of course, since the developer of
> this project are two, this could be established by
> convention, but if the project will grow consistently
> another developer could override the method by mistake,
> causing unpleasant side effects.
>
Accepted practice is to use a single underscore for objects to be
considered private. This does not prevent their use, but strongly
signals that re-use ought not to be done.
>>> class Test:
... def _private(self): pass
...
HTH,
--
Emile van Sebille
emile at fenx.com
---------
More information about the Python-list
mailing list