-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isinstance(attr, Attr) #29
Comments
Consider using some custom So the "proper" way to deal with this would be not to match for Typedefs, but match the parents in the type hierarchy instead. That's easy for [*} See https://docs.python.org/3/reference/datamodel.html#customizing-instance-and-subclass-checks |
We could consider making an instance check on a |
Well actually there are two sides to this:
Since we are all consenting adults ... structural typecheking would be the way to go. Plus a decent amount of documentation to teach that it should be avoided in pattern matching. There is already a footnote on this subject in the cookbook. |
The underyling logic should already be present in the |
will fail even when
attr
is a correctly formed tuple.Attr
is useful as a piece of documentation since in the REPL one can do for examplebut the attributes produces by a pandoc read is a mere tuple, not an
Attr
instance. ActuallyAttr
cannot be instantiated at all. So while the documentation aspect is handy (to avoid the inlining ofAttr
definition everywhere it is used), the existence of the class may also be misleading since it cannot be used in pattern matching.The text was updated successfully, but these errors were encountered: