"Secure" access in Python - how?

I would like to create a class hierarchy in Python 3.2 with “secure” access: members of the base class will be in scope only for derived classes, but not “public”.

The double underscore makes the member 'private', one underscore indicates a warning, but the member remains "public." What (if any ...) is the correct syntax to denote a "protected" element.

+5
source share
2 answers

Python membership admission works by negotiation and contract, rather than strength.

, , , , _xxx, , () .

+8

'private' ++ Java - Python . , , " ", , , , , / . , 'private' ( ) -.

, 'private' - , : - , - ,

, __name , , . - , , - .

- "" Python - , , (, , , , , ), Python - . ", ", , , , , .

+3

All Articles