Skip to main content
r/Python icon

r/Python pythonLogo pythonLogo

Pycon US 2025 starts next week!

members
online

A Python tool to diagnose how functions behave when inputs are missing (None / NaN) A Python tool to diagnose how functions behave when inputs are missing (None / NaN)
Showcase

What My Project Does

I built a small experimental Python tool called doubt that helps diagnose how functions behave when parts of their inputs are missing. I encountered this issue in my day to day data science work. We always wanted to know how a piece of code/function will behave in case of missing data(NaN usually) e.g. a function to calculate average of values in a list. Think of any business KPi which gets affected by missing data.

The tool works by:

  • injecting missing values (e.g. None, NaN, pd.NA) into function inputs one at a time

  • re-running the function against a baseline execution

  • classifying the outcome as:

    • crash

    • silent output change

    • type change

    • no impact

The intent is not to replace unit tests, but to act as a diagnostic lens to identify where functions make implicit assumptions about data completeness and where defensive checks or validation might be needed.


Target Audience

This is primarily aimed at:

  • developers working with data pipelines, analytics, or ETL code

  • people dealing with real-world, messy data where missingness is common

  • early-stage debugging and code hardening rather than production enforcement

It’s currently best suited for relatively pure or low-side-effect functions and small to medium inputs.
The project is early-stage and experimental, and not yet intended as a drop-in production dependency.


Comparison

Compared to existing approaches:

  • Unit tests require you to anticipate missing-data cases in advance; doubt explores missingness sensitivity automatically.

  • Property-based testing (e.g. Hypothesis) can generate missing values, but requires explicit strategy and property definitions; doubt focuses specifically on mapping missing-input impact without needing formal invariants.

  • Fuzzing / mutation testing typically perturbs code or arbitrary inputs, whereas doubt is narrowly scoped to data missingness, which is a common real-world failure mode in data-heavy systems.


Example

from doubt import doubt

@doubt()
def total(values):
    return sum(values)

total.check([1, 2, 3])

Installation

The package is not on PyPI yet. Install directly from GitHub:

pip install git+https://github.com/RoyAalekh/doubt.git

Repository: https://github.com/RoyAalekh/doubt


This is an early prototype and I’m mainly looking for feedback on:

  • practical usefulness

  • noise / false positives

  • where this fits (or doesn’t) alongside existing testing approaches


Stop guessing what you’re looking at and explore informed. Galaxy S25 Ultra with Google Gemini answers questions and guides you in real time.
media poster


Is anyone else choosing not to use AI for programming? Is anyone else choosing not to use AI for programming?
Discussion

For the time being, I have chosen not to use generative AI tools for programming, both at work and for hobby projects. I imagine that this puts me in the minority, but I'd love to hear from others who have a similar approach.

These are my main reasons for avoiding AI for the time being:

  • I imagine that, if I made AI a central component of my workflow, my own ability to write and debug code might start to fade away. I think this risk outweighs the possible (but not guaranteed) time-saving benefits of AI.

  • AI models might inadvertently spit out large copies of copyleft code; thus, if I incorporated these into my programs, I might then need to release the entire program under a similar copyleft license. This would be frustrating for hobby projects and a potential nightmare for professional ones.

  • I find the experience of writing my own code very fulfilling, and I imagine that using AI might take some of that fulfillment away.

  • LLMs rely on huge amounts of human-generated code and text in order to produce their output. Thus, even if these tools become ubiquitous, I think there will always be a need (and demand) for programmers who can write code without AI--both for training models and for fixing those models' mistakes.

  • As Ed Zitron has pointed out, generative AI tools are losing tons of money at the moment, so in order to survive, they will most likely need to steeply increase their rates or offer a worse experience. This would be yet another reason not to rely on them in the first place. (On a related note, I try to use free and open-source tools as much as possible in order to avoid getting locked into proprietary vendors' products. This gives me another reason to avoid generative AI tools, as most, if not all of them, don't appear to fall into the FOSS category.)*

  • Unlike calculators, compilers, interpreters, etc., generative AI tools are non-deterministic. If I can't count on them to produce the exact same output given the exact same input, I don't want to make them a central part of my workflow.**

I am fortunate to work in a setting where the choice to use AI is totally optional. If my supervisor ever required me to use AI, I would most likely start to do so--as having a job is more important to me than maintaining a particular approach. However, even then, I think the time I spent learning and writing Python without AI would be well worth it--as, in order to evaluate the code AI spits out, it is very helpful, and perhaps crucial, to know how to write that same code yourself. (And I would continue to use an AI-free approach for my own hobby projects.)

*A commenter noted that at least one LLM can run on your own device. This would make the potential cost issue less worrisome for users, but it does call into question whether the billions of dollars being poured into data centers will really pay off for AI companies and the investors funding them.

**The same commenter pointed out that you can configure gen AI tools to always provide the same output given a certain input, which contradicts my determinism argument. However, it's fair to say that these tools are still less predictable than calculators, compilers, etc. And I think it's this lack of predictability that I was trying to get at in my post.


Democratizing Python: a transpiler for non‑English communities (and for kids) Democratizing Python: a transpiler for non‑English communities (and for kids)
Discussion

A few months ago, an 11‑year‑old in my family asked me what I do for work. I explained programming, and he immediately wanted to try it. But Python is full of English keywords, which makes it harder for kids who don’t speak English yet.

So I built multilang-python: a small transpiler that lets you write Python in your own language (French, German, Spanish… even local languages like Arabic, Ewe, Mina and so on). It then translates everything back into normal Python and runs.

# multilang-python: fr
fonction calculer_mon_age(annee_naissance):
    age = 2025 - annee_naissance
    retourner age

annee = saisir("Entrez votre année de naissance : ")
age = calculer_mon_age(entier(annee))
afficher(f"Vous avez {age} ans.")

becomes standard Python with def, return, input, print.

🎯 Goal: make coding more accessible for kids and beginners who don’t speak English.

Repo: multilang-python

Note : You can add your own dialect if you want...

How do u think this can help in your community ?