Why prefix with an underscore?

Max M maxm at mxm.dk
Tue Feb 12 08:49:40 EST 2002


MDK wrote:


> I am wondering why I see some people's code with function definitions
> prefixed with an underscore.
> 
> For example:
> 
> def _myfunct(foo):
> 
> Does this mean something to the code or is it for some other reason?
> 

It is a convention to tell other programmers that they don't want other 
programmers to call those functions.

A hidden method of an object, only meant to be used by the object itself.

regards Max M




More information about the Python-list mailing list