/explore

Click through on any links that interest you or select the planets on the right to continue exploring the Outer Web.
You are here

blog.meadsteve.dev
| | borutzki.github.io

Sometimes a function takes multiple arguments of different types, and the return type depends on specific combinations of inputs. It's often easy to understand by reading code, but how do you tell the type checker that this is the case? This is where the @overload decorator from the typing module comes handy.
3.6 parsecs

Travel
| |
| | switowski.com

Continue the magic functions journey and create a cell magic function that checks type hints in IPython.
4.7 parsecs

Travel
| |
| | adamj.eu

In a type hint, if we specify a type (class), then we mark the variable as containing an instance of that type. To specify that a variable instead contains a type, we need to use type[Cls] (or the old syntax typing.Type).
2.4 parsecs

Travel
| |
| | ykarroum.com

[AI summary] This technical article demonstrates how to create a Python decorator that automatically detects and sets the inplace=True parameter for pandas and numpy functions to optimize memory usage, while carefully handling reference counting and syntax tree analysis to prevent unintended side effects.
28.1 parsecs

Travel
|