diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2012-12-18 09:02:07 +0000 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2012-12-18 09:02:07 +0000 |
| commit | b62e82365ad56ca930f7abb1d1dbdf9ce5a7c7c3 (patch) | |
| tree | 76bce44f4c7ee6172dcf116be6e4a26e380ef20a /docs/topics/python3.txt | |
| parent | 6a632e04578776e877adc5e2dc53f008c890a0d4 (diff) | |
| parent | c64b57d16688025b2d48668d5c4cb9eda7484612 (diff) | |
Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
django/db/models/loading.py
django/db/models/options.py
Diffstat (limited to 'docs/topics/python3.txt')
| -rw-r--r-- | docs/topics/python3.txt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/topics/python3.txt b/docs/topics/python3.txt index f5749faaf2..e6dc165399 100644 --- a/docs/topics/python3.txt +++ b/docs/topics/python3.txt @@ -278,15 +278,13 @@ Iterators :: - class MyIterator(object): + class MyIterator(six.Iterator): def __iter__(self): return self # implement some logic here def __next__(self): raise StopIteration # implement some logic here - next = __next__ # Python 2 compatibility - Boolean evaluation ~~~~~~~~~~~~~~~~~~ @@ -297,7 +295,8 @@ Boolean evaluation def __bool__(self): return True # implement some logic here - __nonzero__ = __bool__ # Python 2 compatibility + def __nonzero__(self): # Python 2 compatibility + return type(self).__bool__(self) Division ~~~~~~~~ @@ -309,12 +308,14 @@ Division def __truediv__(self, other): return self / other # implement some logic here - __div__ = __truediv__ # Python 2 compatibility + def __div__(self, other): # Python 2 compatibility + return type(self).__truediv__(self, other) def __itruediv__(self, other): return self // other # implement some logic here - __idiv__ = __itruediv__ # Python 2 compatibility + def __idiv__(self, other): # Python 2 compatibility + return type(self).__itruediv__(self, other) .. module: django.utils.six |
