Python has optional type annotations. There are batch tools (e.g., MyPy) to do type analysis and IDE's also provide help. Example:
def greeting(name: str) -> str:
return 'Hello ' + name
I found Python to be an enormous improvement over Perl for writing the kinds of things I used to write in Perl, with the Perl book at my side. I currently make my living working on Python for microcontrollers. Neverthless, I am fond of type checking too, and if I were writing a large Python system, I would use type annotations.
I have used BCPL too, in the 70's, and we achieved some measure of type safety by careful naming.
Dan H.
On 8/3/23 10:19, Bakul Shah wrote:
I have not heard such horror stories about Common Lisp (or may be I have forgotten them!). My impression is that python doesn't quite have the kind of {meta,}programming tools Common Lisp has. CL has been used for large critical programs. Perhaps Von Rossum had more experience with statically typed languages than Lisp (because -- pure speculation here -- if he had used CL enough, he would never have designed python :-)
On Aug 3, 2023, at 1:32 AM, Rob Pike <robpike@gmail.com> wrote:
I once inherited maintenance of a critical piece of infrastructure written in exquisitely well written, tested, and documented Python. I mean it, it was really really good.
It crashed about once a week and I had to fix it over and over because in those exponentially vast combinations of paths through the code would arise yet another way to turn a string into a list, or something analogous. It was hell.
Critical code needs static typing.
-rob
On Thu, Aug 3, 2023 at 1:56 PM Bakul Shah <bakul@iitbombay.org> wrote:
python can certainly implement tail call optimization (TCO). Pretty much any language can implement TCO but for some reason people think such programs are harder to debug (and yet they don't similarly complain about loops!). The beauty of Scheme was that it *mandated* tail recursion.
> On Aug 2, 2023, at 8:24 PM, George Michaelson <ggm@algebras.org> wrote:
>
> Tail recursion not lazy eval.
>
> I wish words meant what I meant "inside" when I think them, not
> "outside" what they mean when I write them.