3 ms·
Python showed what relaxed types could do. And we could go a long way as it turns out without types. But there are use cases for types, and even python admitt
by bb88 2y ago
Python showed what relaxed types could do. And we could go a long way as it turns out without types. But there are use cases for types, and even python admitted such when they added type annotations.
However, when I was a kid a would put a firecracker next to an object. I didn't bother running the scenario through a compiler to see if the object was of type Explodable() and had an explode() method that would be called.
- saghm 2y ago> However, when I was a kid a would put a firecracker next to an object. I didn't bother running the scenario through a compiler to see if the object was of type Explodable() and had an explode() method that would be called. Duck typing: if it quacks like a duck, and it explodes objects next to it, it's a firequacker
- cjfd 2y agoDuck typing. If it quacks like a duck and swims like a duck it might be a duck. But it might also be a nuclear submarine doing a duck impersonation. The question is whether you want a nuclear submarine in your pond.
- marcosdumay 2y agoThe philosophy of duck typing is very clear in that yes, you should accept a nuclear submarine in your pound. The problems are that you won't remember to do the same exact checks everywhere and document them.
- stuartaxelowen 2y agoPython showed that you can be wrong about your types and still build a successful product.
- yakshaving_jgt 2y agoUnless your product is a Boeing 737 MAX.