Does underscore has any special built-in meaningin Python ?
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Thu Jul 30 07:40:05 EDT 2009
Ben Finney a écrit :
> dandi kain <dandi.kain at gmail.com> writes:
>
>> What is the functionality of __ or _ , leading or trailing an object ,
>> class ot function ?
<OP>
Please note that in Python, classes and functions are objects too. But
anyway, these underscores are part of *identifiers*, not objects
themselves !-)
</OP>
> foo Ordinary name, part of public interface
> _foo Ordinary name, part of internal-only interface
> __foo Ordinary name, but will be mangled (this style used rarely)
> __foo__ Name which is used in a special way by Python
And FWIW:
foo_ When you want to use a reserved name for identifier (ie:
'class_' , 'or_', 'and_' etc)
More information about the Python-list
mailing list