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"?

1
  • 1
    There are no private variables in Python Commented Oct 10, 2013 at 12:02

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.