ProgrammerHumor

isAnyoneElseConcernedWithHowManyThingsPydanticIsInTheseDays

isAnyoneElseConcernedWithHowManyThingsPydanticIsInTheseDays
https://i.redd.it/yvfyqyxikcdf1.png
Reddit

Discussion

Snoo_4779

Just piss off Microsoft with Python and they will make Typethon

10 hours ago
Sculptor_of_man

Just make Typethon.

10 hours ago
philippefutureboy

If it becomes so widespread, we might see a direct integration into Python in a future release, like how we got dataclasses

9 hours ago
Not-the-best-name
:py:

I mean, it should just be TypedDataClasses. But I think if you look at the Pydantic docs you will see why it can't just go into the standard library, Pydantic type coercion and exceptions are probably as random sounding as JavaScript

7 hours ago
-domi-

"First time?"

~JS users who've had TypeScript rammed down their throats for over a decade.

9 hours ago
rover_G
:c::rust::ts::py::r::spring:

Ehh but there are lots of type validation libraries in typical JS fashion

9 hours ago
-domi-

Are there none other than Pydantic for Python?

9 hours ago
watchYourCache

there's msgspec and attrs

2 hours ago
rover_G
:c::rust::ts::py::r::spring:

It’s 2025. Type validation and serde should be built into the language.

9 hours ago
IMightDeleteMe

I don't know, seems like if you want strict typing you just don't use Python.

7 hours ago
skwyckl
:elixir-vertical_4::py::r::js:

You really can’t choose in certain fields though, e.g. data science. What am I gonna use? Scala?

4 hours ago
Duckliffe

R

4 hours ago
skwyckl
:elixir-vertical_4::py::r::js:

R is literally one of the worst language out there and thank God it's getting squeezed out from the market by Python and Julia (I know because I use it)

4 hours ago
gregorydgraham

It absolutely is a mess but it’s getting more traction not less. Sorry.

No, I don’t use it, I’m just vaguely interested in it for non-professional reasons

3 hours ago
skwyckl
:elixir-vertical_4::py::r::js:

... more traction because of its massive GIS and scientific publishing ecosystem (the reasons I also use it for), but outside of academia I very rarely see it being used.

3 hours ago
gregorydgraham

Sure but it’s gone a long way from an experimental stats teaching language in Auckland to being massive in GIS and science worldwide and it’s still rising

2 hours ago
LexaAstarof
:py::rust::c::j:

It's not really extravagant to want your program to be strict for some of its inputs.

Python is strongly typed, so in some cases you want to ensure you won't run into type issues at run time that would be due to user/external data. And internally keep it flexible/dynamic.

6 hours ago
MinosAristos
:py: :ts: :cs:

VSCode installs Pylint with the default Python extension pack which makes the dev experience like a cleaner version of Typescript.

3 hours ago
ganjlord

It can be nice to have both, I like having separate components that talk to each other via heavily validated pydantic models. This way, if any one component isn't doing its job, it fails loudly and quickly at this point of communication.

6 hours ago
pentesticals

So why is typescript so popular then? People want strict types with JavaScript so bolted them on during coding time. Most devs don’t even know that at runtime it’s still completely typeless.

58 minutes ago
ChalkyChalkson

Honestly I think it's a feature of the language. Python wants to keep the barrier to entry as low as possible and really thrives on people abusing code in ways it wasn't intended for. For example, many functions that just implement specific maths will work on floats, ints, numpy arrays, torch tensors, tf tensors, jnp arrays, awkward arrays, pandas data frames and dask dataframes. If python was too strongly typed you wouldn't be able to use code someone has written thinking it's for numpy on your jax arrays, or even worse would cast your jax array to numpy

3 hours ago
Duke0200 OP

Facts. So many Python scripts over the years have failed in the middle of execution for some stupid type reason.

9 hours ago
abolista

Skill issue.

3 hours ago
raimondi1337

No, it shouldn't, because then it will end up like TS where it's only a paint job on top and I in spend half my time writing boilerplate that doesn't even actually reduce the number of bugs in the product.

6 hours ago
dr-christoph

having to deal with typing in python is such a pain in the ass when you are used to real statically typed languages

6 hours ago
omega1612
:hsk:

For me the worst part is that sometimes you can hit a case in which the type checker chooses to say bye without telling you. So, you trust that you haven't committed a mistake until it blows your face.

54 minutes ago
empwilli

lol, wtf. I always See people complaining about typing in Python while there are proper tools and solutions. Would it been better If typing hadn't been an afterthought? Defenitely. But the Status quo IS really good. (Except for the case where you have dependencies that have no proper types...)

However, this is not what pydantic addresses. Pydantic actually uses the flexibility and reflection abilities of Python to provide annotations and Checks that would be Impossible in other strictly typed languages like C++ out of the box.

6 hours ago
juklwrochnowy

Wait, can't you already static type any variable and argument if you wish?

2 hours ago
cherrycode420

Yes, yes you can! And for 99% of cases, you don't even need the typing package (which is btw part of the standard installation).

This meme is just nonsense. if i'm forced to use python, i use pydantic to easily "validate" that "unstructured" data i received via a post request or that has been read from a file is what i expect it to be, structurally 🤔

1 hour ago
juklwrochnowy

I only just started learning python, what does the typing package do?

1 hour ago
tehtris
:py::lua::bash::

I fucking held off for sooooo long to even bother to learn typing in python. And now I love it and kinda still fucking hate it. Mypy can fuck right off tho. We have that in one of our git actions and fuck mypy to hell.

8 hours ago
Itsthejoker
:py::js:

Mypy is literally the worst. So many hours spent fighting inane and impossible errors

7 hours ago
Not-the-best-name
:py:

The problem is our OCD. If you write a new simple function, please, type it. If you tackle an old Django app, please don't try and make the types work.

7 hours ago
steve-wicks

HAHAHA LOL

6 hours ago
x3bla
:j::py:

If you want strict typing... Why are you usin python?

3 hours ago
Life-Ad1409
:js::c::rust::py:

I feel like the point of Python is to be simple and easy to do things with it. Adding types feels a bit counterintuitive to making a simple language, and this is coming from someone who likes typed languages

6 hours ago
skwyckl
:elixir-vertical_4::py::r::js:

If types give you the feeling something is difficult, then the person should not be a programmer. How can one even write code without knowing all the time what type a certain variable is supposed to be, is beyond me. Hence why I use strict type checking when writing Python, but not all libraries have good type support, sadly.

4 hours ago
ganjlord

It's nice to have type checking sometimes, for example when pulling data from an API or for communication between subsystems. Adding this functionality to the standard library wouldn't fundamentally change the language, it's just another tool in the toolbox.

6 hours ago
Wertbon1789

But... Python has types? What are you talking about?

It's just about static typing and that would make stuff easier actually as you don't have to check stuff manually at runtime. Would be kinda simple, just use the type hints, and if they don't match, just abort the initial compilation step. Just make it opt-in and everything's fine. Dynamic typing just doesn't reflect how people actually use the language, because Python isn't made for beginners, no language is, Python is used quite a bit in environments which would totally benefit from having static type checking.

3 hours ago
Darkstar_111

Java people writing Python.

4 hours ago
Ok-Nectarine-2195

Lol, Python pulling out that Draw 25 card rather than committing to static typing is such a mood. Can relate, sometimes adding that type-hinting feels like overcommitting to a relationship 😂 #JustPythonThings

9 hours ago
TrackLabs

ok LLM

6 hours ago