# kern vs Python

> An honest comparison of kern and Python. Python has the largest ecosystem and fastest prototyping. kern catches GDPR violations at compile time.

Source: https://kern-lang.eu/compare/python

Python’s readability is why kern’s syntax looks like Python. This is intentional and honest. kern is for backend services where GDPR compliance, performance, and deployment simplicity matter.

## Where each language wins

kern learned from Python. It would be dishonest not to acknowledge everything Python does well.

### Python

The world’s most accessible language

- Enormous ecosystem: NumPy, pandas, scikit-learn, TensorFlow, PyTorch
- Fastest prototyping of any language: REPL to production in hours
- Data science and ML: nothing comes close
- Every university teaches it: the largest developer community in the world
- Jupyter notebooks: unmatched for exploration and visualization
- Mature web frameworks: Django, Flask, FastAPI

### kern

Compliance, speed, and deployment

- GDPR violations detected at compile time: not in production
- 5-10x faster for HTTP workloads: compiled, not interpreted
- No GIL: real parallelism without workarounds
- Single binary deployment: no virtualenv, no pip, no runtime
- Type safety by default: not optional like Python type hints
- European governance and infrastructure: no American dependencies

## For backend workloads

Python is great for scripting and ML. For HTTP services in production, the performance gap is significant.

Faster HTTP response times

5-10x

Binary to deploy (no virtualenv)

1

Runtime dependencies needed

0

## The violation Python ships silently

This Python code compiles, runs, ships to production, and silently violates GDPR in three different ways. kern catches all three at compile time.

#### The violation Python ships silently

Python

```
# Python: GDPR violation ships silently to production
def process_user(user):
    log.info(f"Processing {user.email}")  # PII in logs: GDPR violation
    analytics.identify(user.email)         # PII in analytics: GDPR violation
    send_to_ml_pipeline(user.email)        # PII to ML: GDPR violation
    # Python: all valid, compiles, ships, you get fined
```

kern

```
# kern: every access is tracked and requires justification
fn process_user(user: User):
    log.info("Processing user " + str(user.id))   # ID only: OK
    analytics.identify(str(user.id))               # ID only: OK

    check_consent("process", consent)
    send_confirmation(user.email_plain)  # OK: consent verified
```

#### What the compiler actually tells you

Python

```
# Python: this is a string. No protection.
def send_email(user):
    analytics.track(user.email)  # personal data sent to analytics
    send(user.email, "Welcome!")
    # No error. No warning. Ships to production.
```

kern

```
fn send_email(user: User):
    analytics.track(user.email.value)
    # ERROR E0302: PersonalData<str> cannot reach a sink
    # that does not declare PersonalData
    # Hint: declare the parameter PersonalData, or redact first
```

## Python vs kern at a glance

__Python vs kern at a glance__
| Feature           | Python                   | kern                |
| ----------------- | ------------------------ | ------------------- |
| Readable syntax   | Yes                      | Yes (Python-like)   |
| Type safety       | Optional hints           | Enforced            |
| Null safety       | No                       | Yes                 |
| GDPR built in     | No                       | Yes: compile time   |
| Single binary     | No: virtualenv + runtime | Yes                 |
| Concurrency       | GIL                      | Native async        |
| HTTP performance  | Baseline                 | 5-10x faster        |
| AI native stdlib  | No (pip install)         | Yes                 |
| Container native  | No                       | Yes                 |
| European governed | No: PSF (USA)            | Yes                 |
| Learning curve    | Low                      | Low                 |
| Error handling    | Exceptions               | Values (? operator) |

## When you should stay with Python

If you are a data scientist who needs NumPy and pandas, use Python. kern is not trying to replace Python for data science or machine learning research. kern is for teams building backend APIs and services where GDPR compliance, performance, and deployment simplicity matter more than access to the NumPy ecosystem.

## Ready to try kern?

If you love Python’s readability but need compiled speed, real type safety, and GDPR enforcement that actually works: kern was designed for you.

[Get started](https://kern-lang.eu/get-started) [Open the playground](https://kern-lang.eu/playground)
