2010-06-05 | Paul Boddie | raw annotate files changeset graph | Changed parameter initialisation to explicitly use Instance() instead of None. Made the default parameter value code use the same mechanisms as other attribute-setting code. Added tests of lambdas and nested functions with locally defined defaults. |
1 #!/usr/bin/env python 2 3 class E: 4 def __init__(self, x): 5 self.x = x 6 7 class F: 8 def __init__(self, x=3): 9 self.x = x 10 11 e = E(1) 12 f = F() 13 g = F(2) 14 X = F 15 x = X() 16 17 result_1 = e.x 18 result1_3 = f.x 19 result_2 = g.x 20 result2_3 = x.x 21 22 # vim: tabstop=4 expandtab shiftwidth=4