dabeaz / curio

Good Curio!
Other
4.02k stars 241 forks source link

Deprecating Curio Task Locals #228

Closed dabeaz closed 6 years ago

dabeaz commented 6 years ago

In light of discussion surrounding PEP 550, I'm thinking about deprecating task locals as a core feature of Curio. For one, the whole concept seems fraught with subtle peril. Second, there are a variety of different ways that one might achieve the same effect (e.g., passing around context explicitly). As such, it's not clear that Curio needs to necessarily enforce a "there's one way to do it" rule on it. Lastly, the current locals implementation is something that could just as well be moved to a third-party library if you still wanted it (as it's fairly modular). Plus, I generally like the idea of keeping Curio small.

Kentzo commented 6 years ago

I think it makes sense to keep Task Locals for as long as curio supports Python < 3.7

Since 3.7, one could use PEP 550 task locals.

dabeaz commented 6 years ago

Locals have been deprecated and moved to an example. Should anyone need the code they should copy it from there and use it.