Questions tagged [type-hinting]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
76 views

Randomly rotate an image through right angles

I'm new to Python, and coming from Typescript, I tried to include types, but it's not obvious sometimes. Currently this is the way I type objects: Write own simple types Import type from a library ...
Minsky's user avatar
  • 239
0 votes
1 answer
322 views

Type hints and expected types

I'm unsure if this question belongs on Code Review or Stack Overflow. Another developer told me that I should consider adding type hints to my open source project WordHoard. I have never used type ...
Life is complex's user avatar
1 vote
0 answers
52 views

A Haskell-style "maybe" type in Python, version 2

I have decided on a preferred solution to my question A maybe type in Python. Which implementation is best?, and have expanded it to be more ergonomic. I have implemented a host of utility functions (...
schuelermine's user avatar
0 votes
1 answer
1k views

Subscriptable Type Hinting and Instance Checks

Background The typing module supports subscriptable types. Here is an example use case: ...
The Thonnu's user avatar
3 votes
0 answers
95 views

Build the Mountain Car Environment using coupled inheritance and type annotations

This code builds the environment for the standard Mountain Car Problem of reinforcement learning. I'm using Python 3.9 with PyCharm and I'm wishing to use type annotations throughout. I'm trying to ...
Robin Carter's user avatar
2 votes
1 answer
258 views

Decorator for forward type hint resolution

Background I frequently develop ORM libraries using the peewee framework. On one particularly large ORM library, representing a proprietary data format, I have a lot of coupled ORM models representing ...
Richard Neumann's user avatar