KotlinIsland / basedmypy

Based Python static type checker with baseline, sane default settings and based typing features
Other
134 stars 4 forks source link

disable promotions #167

Open KotlinIsland opened 2 years ago

KotlinIsland commented 2 years ago

make float not act like float | int (and complex act like complex | float) , and bytes not act like bytes | memoryview | bytearray

we can still infer float | int though:

a = 1
reveal_type(a) # float | int

will support configuration per module, to preserve compatibility:

from thirdparty import some_float
reveal_type(some_float) # float | int
jorenham commented 1 week ago

I currently always use (at least) the following (undocumented) settings in vanilla mypy:

disable_bytearray_promotion = true
disable_memoryview_promotion = true

so how about something like:

disable_int_promotion = true
disable_float_promotion = true