What use of these _ prefix members?

Steven D'Aprano steve at pearwood.info
Sun Jan 10 13:03:26 EST 2016


On Mon, 11 Jan 2016 04:55 am, Robert wrote:

> Some online tutorials tell me '_' prefix is a kind of convention of
> private members. 

Correct. Not just private members, but private *anything*.

Any time you see anything starting with a single underscore, whether it is a
module, class, method, attribute or variable, you can assume that it is
private (unless explicitly documented otherwise) and avoid it.



-- 
Steven




More information about the Python-list mailing list