Back to index

python3.2  3.2.2
Classes | Functions
mp_newtype Namespace Reference

Classes

class  Foo
class  GeneratorProxy
class  MyManager

Functions

def baz
def get_operator_module
def test

Function Documentation

def mp_newtype.baz ( )

Definition at line 24 of file mp_newtype.py.

00024 
00025 def baz():
00026     for i in range(10):
00027         yield i*i
00028 
# Proxy type for generator objects

Here is the caller graph for this function:

Definition at line 39 of file mp_newtype.py.

00039 
00040 def get_operator_module():
00041     return operator

def mp_newtype.test ( )

Definition at line 61 of file mp_newtype.py.

00061 
00062 def test():
00063     manager = MyManager()
00064     manager.start()
00065 
00066     print('-' * 20)
00067 
00068     f1 = manager.Foo1()
00069     f1.f()
00070     f1.g()
00071     assert not hasattr(f1, '_h')
00072     assert sorted(f1._exposed_) == sorted(['f', 'g'])
00073 
00074     print('-' * 20)
00075 
00076     f2 = manager.Foo2()
00077     f2.g()
00078     f2._h()
00079     assert not hasattr(f2, 'f')
00080     assert sorted(f2._exposed_) == sorted(['g', '_h'])
00081 
00082     print('-' * 20)
00083 
00084     it = manager.baz()
00085     for i in it:
00086         print('<%d>' % i, end=' ')
00087     print()
00088 
00089     print('-' * 20)
00090 
00091     op = manager.operator()
00092     print('op.add(23, 45) =', op.add(23, 45))
00093     print('op.pow(2, 94) =', op.pow(2, 94))
00094     print('op.getslice(range(10), 2, 6) =', op.getslice(list(range(10)), 2, 6))
00095     print('op.repeat(range(5), 3) =', op.repeat(list(range(5)), 3))
00096     print('op._exposed_ =', op._exposed_)

Here is the call graph for this function: