[Tutor] underscore function

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Apr 13 09:36:15 CEST 2006


[linda.s]

| I got a sample code and found some
| function definition looks like def _abc
| There is one underscore before the function name "abc",
| what does it mean?

It's a convention which indicates to any user of the code
(including the original developer) that the function is
not intended to be used externally to the module (or
class, or whatever) in which it is defined.

Note that this is a convention only: there's absolutely
nothing to stop you calling _abc (args) within your code.
But the original developer intended that this function
be an implementation detail that might change, or be
refactored, or which assumes a particular state of
data which might not obtain when called from elsewhere,
etc.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Tutor mailing list