From barry at scottb.demon.co.uk Sun Oct 8 21:15:33 2000 From: barry at scottb.demon.co.uk (Barry Scott) Date: Sun, 8 Oct 2000 20:15:33 +0100 Subject: [C++-SIG] CXX updated to work with Python 1.5.2 and Python 2.0 Message-ID: <000201c0315c$216fa110$060210ac@private> I have checked in the changes to CXX to allow CXX to work with Python 2.0 as well as Python 1.5.2. Array.hxx has been moved to the Demo directory. The range example have been renamed from r to range. This is reflected in the file names and the class names. This should make it clear to read and understand. I have add my Visual C++ project and workspace files to CVS. example_py15.dsp,.dsw builds for Python 1.5.2. example_py20.dsp,.dsw builds for Python 2.0. One issue that supporting Python 2.0 raised is that all PythonExtension objects must to managed by Python. This means that you cannot create them auto (on the stack) or delete them yourself. Python must do it or the ref counting goes wrong. Example of correct usage: class range : PythonExtension; Py:ExtensionObject managed_range( new range( 1, 100, 5 ) ) Example of bad usage: range *bad_range = new range( 1, 100, 5 ); ... delete bad_range; There is now an assert() that will catch the bad usage. BArry From abrahams at mediaone.net Tue Oct 10 04:06:31 2000 From: abrahams at mediaone.net (David Abrahams) Date: Mon, 9 Oct 2000 22:06:31 -0400 Subject: [C++-SIG] py_cpp update Message-ID: <060801c0325e$bf8cbc40$0500a8c0@dragonsys.com> I have just posted a new version of py_cpp to: http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html and http://www.egroups.com/files/boost/py_cpp/ The focus of this release was: 1. enabling all of the special member function names described at: http://www.pythonlabs.com/pub/www.python.org/doc/current/ref/specialnames.ht ml except for those used for emulating numeric types. 2. additional special member functions for accessing data members as readonly or read/write attributes 3. Enabling the wrapping of overloaded member functions and constructors. This work was a collaboration with Ullrich Koethe. Thanks, Ullrich! 4. Cleanup of various flotsam and jetsam. Renaming of types and functions where neccessary for clarity Examples of the new features can be found in extclass_demo.cpp/h (the C++ side of the work) and test_extclass.py (the Python side). My very next project is to update and expand the documentation. Warning: I have discovered that the static-allocation idiom for ExtensionClass<> objects used in the current docs does not work (Python is trying to maintain reference counts; it doesn't pay to subvert Python's idea of object lifetimes!) Please follow the idiom examples in extclass_demo.cpp until I get the documentation updated. Ullrich has done some excellent work on reflecting C++ inheritance hierarchies in Python; I hope we'll be able to release it very soon. The formal review period at boost for this library has begun. I hope that if you are interested in this library you will join the boost mailing list at www.egroups.com and participate in the open-source feedback loop. Thanks, Dave From abrahams at mediaone.net Wed Oct 11 21:26:48 2000 From: abrahams at mediaone.net (David Abrahams) Date: Wed, 11 Oct 2000 15:26:48 -0400 Subject: [C++-SIG] Another update Message-ID: <089b01c033b9$3abbb3c0$0500a8c0@dragonsys.com> A new beta release of py_cpp has been posted to http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html No new documentation yet, because the following urgent problems needed to be addressed: 1. Didn't work with GCC2.95.2 2. Reference-counting problems caused some objects to be leaked 3. The simple example code in example1.cpp was incorrect 4. (related to the above) there was no sufficiently simple correct syntax for doing simple wrapping jobs 5. extclass_demo.cpp depended unneccessarily on a conforming standard library. I made it work with the native lib from GCC 2.95.2 6. Overloading of module-scoped functions hadn't been enabled (an oversight) Documentation updates are next, I promise! From abrahams at mediaone.net Mon Oct 16 04:17:43 2000 From: abrahams at mediaone.net (David Abrahams) Date: Sun, 15 Oct 2000 22:17:43 -0400 Subject: [C++-SIG] py_cpp update Message-ID: <11b001c03717$4e7c0520$0500a8c0@dragonsys.com> An update of py_cpp has been posted to http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html. The main focus of this update is revised and expanded documentation (a work still in progress). Changes to the code were minimal. The boost review period for py_cpp ends 19 Oct. I hope that if you are interested in this library you will join the boost mailing list at www.egroups.com and participate in the open-source feedback loop. Thanks, Dave From abrahams at mediaone.net Mon Oct 16 04:17:43 2000 From: abrahams at mediaone.net (David Abrahams) Date: Sun, 15 Oct 2000 22:17:43 -0400 Subject: [C++-SIG] [boost] py_cpp update Message-ID: <11b001c03717$4e7c0520$0500a8c0@dragonsys.com> An update of py_cpp has been posted to http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html. The main focus of this update is revised and expanded documentation (a work still in progress). Changes to the code were minimal. The boost review period for py_cpp ends 19 Oct. I hope that if you are interested in this library you will join the boost mailing list at www.egroups.com and participate in the open-source feedback loop. Thanks, Dave From barry at scottb.demon.co.uk Mon Oct 16 22:16:51 2000 From: barry at scottb.demon.co.uk (Barry Scott) Date: Mon, 16 Oct 2000 21:16:51 +0100 Subject: [C++-SIG] py_cpp update In-Reply-To: <11b001c03717$4e7c0520$0500a8c0@dragonsys.com> Message-ID: <000001c037ae$0506e8f0$060210ac@private> David, I finally got some time to play with py_cpp. There are three problems I found while playing around with demo.dll. 1. __dict__ is not working for classes derived from py_cpp classes 2. __doc__ for functions defined in the derived class do not work 3. dir(class) does not list the functions available in the class (See the code of dir in the Python sources for the names of the secret names it access via getattr. CXX has support for some of them.) BArry Here is a test that I think should run without error. -----------------test_py_cpp.py---------------------- import sys import demo class DerivedFromFoo(demo.Foo): def __init__(self): demo.Foo.__init__( self, 1 ) def fred(self): 'Docs for DerivedFromFoo.fred' print 'Barry.fred' class Base: i_am_base = 'yes' def fred(self): 'Docs for Base.fred' pass class DerivedFromBase(Base): i_am_derived_from_base = 'yes' def fred(self): 'Docs for DerivedFromBase.fred' pass print 'Testing DerivedFromFoo' print '----------------------' df = DerivedFromFoo() print 'dir(df):',dir(df) print 'dir(DerivedFromFoo):',dir(DerivedFromFoo) try: print 'df.__dict__:',df.__dict__ except: type, value, traceback_obj = sys.exc_info() print '\nError: Type',type,'value',value try: print 'df.fred.__doc__:',df.fred.__doc__ except: type, value, traceback_obj = sys.exc_info() print '\nError: Type',type,'value',value print print 'Testing DerivedFromBase' print '-----------------------' db = DerivedFromBase() print 'dir(db):',dir(db) print 'dir(DerivedFromBase):',dir(DerivedFromBase) print 'db.__dict__:',db.__dict__ print 'db.fred.__doc__:',db.fred.__doc__ -----------------test_py_cpp.py---------------------- -----------------Output example---------------------- Python 1.5.2 (#0, May 22 2000, 17:17:30) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import test_py_cpp Testing DerivedFromFoo ---------------------- dir(df): [] dir(DerivedFromFoo): [] df.__dict__: Error: Type exceptions.AttributeError value __dict__ df.fred.__doc__: Error: Type exceptions.AttributeError value 'class py::BoundFunction' object has no attribute '__doc__' Testing DerivedFromBase ----------------------- dir(db): [] dir(DerivedFromBase): ['__doc__', '__module__', 'fred', 'i_am_derived_from_base'] db.__dict__: {} db.fred.__doc__: Docs for DerivedFromBase.fred >>> -----------------Output example---------------------- > -----Original Message----- > From: c++-sig-admin at python.org [mailto:c++-sig-admin at python.org]On > Behalf Of David Abrahams > Sent: 16 October 2000 03:18 > To: Xavier Defrang; Ullrich Koethe; Prabhu Ramachandran; Niklas > Blomberg; Chuck_Ingold at Dragonsys.com; c++-sig at python.org; > boost at eGroups.com; Anton Gluck; Ralf W. Grosse-Kunstleve > Subject: [C++-SIG] py_cpp update > > > An update of py_cpp has been posted to > http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html. > > The main focus of this update is revised and expanded documentation (a work > still in progress). Changes to the code were minimal. > > The boost review period for py_cpp ends 19 Oct. I hope that if you are > interested in this library you will join the boost mailing list at > www.egroups.com and participate in the open-source feedback loop. > > Thanks, > Dave > > > > _______________________________________________ > C++-SIG maillist - C++-SIG at python.org > http://www.python.org/mailman/listinfo/c++-sig > From abrahams at mediaone.net Wed Oct 18 18:44:24 2000 From: abrahams at mediaone.net (David Abrahams) Date: Wed, 18 Oct 2000 12:44:24 -0400 Subject: [C++-SIG] Update posted Message-ID: <174b01c03922$bdac7080$0500a8c0@dragonsys.com> An update of py_cpp has been posted to http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html. Several people mentioned that support for emulating numeric types was important to them, so it has been added. It does not (and cannot, due to the way Python was written) follow the same protocol as true Python class instances do (i.e. there is no support for __radd__). For an explanation of what happens, until we have it in the py_cpp documentation, see the description of nb_coerce at http://starship.python.net/crew/arcege/extwriting/pyextnum.html and the bottom of http://www.pythonlabs.com/pub/www.python.org/doc/2.0b1/ref/numeric-types.htm l (remembering that we don't have true class instances). Ullrich Koethe has also contributed code for implicit up/downcasting. Excellent job, Ullrich! Examples of all of this can be found in the usual demo files (extclass_demo.*, test_extclass.py). More complete documentation will be forthcoming. Regards, Dave From abrahams at mediaone.net Fri Oct 20 04:47:36 2000 From: abrahams at mediaone.net (David Abrahams) Date: Thu, 19 Oct 2000 22:47:36 -0400 Subject: [C++-SIG] py_cpp news Message-ID: <019d01c03a40$25b63530$0500a8c0@dragonsys.com> 1. The review period is over and py_cpp has been accepted into boost! In the next few weeks it will undergo changes in keeping with the review commentary. Also, expect development activity to slow for a while as I will be at the C++ committee meeting and Ullrich Koethe will also be away. 2. An update has been posted to http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html and http://www.egroups.com/files/boost/py_cpp/ a. Documentation of support for special method names has been added b. Workarounds for a Dec Alpha compiler/lib bug were added. c. Minor fixes to the rest of the documentation were made 3. There is still a little time to vote for a better name! Regards, Dave From abrahams at mediaone.net Fri Oct 20 18:56:32 2000 From: abrahams at mediaone.net (David Abrahams) Date: Fri, 20 Oct 2000 12:56:32 -0400 Subject: [C++-SIG] py_cpp news References: Message-ID: <02e901c03ab6$b31cc580$0500a8c0@dragonsys.com> From: "Paul F. Dubois" > David, > > It's great to be cool. But not everyone is cool. True, but I think you'll agree that most people named Dubois are pretty cool. > I, and perhaps others in > the C++-Sig, have no idea what you are talking about. What ever boost is, > I'm glad to hear you are in it. www.boost.org has a pretty good description of itself: "The Boost web site provides free, peer-reviewed, C++ libraries. The emphasis is on portable libraries which work well with the C++ Standard Library." More detailed info is available at http://www.boost.org/more/faq.htm Is anything still unclear? > Sounds like a great product, though. Thank you! I'm honored to hear that coming from you; I know CXX has been a great contribution to the Python/C++ community. > I am no longer on a project that uses C++ or I would try it. What does this mean for the future of CXX? It has been suggested (and I agree) that CXX has strengths that py_cpp does not, and could benefit from. I'm not sure whether or not complete integration is worth the trouble, but it sounds like a plausible idea to me. > In re your comments on CXX on your site. My intention with CXX was not to do > what you are doing. It was to enable a person to write an extension directly > in C++ rather than C. I figured others had the wrapping business covered. I > thought maybe CXX would provide an easier target language for those making > wrappers, but I never explored that. I realize that the goals of our two projects are not exactly the same, but the purpose of that page is really to answer the many questions I received of the form "how is your system different from XXX"? That said, I would be more than happy to quote you in my comments. Is what you wrote above really the best way I can represent CXX, or should I say something else? -Dave From mark.evans at clarisay.com Thu Oct 26 01:56:40 2000 From: mark.evans at clarisay.com (Mark Evans) Date: Wed, 25 Oct 2000 18:56:40 -0500 Subject: [C++-SIG] Merge py_cpp and CXX! Message-ID: <1361808149.20001025185640@clarisay.com> A merger seems like the sensible thing to do. It should be possible to examine each package, determine relative strengths and weaknesses, and produce a truly awesome hybrid. Then all future development energies would be focused on one package, not fragmented between two overlapping packages. There is a lot of overlap. Both packages have C++ classes which represent Python objects. Both have a class representing the extension module. For each such class, we could produce a new hybrid with combined functionality from each library. py_cpp uses lots of C++ template mechanisms which should be better documented (in the code). Dependencies on boost libraries should be minimized, or at least isolated -- such that boost becomes optional, if possible. Mark Evans mailto:mark.evans at clarisay.com From jh at web.de Thu Oct 26 03:08:45 2000 From: jh at web.de (Juergen Hermann) Date: Thu, 26 Oct 2000 03:08:45 +0200 Subject: [C++-SIG] Merge py_cpp and CXX! In-Reply-To: <1361808149.20001025185640@clarisay.com> Message-ID: On Wed, 25 Oct 2000 18:56:40 -0500, Mark Evans wrote: >py_cpp uses lots of C++ template mechanisms which should be >better documented (in the code). Last time I/we looked, py_cpp was simply 100% undocumented (not even a README). That was the reason we dropped it like a hot potatoe, whatever the promises. Is that fixed by now? Bye, J?rgen From abrahams at mediaone.net Mon Oct 30 14:45:14 2000 From: abrahams at mediaone.net (David Abrahams) Date: Mon, 30 Oct 2000 08:45:14 -0500 Subject: [c++-sig] Digest Number 46 References: <972544511.12570@egroups.com> Message-ID: <031d01c04277$a1bec770$0500a8c0@dragonsys.com> Sorry it took so long to respond to this, but I didn't see the message: From: "Juergen Hermann" > Last time I/we looked, py_cpp was simply 100% undocumented (not even a > README). That was the reason we dropped it like a hot potatoe, whatever > the promises. > > Is that fixed by now? Yes.See http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html From abrahams at mediaone.net Tue Oct 31 15:56:56 2000 From: abrahams at mediaone.net (David Abrahams) Date: Tue, 31 Oct 2000 09:56:56 -0500 Subject: [C++-SIG] py_cpp update posted Message-ID: <01d101c0434a$d59fbb70$0500a8c0@dragonsys.com> See http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html. New features: 1. support for non-const reference parameters to constructors 2. support for special member attributes __doc__, __class__, __bases__, etc. 3. support for multiple inheritance from py_cpp extension classes and regular python classes. Updated documentation (whew, this takes a long time - there's much more to come. If you need advanced hints earlier, see the todo.txt file in the distribution). -Dave More documentation and massage of names/namespaces to conform with boost standards is next.