[Tutor] single underscore convention?

Sean 'Shaleh' Perry shalehperry@home.com
Wed, 30 May 2001 08:05:32 -0700 (PDT)


> 
>       _def _test1():
>               print animals[0]    # print Mammals
>               animals.printtree()
> 
>       blah blah blah
> 
>       _test1()
> 
> Why the underscore, is this a convention?
> 

Names with a leading underscore are a convention used for denoting an item is
for internal use only and not meant to be exported.  When used as members of a
class, the _ denotes intentions for this to be a private member.

__foo is typically reserved for python's use.  __foo__ implies an internal
language interface, like __init__().