3 ms·
Shouldn't the title be "with static typing?" Python has strong types. It's just that it checks them at runtime, not before. If you don't use MyPy or similar,
by NateEag 6y ago
Shouldn't the title be "with static typing?"
Python has strong types. It's just that it checks them at runtime, not before.
If you don't use MyPy or similar, anyway.
- tomrod 6y agoThat may be the case. I apologize, I am a tinkerer programmer and the semantics are sometimes lost on me.
- cheez 6y agoPython's new typing is so useful. mypy works most of the time. Sometimes misses some things. Running in --strict is a bother (no one is going to annotate __init__ returning None thanks...)
- ghostwriter 6y agoyou don't have to https://github.com/python/mypy/pull/5677 https://github.com/python/mypy/pull/5677
- cheez 6y agoWeird... Looks like you're right. Edit: aha, looks like this is the case under which it happens: class Testing123: def __init__(self): self.blah = whatever()
- phoe-krk 6y agoIt should. It's the same as with Common Lisp, which is strongly dynamically typed. Strongly, because it is impossible to confuse a given value's type via some sort of implicit casting; dynamically, since types are checked at runtime.
- guenthert 6y agoI think in modern parlance Common Lisp uses a gradually typed system, at least some implementations. Common Lisp allows for type inference and some compilers use that to various degree, as well as to declare a type of a given symbol (or the signature of a function). Depending on compiler and optimization settings, that information is then used to generate optimized code, much like a compiler for a (weakly) statically typed language would or detect mismatches. SBCL is probably one of the most advanced Common Lisp compilers in this regard.
- phoe-krk 6y agoSure, that's the case in SBCL - the type inference engine in it is rather advanced; with type declarations here and there (which are capable of turning Common Lisp into a weakly statically typed language), they are capable of type-optimizing a lot of code. It also generates warnings in case type mismatches are detected at compile-time.