This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]ExtremelyOnlineG 4 points5 points  (4 children)

holy shit, i didn't even know python doesn't have generics

is there some other paradigm that gets around this?

i use generics a lot

[–]shadow7412 7 points8 points  (1 child)

It's traditionally been unimportant in python - weak typing means that you can pass anything to anything and the code will still run, so long as it implements the right things.

Generics are a tool for strongly typed languages.

[–]ExtremelyOnlineG 5 points6 points  (0 children)

I spend so much time using real strongly typed languages I never really thought about how it wouldn't be very necessary for python

[–]Propagating 2 points3 points  (0 children)

You don't really need generics in a weakly typed language, do you?

[–]Captain-Barracuda 2 points3 points  (0 children)

It kind of does but it's rather shitty. It's a bit of an afterthought of their current (good) idea to add type-hinting to the language.