basedmypy
basedmypy copied to clipboard
Variables `Final` by default (`mutable` / `var`)
a = 1
a = 2 # should be an error imo
a: var = 1
a = 2 # yeah, that's ok
mut? what is this, rust?
mut? what is this, rust?
good point, DetachHead said that mutable would be better, as it would scare people off from using it :DDDDD
what about:
a: mutable = [1,2,3]
a = [] # error
a[0] = 2 # ok
b: var = [1,2,3]
b = [] # ok
b[0] = 2 # error
c: var[mutable] = [1,2,3]
c = [] # ok
c[0] = 2 # ok
https://github.com/KotlinIsland/basedmypy/issues/45
This issue has a few examples, but not much explanation.
- Is this proposing a change to python itself, or just requiring every variable to have a type annotation?
- Is it trying to solve a particular issue (eg. in the first example is
a's typeLiteral[1]orint?) - What are
varandmutable? new types? - Is #189 a duplicate of this issue?
- Is this proposing a change to python itself, or just requiring every variable to have a type annotation?
This is only a feature within basedmypy.
- Is it trying to solve a particular issue (eg. in the first example is
a's typeLiteral[1]orint?)
It's solving the issue of reassignable variables being the default option
- What are
varandmutable? new types?
Potentially
- Is #189 a duplicate of this issue?
Similar, but is referring to final and is unrelated to Final
Similar, but is referring to
finaland is unrelated toFinal
what is final
So this issue is for variables, #189 is for methods?