Ejemplo n.º 1
0
    d2 = digit_dict[d]
    for g in sorted(d2):
        print d, g, d2[g]

l = [[7,8,9], [7.7,8.8,9.9]]
    
for ll in l:
    for lll in ll:
        print '%.2f' % lll

#circular includes
from testdata import bert
class Here:
    def __str__(self):
        return 'here'
bert.hello(Here())

#partial support for 'super'
class A(object):
    def __init__(self, x):
        print 'a', x
class C(A):
    def __init__(self, x):
        print 'c', x
class B(C):
    def __init__(self, x):
        super(B, self).__init__(x)
        super(C, self).__init__(3*x)
        A.__init__(self, 2*x)
        C.__init__(self, 3*x)
        print 'b', x
Ejemplo n.º 2
0
l = [[7, 8, 9], [7.7, 8.8, 9.9]]

for ll in l:
    for lll in ll:
        print '%.2f' % lll

#circular includes
from testdata import bert


class Here:
    def __str__(self):
        return 'here'


bert.hello(Here())


#partial support for 'super'
class A(object):
    def __init__(self, x):
        print 'a', x


class C(A):
    def __init__(self, x):
        print 'c', x


class B(C):
    def __init__(self, x):
Ejemplo n.º 3
0
import testdata.bert
from testdata.bert import hello, zeug
#from sets import Set

class jurk:
    pass

testdata.bert.hello(4)                            # []
hello(4)                                 # [str]

s2 = jurk()                              # [jurk()]

s4 = set()                               # [Set(float)]
s4.add(1.0)                              # []
s3 = set([1,2,3])                        # [Set(int)]

kn = testdata.bert.zeug()                         # [zeug()]
kn.hallo(4)                              # []

l1 = lambda x,y: x+y                     # [lambda0]
l2 = lambda x,y: x-y                     # [lambda0]
l5 = l2                                  # [lambda0]
l3 = lambda x,y: 1.0                     # [lambda1]
def l4(x, y): return x*y                 # [int]

def toepas(l):                           # l: [lambda0]
    return l(1,2)                        # [int]

print toepas(l1)                         # [int]
print toepas(l5)                         # [int]