*** tiwula has quit IRC | 00:14 | |
*** Arfrever has quit IRC | 01:17 | |
*** menesis has quit IRC | 04:28 | |
*** yvl has joined #zope | 07:37 | |
*** __mac__ has joined #zope | 08:32 | |
*** bosim has joined #zope | 09:31 | |
*** fredvd has joined #zope | 10:11 | |
*** malinoff has joined #zope | 10:17 | |
*** giacomos has joined #zope | 10:24 | |
malinoff | Hi, is there a simple way to inherit docstrings defined in the implemted interface? | 11:04 |
---|---|---|
mgedmin | not that I'm aware of | 11:05 |
mgedmin | some documentation generation tools can pay attention to zope interfaces (pydoctor, iirc?) | 11:06 |
mgedmin | it ought to be possible to write a class decorator for adding the missing docstrings | 11:06 |
mgedmin | or a Sphinx extension | 11:06 |
mgedmin | hm, google tells me Sphinx extensions for zope interfaces already exist | 11:07 |
mgedmin | I don't know if they do what you want them to do | 11:07 |
mgedmin | I don't know what exactly you want to happen and when :) | 11:07 |
malinoff | mgedmin, i always work within ipython (and i suggest that most of experienced pythonistas use it), and i want to cut the following sequence: obj.meth? -> q -> find interface defines meth (the most horrible part) -> IMeth.meth? just to obj.meth? | 11:09 |
mgedmin | sounds like a good idea | 11:09 |
mgedmin | I see two solutions: the aforementioned class decorator (which would imply changing all the code that uses interfaces) | 11:09 |
mgedmin | or an ipython plugin | 11:09 |
malinoff | I just found myself to repeat this stuff over and over again, so the question pops out | 11:10 |
mgedmin | actually, maybe zope.interface could add __doc__ on all the methods during class creation time? | 11:10 |
mgedmin | feel free to suggest this feature at https://github.com/zopefoundation/zope.interface/issues | 11:10 |
mgedmin | but I don't think it will happen unless you write a patch (with tests) | 11:11 |
malinoff | mgedmin, thanks, I won't suggest this to zope.inteface for now, because I can't imagine a simple way to deal with multiple inheritance. I think i'll just go with a decorator | 11:21 |
malinoff | but i'll keep that in my mind | 11:22 |
mgedmin | does ipython deal with inheritance? i.e. overridden methods that have no docstrings, do you get to see the docstring from the base class version of the method? | 11:22 |
malinoff | If i override a method defined in a base class, no, I won't see the base class' method docstring | 11:24 |
mgedmin | seems like it'd create the same kind of inconvenience | 11:24 |
mgedmin | and maybe could be fixed in the same way you intend to fix docstring inheritance from interfaces | 11:25 |
malinoff | alright, this http://stackoverflow.com/questions/8100166/inheriting-methods-docstrings-in-python seems to work | 11:27 |
malinoff | with one small fix to inspect __implemented__ instead of __bases__ | 11:28 |
mgedmin | I'd use API instead of touching the __special__ attributes directly | 11:30 |
mgedmin | zope.interface.implementedBy(cls), IIRC | 11:30 |
mgedmin | but whatever works :) | 11:30 |
malinoff | sure, i just outlined the general approach | 11:30 |
malinoff | mgedmin, thanks - I think one simple class decorator is actually ok | 11:31 |
*** menesis has joined #zope | 11:58 | |
*** maurits has joined #zope | 12:03 | |
*** tisto has joined #zope | 12:27 | |
malinoff | Alright, made it work. If someone curious about it, here is the whole code: http://pastie.org/private/rwp4axznidjhrqe63dfg | 12:31 |
malinoff | Oh god it saves so much lines of code | 12:37 |
malinoff | errr | 13:10 |
malinoff | TypeError: unhashable type when calling implementedBy | 13:10 |
*** sashav has joined #zope | 13:11 | |
*** menesis has quit IRC | 13:56 | |
mgedmin | malinoff, I wonder if http://docs.zope.org/zope.interface/api.html#ISpecification.__iro__ wouldn't be useful for you there | 14:05 |
*** maurits1 has joined #zope | 14:17 | |
*** maurits has quit IRC | 14:17 | |
malinoff | mgedmin, that's what i wanted :) thank you | 14:22 |
malinoff | was confused a bit when obj.__mro__ threw AttributeError | 14:23 |
malinoff | yep, all tests pass | 14:24 |
malinoff | btw, zope.interface is awesome, it's soo easy to work with | 14:27 |
*** yvl has quit IRC | 14:30 | |
*** maurits1 has quit IRC | 14:39 | |
*** yvl has joined #zope | 14:42 | |
*** menesis has joined #zope | 15:04 | |
*** maurits has joined #zope | 15:18 | |
*** maurits has quit IRC | 15:33 | |
*** maurits has joined #zope | 15:33 | |
*** projekt01 has joined #zope | 15:37 | |
*** maurits1 has joined #zope | 15:53 | |
*** maurits has quit IRC | 15:53 | |
*** bosim has quit IRC | 15:59 | |
*** yvl_ has joined #zope | 16:24 | |
*** yvl has quit IRC | 16:27 | |
*** yvl_ has quit IRC | 16:47 | |
*** Arfrever has joined #zope | 17:44 | |
*** __mac__ has quit IRC | 18:05 | |
*** __mac__ has joined #zope | 18:34 | |
*** yvl has joined #zope | 18:35 | |
malinoff | Could someone look at https://github.com/zopefoundation/zope.interface/issues/21, please? | 18:36 |
*** tisto has quit IRC | 18:52 | |
*** sashav has quit IRC | 19:01 | |
*** sashav has joined #zope | 19:02 | |
*** yvl has quit IRC | 19:11 | |
*** giacomos has quit IRC | 19:20 | |
*** maurits1 has quit IRC | 19:32 | |
*** projekt01 has quit IRC | 19:41 | |
*** m8 has joined #zope | 20:41 | |
*** benji has quit IRC | 20:46 | |
*** benji has joined #zope | 20:47 | |
*** menesis has quit IRC | 21:29 | |
*** fredvd has quit IRC | 21:33 | |
*** mup has quit IRC | 21:45 | |
*** mup has joined #zope | 21:45 | |
*** motto has joined #zope | 21:47 | |
*** supersheep has joined #zope | 21:49 | |
*** betabug_ has joined #zope | 21:51 | |
*** malinoff has quit IRC | 21:51 | |
*** malinoff has joined #zope | 21:52 | |
*** roq_1 has joined #zope | 21:54 | |
*** m8 has quit IRC | 21:56 | |
*** betabug has quit IRC | 21:56 | |
*** roq_ has quit IRC | 21:57 | |
*** malinoff_ has joined #zope | 22:00 | |
*** malinoff has quit IRC | 22:01 | |
*** J1m has joined #zope | 22:15 | |
*** supersheep_ has joined #zope | 22:26 | |
*** supersheep has quit IRC | 22:28 | |
*** Arfrever has quit IRC | 22:28 | |
*** menesis has joined #zope | 22:37 | |
*** malinoff_ has quit IRC | 22:54 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!