Skip to Content Skip to Navigation
Profile image for Patrick

Patrick

@patrick@patrick.wtf

Python / GraphQL

36 Posts Posts & Replies 266 Following 187 Followers Search

Does anyone know how if in it is possible to define a generic class that infers the type of the generic from an attribute?

Something like this:

```
T = TypeVar("T")
class Example(Generic[T]):
Config: type[T]
configuration: T

class SubExample(Example):
Config = str

reveal_type(SubExample().configuration)
```

currently Pylance and Mypy complain about Example not being passed the TypeVar, I wonder if there's a different way to achieve this 👀

Edited 270d ago
Patrick boosted

Congratulations to the new Python Steering Council for 2024!

* Pablo Galindo Salgado
* Gregory P. Smith @gpshead
* Barry Warsaw @flufl
* Emily Morehouse
* Thomas Wouters @Yhg1s

discuss.python.org/t/steering-

hugovk.github.io/python-steeri

@astro is quickly becoming my favourite framework 🥰

Patrick boosted

🚨 You can now buy your PyCon Italia ticket! 🚨

Early Bird tickets are now available on pycon.it! And they won’t be around for long, as they are limited in quantity!

Get them now! ⚡

PyCon Italia needs you!

Got an innovative talk or workshop idea? Our call for proposals is now open!

Bleeding edge or well-known tech, first-time or experienced speakers, everything and everyone is welcome! 🙌

PyCon Italia is your conference! pycon.it/call-for-proposals

Edited 281d ago
Patrick boosted

🚉More sustainable travel options for you soon.

Earlier this year, we announced we’re supporting ten pilot cross-border rail services, connecting more cities and shaping the future of train mobility, including:

🚆 Connecting 🇭🇺 Hungary, 🇦🇹 Austria and 🇷🇴 Romania;
🚆 New night train service 🇫🇷 Paris – 🇮🇹 Milan – 🇮🇹 Venice;
🚆 New service 🇩🇪 Munich – 🇨🇭 Zurich;
🚆 New night train service 🇳🇱 Amsterdam – 🇪🇸 Barcelona.

More: europa.eu/!v6b776

Edited 285d ago