Origin of double underscore convention?

Grant Edwards grant at nowhere.
Thu Jan 6 17:25:51 EST 2000


In article <Y96d4.1764$oF2.5206 at ozemail.com.au>, Jason Stokes wrote:

>I'm relatively new to Python.  This is possibly a dumb question, but
>I'm wondering about the double underscore convention to mark an inbuilt
>or internal method.  I find it pretty ugly and I'm wondering if it was
>chosen for any historical reason, eg analogy to another language.  

Some C compilers used to prefix all user-declared variables
with "_".  That way they would never collide with assembly
language variables as long as the assy lang didn't use variables
that started with "_".  

Or maybe it was the other way 'round...

Anyway, the custom for using prefixed "_" to simulate separate
namespaces has been around for many, many years.

-- 
Grant Edwards                   grante             Yow!  Yow! We're going to
                                  at               a new disco!
                               visi.com            



More information about the Python-list mailing list