[C++-sig] Better introspection/apidoc extraction support?

English, Mark Mark.English at rbccm.com
Tue May 15 14:12:07 CEST 2007


> Not that I know of.  AFAICS, there is no public API for that (that's why I 
> wrote "half-private"), but if you look at a functions func_code.co_XXX and 
> func_defaults properties, you see that there is a lot of internal information 
> available in CPython.

> Then, there is the inspect module (implemented in python), which uses the 
> above internal stuff to offer a more convenient API.  E.g. 
> inspect.getargspec() uses func_code.co_varnames[:func_code.co_argcount] to 
> query the argument names, func_code.co_flags to determine whether the 
> function has *args or **kwargs parameters (4/8 bitflags), ...

> I would think that basically *any* API within boost::python functions would be 
> OK, since there is no official way beyond inspect.  (Of course, it would be 
> best if the inspect module would become compatible with boost::python some 
> day, so apidoc projects do not have to duplicate code..)

(Apologies for the ridiculous trailer)

For an introspection example, there was a signature.py drifting around which I'm having trouble tracking down, written I believe by Neel Krishnaswami. There's a copy here:
http://funformkit.sourceforge.net/FunFormKit/Signature.py

Speaking of signatures, have you looked at the draft Pep 362 ?
http://www.python.org/dev/peps/pep-0362/

There's a reference implementation:
http://svn.python.org/view/sandbox/trunk/pep362/

Hope that helps,
Mark
________________________________________

This E-Mail (including any attachments) may contain privileged or confidential information.  It is intended only for the addressee(s) indicated above.

The sender does not waive any of its rights, privileges or other protections respecting this information.  

Any distribution, copying or other use of this E-Mail or the information it contains, by other than an intended recipient, is not sanctioned and is prohibited.

If you received this E-Mail in error, please delete it and advise the sender (by return E-Mail or otherwise) immediately. 

This E-Mail (including any attachments) has been scanned for viruses. 

It is believed to be free of any virus or other defect that might affect any computer system into which it is received and opened. 

However, it is the responsibility of the recipient to ensure that it is virus free. 

The sender accepts no responsibility for any loss or damage arising in any way from its use.

E-Mail received by or sent from RBC Capital Markets is subject to review by Supervisory personnel. 

Such communications are retained and may be produced to regulatory authorities or others with legal rights to the information.

IRS CIRCULAR 230 NOTICE:  TO COMPLY WITH U.S. TREASURY REGULATIONS, WE ADVISE YOU THAT ANY U.S. FEDERAL TAX ADVISE INCLUDED IN THIS COMMUNICATION IS NOT INTENDED OR WRITTEN TO BE USED, AND CANNOT BE USED, TO AVOID ANY U.S. FEDERAL TAX PENALTIES OR TO PROMOTE, MARKET, OR RECOMMEND TO ANOTHER PARTY ANY TRANSACTION OR MATTER.



More information about the Cplusplus-sig mailing list