-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclasses_test.py
46 lines (32 loc) · 1.13 KB
/
classes_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# This is a sample Python script.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import string
import random
def gen_string(nr: int = 5) -> str:
# return ''.join(random.choice(string.ascii_lowercase) for i in range(nr))
return ''.join(random.choices(string.ascii_lowercase, k=nr))
class DummyFTP:
def __init__(self, name):
self.name = name
def dummy_cwd(self):
print(' '.join(self.name for i in range(3)))
class Client:
# daca e definit aici in toate instantele copil are aceiasi valoare
copil = DummyFTP(gen_string())
def __init__(self, name):
self.name = name
# daca e definit aici copil este diferit in fiecare instanta
# self.copil = DummyFTP(gen_string())
def what_name(self):
# print(self.copil.name)
self.copil.dummy_cwd()
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
c1 = Client('nume1')
c2 = Client('nume2')
c1.what_name()
c1.copil = None
print(Client.__dict__)
print(c1.__dict__)
# print(c2.__dict__)
# c2.what_name()