Boost logo

Boost :

From: Barry Scott (barry_at_[hidden])
Date: 2000-11-01 17:00:28


Here is that test case with the TABs replaced with 4 spaces.

  BArry

-----------------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----------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk