diff --git a/guide/english/python/class/index.md b/guide/english/python/class/index.md index 70108644b9b..2e1c6e99698 100644 --- a/guide/english/python/class/index.md +++ b/guide/english/python/class/index.md @@ -24,9 +24,9 @@ The simplest form of class definition looks like this: ```python class ClassName: - ... - ... - ... + # ... + # ... + # ... ``` @@ -74,7 +74,7 @@ class Complex: def __init__(self, realpart, imagpart): self.r = realpart self.i = imagpart - ... + # ... x = Complex(3.0, -4.5) >>> x.r, x.i @@ -86,16 +86,14 @@ x = Complex(3.0, -4.5) Every programming language which follows OOPs (Object Oriented Programming) concept has some mechanism of data hiding.In python if some variable needs to be hidden from the outside world we use the concept of private variables by using `__` before he variable name. for example: -``` +```python class Foo: def __init__(self): self.__privatenum = 3011 - -Now if we try to access __privatenum outside the class we will get error: +# Now if we try to access __privatenum outside the class we will get error: x = Foo() x.__privatenum # gives following error : 'Foo' object has no attribute '__privatenum' - ``` ## Simple class and Object Implementation