-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fixed implementation of interface role/object type #11
base: master
Are you sure you want to change the base?
Conversation
I disagree. It's certainly possible for classes to be thought of as interfaces. Many of the collections ABCs like Container are good examples. And since they typically have |
We are not talking about interface as a programming concept. In the context of this package, interface is a Zope Interfaces interface. It has to be declared as one, so arbitrary classes are not always interfaces. Maybe I'm wrong - I'm not very familiar with Zope, but this is what I get from reading |
I certainly don't see why not. If this package is going to take over the very generic role name |
Well, namespace conflicts is not something I wanted to deal with. The current naming convention was picked long time ago and we are not in position to change it - it's too late. However, if someone is concerned that generic name refers to a Zope concept, they have 2 options:
|
Let's try looking at it this way: does being able to use To me, it's very practical that I don't have to care about what the thing that I'm referencing "actually" is. If it makes the documentation clearer to say ":interface:", because that's the intent of the code, I'd like to be able to say that; forcing a distinction seems arbitrary, without any benefits that I can see; indeed, one could even argue that it in throwing away duck-typing it'sun-Pythonic. It's similar to being able to use both EDIT: Full disclosure, I don't think I've ever, or at least not in a long time, used |
For me it's both practical and correct that
The patch implements support for this feature. Before |
Note, if someone doesn't care what is the object he referring to, he may use |
I think for Zope-ish concepts the more correct approach in the long term would probably be to implement a separate domain. Then you would refer specific namespaced terms e.g.
So I will wait for the maintainer's verdict on this. But I guess keeping things simple and using generic name in the python domain is the best approach. |
@jamadden |
Well we already have generic |
Fixes #9 and #10.
Analysis of the current problems:
interface
role, which breaks intersphinx cross references and probably other thingsclass
object type is incorrectly patched. The current code makesinterface
object type reference-able by theclass
role, which is correct. But it also makesclass
object type reference-able by theinterface
role, so you can reference a class which is not a proper interface - incorrect behavior.Summary of changes:
:interface:
form, in addition to:class:
fuzzy search
works both for:class:
and:interface:
roles:class:
and:interface:
referenceNote:
fuzzy search
works fully only for local references. It will not work with intersphinx references,except when used in context (you can read about the latter feature implemented in Sphinx 1.6.2 here sphinx-doc/sphinx#3425)
I've also cleaned up the code a bit, and added a comment explaining the code for the next developer working with it.