Does python have generic methods like Java? If so could you refer to a site that explains it.
No. Python is not a statically typed language, so there is no need for them. Java generics only provide compile time type safety; they don't do anything at runtime. Python doesn't have any compile time type safety, so it wouldn't make sense to add generics to beef up the compile time type checks Python doesn't have.
A list, for example, is an untyped collection. There is no equivalent of distinguishing between List<Integer>
and List<String>
because a Python list can store any type of object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With