Number of private variables in class

0 votes

Is there any way to know how many private variables are defined in the class?

Feb 13 in Python by Sanam
22 views

1 answer to this question.

0 votes

In Python, there is no existence of “Private” instance variables which cannot be accessed except inside an object. 

But, a convention is being followed by most Python code and coders i.e., a name prefixed with an underscore, For e.g. _name should be treated as a non-public part of the API or any Python code, whether it is a function, a method or a data member. 

answered Feb 13 by Prateek

Related Questions In Python

0 votes
1 answer

How can I reformat value_counts() analysis in Pandas for large number of columns?

If I were you, I'd do it ...READ MORE

answered Apr 17, 2018 in Python by anonymous
2,476 views
0 votes
2 answers

How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

answered Apr 2 in Python by anonymous
254 views
0 votes
1 answer

How do you get the logical xor of two variables in Python?

If you're already normalizing the inputs to ...READ MORE

answered May 29, 2018 in Python by ariaholic
• 7,340 points
3,706 views
0 votes
1 answer

Number of days between dates in Python

You can use the date module to ...READ MORE

answered May 30, 2018 in Python by Nietzsche's daemon
• 4,260 points
42 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 337 views
+4 votes
6 answers
0 votes
1 answer

What is the purpose of inner class in Python?

Advantages of inner class: Logical grouping of classes: ...READ MORE

answered Feb 7 in Python by SDeb
• 13,180 points
269 views
0 votes
2 answers

Python program to print occurrence of character in string

Try the below code inputString = input("Enter a ...READ MORE

answered Feb 26 in Python by Anubhav
• 160 points
1,146 views