You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The information in "Duck Typing"'s section "Protocols" doesn't really sound actionable to me. What am I supposed to learn from this? And how can I apply this afterwards? As far as I know, Python doesn't have anything to enforce or abide by protocols explicitly (except for static typecheckers of course), so all you can do is know about it and do my very best to abide by protocols. Could we have this more actionable in some form?
Relatedly, using the Iterator protocol suggests that it could be about figuring out if something is iterable, which is surprisingly challenging/easy (depending on your allowed toolbox) to do reliably due to the different ways of being iterable.
The text was updated successfully, but these errors were encountered:
I think the intended action here is to recognise the term "protocol" when the Python docs (or anyone else) use it, and be able to implement a protocol. There could potentially be another challenge around implementing another protocol if we can find a reasonable one—the problem starts to be come that understanding the problem to be solved and the protocol each become a non-trivial amount of work, even without starting the implementation.
I agree on ABCs not always being great, as duck typing is indeed nice.
The information in "Duck Typing"'s section "Protocols" doesn't really sound actionable to me. What am I supposed to learn from this? And how can I apply this afterwards? As far as I know, Python doesn't have anything to enforce or abide by protocols explicitly (except for static typecheckers of course), so all you can do is know about it and do my very best to abide by protocols. Could we have this more actionable in some form?
Relatedly, using the
Iterator
protocol suggests that it could be about figuring out if something is iterable, which is surprisingly challenging/easy (depending on your allowed toolbox) to do reliably due to the different ways of being iterable.The text was updated successfully, but these errors were encountered: