Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
553,812 changes: 553,812 additions & 0 deletions 08thOct

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions 17thDec/classmethod.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Naga():
total_instances = 0
def __init__(self):
self.add_instances()

@classmethod
def add_instances(cls):
cls.total_instances += 1

def print_total(self):
print("The total instances are {} " .format(self.total_instances))

class Raj(Naga):
total_instances = 0
def __init__(self):
super().__init__()

class lakshmi(Raj, Naga):
pass
11 changes: 11 additions & 0 deletions 17thDec/decorator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def balaji(naga):
def wrapper(*args):
print("Function modified")
return naga(*args)
return wrapper

@balaji
def naga(x, y):
print( x + y)

naga(10, 20)
5 changes: 5 additions & 0 deletions 17thDec/ex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Naga():
__slots__ = [ 'x', 'y', 'z' ]
def __init__(self):
for x in self.__slots__:
setattr(self, x, x)
20 changes: 20 additions & 0 deletions 17thDec/private.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class Naga():
__balaji = "private"
def __init__(self, name):
self.name = name
self.__private_method()
@classmethod
def test_mymthod(cls):
print(" i am calling from {} " .format(cls))
@staticmethod
def test_mystatic():
print("i am from Static method")
def print_private(self):
print(self.__balaji)
def __private_method(self):
print("hi i am called from private method")
def _protected_method(self):
print("hi i am called from protected")
def call_my_private(self):
self.__private_method()

Loading