1.1 --- a/lib/__builtins__/file.py Thu Dec 08 23:33:14 2016 +0100
1.2 +++ b/lib/__builtins__/file.py Thu Dec 08 23:36:43 2016 +0100
1.3 @@ -27,7 +27,11 @@
1.4 "Generic file-oriented stream functionality."
1.5
1.6 def __init__(self, bufsize=1024):
1.7 +
1.8 + "Initialise the stream with the given 'bufsize'."
1.9 +
1.10 self.bufsize = bufsize
1.11 + self.__data__ = None
1.12
1.13 def read(self, n=0):
1.14
2.1 --- a/lib/__builtins__/sequence.py Thu Dec 08 23:33:14 2016 +0100
2.2 +++ b/lib/__builtins__/sequence.py Thu Dec 08 23:36:43 2016 +0100
2.3 @@ -114,6 +114,32 @@
2.4
2.5 return result
2.6
2.7 + # Methods implemented by subclasses.
2.8 +
2.9 + def __setslice__(self, start, end, value):
2.10 +
2.11 + "Method to be overridden by subclasses."
2.12 +
2.13 + pass
2.14 +
2.15 + def __get_single_item__(self, index):
2.16 +
2.17 + "Method to be overridden by subclasses."
2.18 +
2.19 + return None
2.20 +
2.21 + def __set_single_item__(self, index, value):
2.22 +
2.23 + "Method to be overridden by subclasses."
2.24 +
2.25 + pass
2.26 +
2.27 + def __len__(self):
2.28 +
2.29 + "Method to be overridden by subclasses."
2.30 +
2.31 + return 0
2.32 +
2.33 class sequence(itemaccess):
2.34
2.35 "A common base class for sequence types."
2.36 @@ -192,6 +218,12 @@
2.37
2.38 return not self.__eq__(other)
2.39
2.40 + def __iter__(self):
2.41 +
2.42 + "Method to be overridden by subclasses."
2.43 +
2.44 + raise StopIteration()
2.45 +
2.46 def _get_absolute_index(index, length):
2.47
2.48 """
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tests/attr_base_usage_bad.py Thu Dec 08 23:36:43 2016 +0100
3.3 @@ -0,0 +1,16 @@
3.4 +class C:
3.5 + def f(self):
3.6 + return self.x
3.7 +
3.8 +class D(C):
3.9 + pass
3.10 +
3.11 +class E(C):
3.12 + def __init__(self, x):
3.13 + self.x = x
3.14 +
3.15 +d = D()
3.16 +print d.f()
3.17 +
3.18 +e = E(2)
3.19 +print e.f()
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/tests/attr_base_usage_good.py Thu Dec 08 23:36:43 2016 +0100
4.3 @@ -0,0 +1,18 @@
4.4 +class C:
4.5 + def __init__(self):
4.6 + self.x = 1
4.7 + def f(self):
4.8 + return self.x
4.9 +
4.10 +class D(C):
4.11 + pass
4.12 +
4.13 +class E(C):
4.14 + def __init__(self, x):
4.15 + self.x = x
4.16 +
4.17 +d = D()
4.18 +print d.f()
4.19 +
4.20 +e = E(2)
4.21 +print e.f()