0

I'm beginner. In Delphi I can make private field in class: moving it to private section. So ClassVar.Field doesn't exist out of class.

In Python, if I make class

class CName:
  testname = 10

then testname can be accessed always. How can I make a field "private"?

Prog1020
  • 4,530
  • 8
  • 31
  • 65

1 Answers1

2

You can't!

Naming fields with two underscores will hide it (generate a new name) but you will always be able to access it. Try __testname = 10

erlc
  • 652
  • 1
  • 6
  • 11