Python type hint for (any) class

I’d recommend using a combination of TypeVar, to indicate that your self.o value could be any arbitrary type, and Type, in the following way: from typing import TypeVar, Type T = TypeVar(‘T’) class MyObj: def __init__(self, o: T) -> None: self.o = o def get_obj_class(self) -> Type[T]: return type(self.o) def accept_int_class(x: Type[int]) -> None: pass … Read more

What is a sound programming language?

Taken from Dart’s language guide What is soundness? Soundness is about ensuring your program can’t get into certain invalid states. A sound type system means you can never get into a state where an expression evaluates to a value that doesn’t match the expression’s static type. For example, if an expression’s static type is String, … Read more

TypeScript type ignore case

NEW ANSWER FOR TYPESCRIPT 4.1+ Welcome back! Now that TypeScript 4.1 has introduced template literal types and the Uppercase/Lowercase intrinsic string mapping types, we can now answer this question without needing regular expression types. There are two main approaches. The “brute force” approach makes heavy use of recursive conditional types and unions to turn your … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)