Re: [Epydoc-devel] epydoc 2.1 can't handle PyGetSetDefs?
Brought to you by:
edloper
From: Barry W. <ba...@py...> - 2006-07-13 12:35:27
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jul 12, 2006, at 11:16 PM, Edward Loper wrote: > On Jul 10, 2006, at 3:12 PM, Barry Warsaw wrote: >> It appears that epydoc cannot handle class attributes >> defined in extension modules with PyGetSetDef. We define almost all >> of our attributes this way and all I get are things like >> >> getset_descriptor | alias_limit = <attribute 'alias_limit' of '...' >> >> This even though alias_limit's PyGetSetDef structure contains a >> docstring and in fact you can get the __doc__ of that descriptor just >> fine. > > Thanks to Daniele for providing a quick patch to address this. One > question that came up in that patch, though, is what the best way is > to get at the getset_descriptor type. I suggested the following > (which I found via google): > >>>> print type(types.FunctionType.__dict__.get('__dict__')) > <type 'getset_descriptor'> > > But this seems to be an implementation detail of FunctionType, that's > subject to change in the future. It doesn't look like the > getset_descriptor type is accessible via the types module. So any > suggestions on what the best way to get at this type is? See http://mail.python.org/pipermail/python-dev/2006-July/067219.html for a similar thread I've started on python-dev. While I ended up using type(types.FrameType.f_locals) I think again, that's an implementation detail that's subject to change. Worse, there are also member descriptors (see my previous post) and for that, there really is no good candidate (the situation is worse for Python's types module but could probably work for epydoc). So my pre-coffee thought this morning is the same as yours: Python really needs a _types module that provides those C types in a way that's guaranteed not to change. I plan on throwing something together for Python 2.5, but it's becoming less likely that I'd be allowed to backport that to Python 2.4 (or earlier, I don't know what the minimum Python version epydoc will support). Still, I see no reason why we couldn't collaborate on such a built-in module. OTOH, if you want a pure-Python solution, for member descriptors, use type(datetime.timedelta.days) - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iQCVAwUBRLY+BXEjvBPtnXfVAQKmSwP+MzmLiXaf4yAipJeQRAgTugSIUsIHbXCL nON/1v5m8wCOUr+CnNn63s/L+CarYO2NXqpsqQxkP/nTJRBJTOUH9sArcCdqPymH cJgNP7CXGYPAEyqEYgYW4ZuncwQeo6GGZw67ia5N7HZ/CSZh1IGJhlhGEJP45dwa rLqKagJp2Xk= =Jeft -----END PGP SIGNATURE----- |