Mailing List Archive

Python type system
When I first started transitioning to Python as a Perl replacement, with my Java/C++ baggage, I thought Pythnon had some loosey-goosey type system. I thought int() and str() were casts, not constructors. I now realize Python has a great strong type system. Duck typing. If it walks like a duck, quacks like a duck, it?s probably a duck. (C++ added the auto keyword at some point to get analogous behavior).

Beyond Python, I?ve also found duck typing useful in real life. If it walks like a troll, quacks like a troll ?


--
https://mail.python.org/mailman/listinfo/python-list
Re: Python type system [ In reply to ]
On Tue, 28 Feb 2023 at 03:29, Weatherby,Gerard <gweatherby@uchc.edu> wrote:
> Beyond Python, I’ve also found duck typing useful in real life. If it walks like a troll, quacks like a troll …
>
... regenerates limbs like a troll...

ChrisA
--
https://mail.python.org/mailman/listinfo/python-list