0

Python is not providing access specifiers inside the classes . Is there any way to mimic the features of private functions inside python classes like other programming languages like ruby and java do ?

yprez
  • 14,854
  • 11
  • 55
  • 70
  • In general, anobject is considered private if it is prefixed with underscore (double for function) like this: `_private_var` or `__private_func`. Read more here: http://stackoverflow.com/questions/1301346/the-meaning-of-a-single-and-a-double-underscore-before-an-object-name-in-python – Reut Sharabani Dec 14 '14 at 13:49
  • But note that they're not really private.. – Maroun Dec 14 '14 at 13:50
  • But even though we specify __ the functionality of access specifiers is not provided . Is there any way to implement functionality using decorators or properties ? – samvaran kashyap Dec 14 '14 at 13:53
  • really python thought says you shouldnt really need or want private variables ... they provide some conventions but no such thing as truly private variables – Joran Beasley Dec 14 '14 at 18:39

0 Answers0