python-trio / trio-typing

Type hints for Trio and related projects
Other
27 stars 14 forks source link

Fix stubs for memory send/receive streams #5

Closed oremanj closed 5 years ago

oremanj commented 5 years ago

The hooks are optional, and the close hook is a synchronous function.

njsmith commented 5 years ago

I don't know what it means to add the = ... syntax, but the rest looks sensible... :-)

oremanj commented 5 years ago

= ... is how you indicate an unspecified default value in a stubs file. (The type checker doesn't care what the default is, and any specific default might easily get out of sync with the upstream package.)

njsmith commented 5 years ago

Ah, so Optional means "it could be None", and = ... means "it could be left unspecified by the user and a default will be filled in"? That makes sense.

oremanj commented 5 years ago

Exactly - thanks for the merge!