Skip to content

Commit

Permalink
[test project] class in function, classes and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Nov 12, 2024
1 parent 6c29594 commit c21499d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions resources/examples/project1/src/moduleWithClasses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
def function_with_class_inside():
class ClassInFunction:
def __init__(self):
self.varInClassInFunction = False

c = ClassInFunction()
return c.__dict__


print(function_with_class_inside())


class ClassWithClasses:
class ClassInClass:
def __init__(self):
self.varInClassInClass = 3

print(ClassInClass())

def __init__(self):
class ClassInMethod:
def __init__(self):
self.varInClassInMethod = 5

print(ClassInMethod().varInClassInMethod)
self.varInClassWithClasses = 4


c = ClassWithClasses()
print(c.__dict__)
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
class ClassInSubpackage:

def __init__(self):
self.varInClassInSubpackage = True
self.varInClassInSubpackage = True

0 comments on commit c21499d

Please sign in to comment.