Zwischen Commit

This commit is contained in:
Olli Graf
2024-11-09 10:21:36 +01:00
parent fec0969d7f
commit ea14cde427
3 changed files with 29 additions and 0 deletions

1
gettattr/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
__pycache__

19
gettattr/Kreis_getattr.py Normal file
View File

@@ -0,0 +1,19 @@
from math import pi as pi
class Kreis_getattr:
def __init__(self, radius):
self.radius = radius
self.operators ={
'durchmesser': lambda x: self.radius * 2,
'umfang': lambda x: self.durchmesser * pi,
'flaeche': lambda x: self.radius**2 *pi
}
def __getattr__(self, name):
if name not in self.operators:
raise TypeError(f'unbekannte Operation {name}')
return self.operators[name](0)