From 0e3d06f36728281fb38e82ca14f16a9477dae330 Mon Sep 17 00:00:00 2001 From: OgarkovIA Date: Sun, 7 Dec 2025 16:30:36 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'TEMA9/report.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TEMA9/report.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/TEMA9/report.md b/TEMA9/report.md index 50c8464..2552733 100644 --- a/TEMA9/report.md +++ b/TEMA9/report.md @@ -6,8 +6,8 @@ Создание текстового файла `report.md` ## 2. Создание классов и их наследников -2.1. Создание автономного класса - +**2.1. Создание автономного класса** +```python class Class1: def zad_zn(self,znach): self.data=znach @@ -25,9 +25,9 @@ z2.otobrazh() z1.data='Новое значение атрибута у экз.1' z1.otobrazh() Новое значение атрибута у экз.1 - -2.2. Создание класса-наследника - +``` +**2.2. Создание класса-наследника** +```python class Class2(Class1): def otobrazh(self): print('значение=',self.data) @@ -47,9 +47,9 @@ z3.otobrazh() z1.otobrazh() Новое значение атрибута у экз.1 del z1,z2,z3 - +``` ## 3. Использование классов, содержащихся в модулях - +```python from Mod3 import Class1 z4=Class1() z4.otobrazh() @@ -72,9 +72,9 @@ z4.otobrazh() значение= Класс из модуля Mod3.otobrazh('Объект') значение объекта= Объект - +``` ## 4. Использование специальных методов - +```python class Class3(Class2): def __init__(self, znach): self.data = znach @@ -92,9 +92,9 @@ z6.otobrazh() z6.zad_dr_zn(3) z6.otobrazh() значение= abcdefabcdefabcdef - +``` ## 5. Присоединение атрибутов к классу - +```python dir(Class3) ['__add__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__firstlineno__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__static_attributes__', '__str__', '__subclasshook__', '__weakref__', 'otobrazh', 'zad_dr_zn', 'zad_zn'] Class3.fio = 'Иванов И.И.' @@ -112,9 +112,9 @@ dir(z7) ['__add__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__firstlineno__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__static_attributes__', '__str__', '__subclasshook__', '__weakref__', 'data', 'fio', 'otobrazh', 'rozden', 'zad_dr_zn', 'zad_zn'] dir(Class3) ['__add__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__firstlineno__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__static_attributes__', '__str__', '__subclasshook__', '__weakref__', 'fio', 'otobrazh', 'zad_dr_zn', 'zad_zn'] - +``` ## 6. Выявление родительских классов - +```python Class3.__bases__ #Родительский класс (,) Class2.__bases__ @@ -127,9 +127,9 @@ Class3.__mro__ #Вся цепочка наследования ZeroDivisionError.__mro__ (, , , , ) - +``` ## 7. Создание свойства класса - +```python example=Class4(12) example.svojstvo 12 @@ -138,9 +138,9 @@ print(example.svojstvo) 45 del example.svojstvo example.svojstvo - +``` ## 8. - +```python class SAU: def __init__(self,zn_param): self.param=zn_param @@ -178,3 +178,4 @@ for xt in xx: # Прохождение входного сигнала import pylab pylab.plot(yt) pylab.show() +```