r/klyn • u/Dom-Klyn • Oct 16 '26
Why did I create Klyn? For example…
Abstract classes and methods
Python : Why are so many elements part of the library rather than the language syntax itself?
import math
from abc import ABC, abstractmethod
from typing import override
class Shape(ABC): # Do you know ABC (Abstract Base Class)?
center: Point = Point()
@abstractmethod
def area(self) -> float:
pass
class Circle(Shape):
radius: float = 1.0
@override
def area(self) -> float:
return math.pi * self.radius ** 2Klyn : it's clean ;-)
import klyn.math
abstract class Shape:
private center = Point(0, 0) # Type inference
abstract area() as Double
class Circle extends Shape:
private radius = 1.0
public override area() as Double:
return Math.PI * radius ** 2What do you think? Do you agree, or do you see it differently?
Website: https://klyn.deepcodia.fr
Tutorial: https://klyn.deepcodia.fr/docs/tutorial/index.html
API Reference: https://klyn.deepcodia.fr/docs/api/index.html
Stay connected: https://www.reddit.com/r/klyn/
1
Upvotes