KotlinIsland
KotlinIsland
Explicit `Any` is bad imo(and implicit `Any` is 100x worse), because it makes the inner of the function unchecked, when it doesn't need to be. Also I always enable all...
```py T = TypeVar("T", bound=int) class Foo(Generic[T]): a: T def foo(f: Foo[Any]): f.a = "AMONGUS😳" ```
Sorry for using Kotlin, it's just easier to write for me. ```kt var aList: List? = null fun foo(someList: List) { aList = someList // error! } ``` If you...
Thanks for the response! > Most of the ideas you propose here were explicitly discussed during original PEPs I do understand why there's limitations like that, I'm just painting broad...
Thanks for the response! I really only have one proposal, 'type contexts' and those contexts having their own syntax. The examples are just demonstrating the consequences of the current design....
> Not to crush people's hopes, but the SC has explicitly declared that they _don't_ want types to use dedicated syntax -- whatever is valid in an annotation _syntactically_ must...
Ironically: ```py from typing import type_check_only ``` **Success: no issues found in 1 source file** Okay, that's a pretty good one, it sucks that it's not applicable to variables(TypeVars, type...
This feature would be extremely based. [JS has a proxy type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) that is [fully supported in TS](https://github.com/microsoft/TypeScript/blob/663b19fe4a7c4d4ddaa61aedadd28da06acd27b6/src/lib/es2015.proxy.d.ts). ```ts class Target { message1 = "hello" message2 = "everyone" }; class Handler...
```py from typing import TypeVar, Generic T = TypeVar("T") class _Proxy(Generic[T]): def __new__(cls, target: T) -> T: return super().__new__(cls) def __init__(self, target: T) -> None: self.target: T = target def...
An even more based idea would be being able to have a generic base type, Pseudo code alert! ```py class GenericSub(GenericBase[T]): def foo() -> None: .... class A: def bar()...