[Jython-checkins] jython: __dir__ attribute - only real change is in object.derived the rest is codegen.

frank.wierzbicki jython-checkins at python.org
Fri Jun 8 02:51:32 CEST 2012


http://hg.python.org/jython/rev/ec8d710cf9df
changeset:   6686:ec8d710cf9df
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Thu Jun 07 17:51:20 2012 -0700
summary:
  __dir__ attribute - only real change is in object.derived the rest is codegen.

files:
  src/org/python/antlr/ast/AssertDerived.java                   |     8 +
  src/org/python/antlr/ast/AssignDerived.java                   |     8 +
  src/org/python/antlr/ast/AttributeDerived.java                |     8 +
  src/org/python/antlr/ast/AugAssignDerived.java                |     8 +
  src/org/python/antlr/ast/BinOpDerived.java                    |     8 +
  src/org/python/antlr/ast/BoolOpDerived.java                   |     8 +
  src/org/python/antlr/ast/BreakDerived.java                    |     8 +
  src/org/python/antlr/ast/CallDerived.java                     |     8 +
  src/org/python/antlr/ast/ClassDefDerived.java                 |     8 +
  src/org/python/antlr/ast/CompareDerived.java                  |     8 +
  src/org/python/antlr/ast/ContinueDerived.java                 |     8 +
  src/org/python/antlr/ast/DeleteDerived.java                   |     8 +
  src/org/python/antlr/ast/DictDerived.java                     |     8 +
  src/org/python/antlr/ast/EllipsisDerived.java                 |     8 +
  src/org/python/antlr/ast/ExceptHandlerDerived.java            |     8 +
  src/org/python/antlr/ast/ExecDerived.java                     |     8 +
  src/org/python/antlr/ast/ExprDerived.java                     |     8 +
  src/org/python/antlr/ast/ExpressionDerived.java               |     8 +
  src/org/python/antlr/ast/ExtSliceDerived.java                 |     8 +
  src/org/python/antlr/ast/ForDerived.java                      |     8 +
  src/org/python/antlr/ast/FunctionDefDerived.java              |     8 +
  src/org/python/antlr/ast/GeneratorExpDerived.java             |     8 +
  src/org/python/antlr/ast/GlobalDerived.java                   |     8 +
  src/org/python/antlr/ast/IfDerived.java                       |     8 +
  src/org/python/antlr/ast/IfExpDerived.java                    |     8 +
  src/org/python/antlr/ast/ImportDerived.java                   |     8 +
  src/org/python/antlr/ast/ImportFromDerived.java               |     8 +
  src/org/python/antlr/ast/IndexDerived.java                    |     8 +
  src/org/python/antlr/ast/InteractiveDerived.java              |     8 +
  src/org/python/antlr/ast/LambdaDerived.java                   |     8 +
  src/org/python/antlr/ast/ListCompDerived.java                 |     8 +
  src/org/python/antlr/ast/ListDerived.java                     |     8 +
  src/org/python/antlr/ast/ModuleDerived.java                   |     8 +
  src/org/python/antlr/ast/NameDerived.java                     |     8 +
  src/org/python/antlr/ast/NumDerived.java                      |     8 +
  src/org/python/antlr/ast/PassDerived.java                     |     8 +
  src/org/python/antlr/ast/PrintDerived.java                    |     8 +
  src/org/python/antlr/ast/RaiseDerived.java                    |     8 +
  src/org/python/antlr/ast/ReprDerived.java                     |     8 +
  src/org/python/antlr/ast/ReturnDerived.java                   |     8 +
  src/org/python/antlr/ast/SliceDerived.java                    |     8 +
  src/org/python/antlr/ast/StrDerived.java                      |     8 +
  src/org/python/antlr/ast/SubscriptDerived.java                |     8 +
  src/org/python/antlr/ast/SuiteDerived.java                    |     8 +
  src/org/python/antlr/ast/TryExceptDerived.java                |     8 +
  src/org/python/antlr/ast/TryFinallyDerived.java               |     8 +
  src/org/python/antlr/ast/TupleDerived.java                    |     8 +
  src/org/python/antlr/ast/UnaryOpDerived.java                  |     8 +
  src/org/python/antlr/ast/WhileDerived.java                    |     8 +
  src/org/python/antlr/ast/WithDerived.java                     |     8 +
  src/org/python/antlr/ast/YieldDerived.java                    |     8 +
  src/org/python/antlr/ast/aliasDerived.java                    |     8 +
  src/org/python/antlr/ast/argumentsDerived.java                |     8 +
  src/org/python/antlr/ast/comprehensionDerived.java            |     8 +
  src/org/python/antlr/ast/keywordDerived.java                  |     8 +
  src/org/python/antlr/op/AddDerived.java                       |     8 +
  src/org/python/antlr/op/AndDerived.java                       |     8 +
  src/org/python/antlr/op/AugLoadDerived.java                   |     8 +
  src/org/python/antlr/op/AugStoreDerived.java                  |     8 +
  src/org/python/antlr/op/BitAndDerived.java                    |     8 +
  src/org/python/antlr/op/BitOrDerived.java                     |     8 +
  src/org/python/antlr/op/BitXorDerived.java                    |     8 +
  src/org/python/antlr/op/DelDerived.java                       |     8 +
  src/org/python/antlr/op/DivDerived.java                       |     8 +
  src/org/python/antlr/op/EqDerived.java                        |     8 +
  src/org/python/antlr/op/FloorDivDerived.java                  |     8 +
  src/org/python/antlr/op/GtDerived.java                        |     8 +
  src/org/python/antlr/op/GtEDerived.java                       |     8 +
  src/org/python/antlr/op/InDerived.java                        |     8 +
  src/org/python/antlr/op/InvertDerived.java                    |     8 +
  src/org/python/antlr/op/IsDerived.java                        |     8 +
  src/org/python/antlr/op/IsNotDerived.java                     |     8 +
  src/org/python/antlr/op/LShiftDerived.java                    |     8 +
  src/org/python/antlr/op/LoadDerived.java                      |     8 +
  src/org/python/antlr/op/LtDerived.java                        |     8 +
  src/org/python/antlr/op/LtEDerived.java                       |     8 +
  src/org/python/antlr/op/ModDerived.java                       |     8 +
  src/org/python/antlr/op/MultDerived.java                      |     8 +
  src/org/python/antlr/op/NotDerived.java                       |     8 +
  src/org/python/antlr/op/NotEqDerived.java                     |     8 +
  src/org/python/antlr/op/NotInDerived.java                     |     8 +
  src/org/python/antlr/op/OrDerived.java                        |     8 +
  src/org/python/antlr/op/ParamDerived.java                     |     8 +
  src/org/python/antlr/op/PowDerived.java                       |     8 +
  src/org/python/antlr/op/RShiftDerived.java                    |     8 +
  src/org/python/antlr/op/StoreDerived.java                     |     8 +
  src/org/python/antlr/op/SubDerived.java                       |     8 +
  src/org/python/antlr/op/UAddDerived.java                      |     8 +
  src/org/python/antlr/op/USubDerived.java                      |     8 +
  src/org/python/core/ClasspathPyImporterDerived.java           |     8 +
  src/org/python/core/PyArrayDerived.java                       |     8 +
  src/org/python/core/PyBaseExceptionDerived.java               |     8 +
  src/org/python/core/PyByteArrayDerived.java                   |  2240 +++++----
  src/org/python/core/PyClassMethodDerived.java                 |     8 +
  src/org/python/core/PyComplexDerived.java                     |     8 +
  src/org/python/core/PyDictionaryDerived.java                  |     8 +
  src/org/python/core/PyEnumerateDerived.java                   |     8 +
  src/org/python/core/PyFileDerived.java                        |     8 +
  src/org/python/core/PyFloatDerived.java                       |     8 +
  src/org/python/core/PyFrozenSetDerived.java                   |     8 +
  src/org/python/core/PyIntegerDerived.java                     |     8 +
  src/org/python/core/PyListDerived.java                        |     8 +
  src/org/python/core/PyLongDerived.java                        |     8 +
  src/org/python/core/PyModuleDerived.java                      |     8 +
  src/org/python/core/PyObjectDerived.java                      |     8 +
  src/org/python/core/PyPropertyDerived.java                    |     8 +
  src/org/python/core/PySetDerived.java                         |     8 +
  src/org/python/core/PyStringDerived.java                      |     8 +
  src/org/python/core/PySuperDerived.java                       |     8 +
  src/org/python/core/PyTupleDerived.java                       |     8 +
  src/org/python/core/PyTypeDerived.java                        |     8 +
  src/org/python/core/PyUnicodeDerived.java                     |     8 +
  src/org/python/modules/_collections/PyDefaultDictDerived.java |     8 +
  src/org/python/modules/_collections/PyDequeDerived.java       |     8 +
  src/org/python/modules/_csv/PyDialectDerived.java             |     8 +
  src/org/python/modules/_fileio/PyFileIODerived.java           |     8 +
  src/org/python/modules/_functools/PyPartialDerived.java       |     8 +
  src/org/python/modules/_weakref/ReferenceTypeDerived.java     |     8 +
  src/org/python/modules/random/PyRandomDerived.java            |     8 +
  src/org/python/modules/thread/PyLocalDerived.java             |     8 +
  src/org/python/modules/zipimport/zipimporterDerived.java      |     8 +
  src/templates/object.derived                                  |     1 +
  122 files changed, 2085 insertions(+), 1116 deletions(-)


diff --git a/src/org/python/antlr/ast/AssertDerived.java b/src/org/python/antlr/ast/AssertDerived.java
--- a/src/org/python/antlr/ast/AssertDerived.java
+++ b/src/org/python/antlr/ast/AssertDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/AssignDerived.java b/src/org/python/antlr/ast/AssignDerived.java
--- a/src/org/python/antlr/ast/AssignDerived.java
+++ b/src/org/python/antlr/ast/AssignDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/AttributeDerived.java b/src/org/python/antlr/ast/AttributeDerived.java
--- a/src/org/python/antlr/ast/AttributeDerived.java
+++ b/src/org/python/antlr/ast/AttributeDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/AugAssignDerived.java b/src/org/python/antlr/ast/AugAssignDerived.java
--- a/src/org/python/antlr/ast/AugAssignDerived.java
+++ b/src/org/python/antlr/ast/AugAssignDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/BinOpDerived.java b/src/org/python/antlr/ast/BinOpDerived.java
--- a/src/org/python/antlr/ast/BinOpDerived.java
+++ b/src/org/python/antlr/ast/BinOpDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/BoolOpDerived.java b/src/org/python/antlr/ast/BoolOpDerived.java
--- a/src/org/python/antlr/ast/BoolOpDerived.java
+++ b/src/org/python/antlr/ast/BoolOpDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/BreakDerived.java b/src/org/python/antlr/ast/BreakDerived.java
--- a/src/org/python/antlr/ast/BreakDerived.java
+++ b/src/org/python/antlr/ast/BreakDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/CallDerived.java b/src/org/python/antlr/ast/CallDerived.java
--- a/src/org/python/antlr/ast/CallDerived.java
+++ b/src/org/python/antlr/ast/CallDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ClassDefDerived.java b/src/org/python/antlr/ast/ClassDefDerived.java
--- a/src/org/python/antlr/ast/ClassDefDerived.java
+++ b/src/org/python/antlr/ast/ClassDefDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/CompareDerived.java b/src/org/python/antlr/ast/CompareDerived.java
--- a/src/org/python/antlr/ast/CompareDerived.java
+++ b/src/org/python/antlr/ast/CompareDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ContinueDerived.java b/src/org/python/antlr/ast/ContinueDerived.java
--- a/src/org/python/antlr/ast/ContinueDerived.java
+++ b/src/org/python/antlr/ast/ContinueDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/DeleteDerived.java b/src/org/python/antlr/ast/DeleteDerived.java
--- a/src/org/python/antlr/ast/DeleteDerived.java
+++ b/src/org/python/antlr/ast/DeleteDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/DictDerived.java b/src/org/python/antlr/ast/DictDerived.java
--- a/src/org/python/antlr/ast/DictDerived.java
+++ b/src/org/python/antlr/ast/DictDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/EllipsisDerived.java b/src/org/python/antlr/ast/EllipsisDerived.java
--- a/src/org/python/antlr/ast/EllipsisDerived.java
+++ b/src/org/python/antlr/ast/EllipsisDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ExceptHandlerDerived.java b/src/org/python/antlr/ast/ExceptHandlerDerived.java
--- a/src/org/python/antlr/ast/ExceptHandlerDerived.java
+++ b/src/org/python/antlr/ast/ExceptHandlerDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ExecDerived.java b/src/org/python/antlr/ast/ExecDerived.java
--- a/src/org/python/antlr/ast/ExecDerived.java
+++ b/src/org/python/antlr/ast/ExecDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ExprDerived.java b/src/org/python/antlr/ast/ExprDerived.java
--- a/src/org/python/antlr/ast/ExprDerived.java
+++ b/src/org/python/antlr/ast/ExprDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ExpressionDerived.java b/src/org/python/antlr/ast/ExpressionDerived.java
--- a/src/org/python/antlr/ast/ExpressionDerived.java
+++ b/src/org/python/antlr/ast/ExpressionDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ExtSliceDerived.java b/src/org/python/antlr/ast/ExtSliceDerived.java
--- a/src/org/python/antlr/ast/ExtSliceDerived.java
+++ b/src/org/python/antlr/ast/ExtSliceDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ForDerived.java b/src/org/python/antlr/ast/ForDerived.java
--- a/src/org/python/antlr/ast/ForDerived.java
+++ b/src/org/python/antlr/ast/ForDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/FunctionDefDerived.java b/src/org/python/antlr/ast/FunctionDefDerived.java
--- a/src/org/python/antlr/ast/FunctionDefDerived.java
+++ b/src/org/python/antlr/ast/FunctionDefDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/GeneratorExpDerived.java b/src/org/python/antlr/ast/GeneratorExpDerived.java
--- a/src/org/python/antlr/ast/GeneratorExpDerived.java
+++ b/src/org/python/antlr/ast/GeneratorExpDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/GlobalDerived.java b/src/org/python/antlr/ast/GlobalDerived.java
--- a/src/org/python/antlr/ast/GlobalDerived.java
+++ b/src/org/python/antlr/ast/GlobalDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/IfDerived.java b/src/org/python/antlr/ast/IfDerived.java
--- a/src/org/python/antlr/ast/IfDerived.java
+++ b/src/org/python/antlr/ast/IfDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/IfExpDerived.java b/src/org/python/antlr/ast/IfExpDerived.java
--- a/src/org/python/antlr/ast/IfExpDerived.java
+++ b/src/org/python/antlr/ast/IfExpDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ImportDerived.java b/src/org/python/antlr/ast/ImportDerived.java
--- a/src/org/python/antlr/ast/ImportDerived.java
+++ b/src/org/python/antlr/ast/ImportDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ImportFromDerived.java b/src/org/python/antlr/ast/ImportFromDerived.java
--- a/src/org/python/antlr/ast/ImportFromDerived.java
+++ b/src/org/python/antlr/ast/ImportFromDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/IndexDerived.java b/src/org/python/antlr/ast/IndexDerived.java
--- a/src/org/python/antlr/ast/IndexDerived.java
+++ b/src/org/python/antlr/ast/IndexDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/InteractiveDerived.java b/src/org/python/antlr/ast/InteractiveDerived.java
--- a/src/org/python/antlr/ast/InteractiveDerived.java
+++ b/src/org/python/antlr/ast/InteractiveDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/LambdaDerived.java b/src/org/python/antlr/ast/LambdaDerived.java
--- a/src/org/python/antlr/ast/LambdaDerived.java
+++ b/src/org/python/antlr/ast/LambdaDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ListCompDerived.java b/src/org/python/antlr/ast/ListCompDerived.java
--- a/src/org/python/antlr/ast/ListCompDerived.java
+++ b/src/org/python/antlr/ast/ListCompDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ListDerived.java b/src/org/python/antlr/ast/ListDerived.java
--- a/src/org/python/antlr/ast/ListDerived.java
+++ b/src/org/python/antlr/ast/ListDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ModuleDerived.java b/src/org/python/antlr/ast/ModuleDerived.java
--- a/src/org/python/antlr/ast/ModuleDerived.java
+++ b/src/org/python/antlr/ast/ModuleDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/NameDerived.java b/src/org/python/antlr/ast/NameDerived.java
--- a/src/org/python/antlr/ast/NameDerived.java
+++ b/src/org/python/antlr/ast/NameDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/NumDerived.java b/src/org/python/antlr/ast/NumDerived.java
--- a/src/org/python/antlr/ast/NumDerived.java
+++ b/src/org/python/antlr/ast/NumDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/PassDerived.java b/src/org/python/antlr/ast/PassDerived.java
--- a/src/org/python/antlr/ast/PassDerived.java
+++ b/src/org/python/antlr/ast/PassDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/PrintDerived.java b/src/org/python/antlr/ast/PrintDerived.java
--- a/src/org/python/antlr/ast/PrintDerived.java
+++ b/src/org/python/antlr/ast/PrintDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/RaiseDerived.java b/src/org/python/antlr/ast/RaiseDerived.java
--- a/src/org/python/antlr/ast/RaiseDerived.java
+++ b/src/org/python/antlr/ast/RaiseDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ReprDerived.java b/src/org/python/antlr/ast/ReprDerived.java
--- a/src/org/python/antlr/ast/ReprDerived.java
+++ b/src/org/python/antlr/ast/ReprDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/ReturnDerived.java b/src/org/python/antlr/ast/ReturnDerived.java
--- a/src/org/python/antlr/ast/ReturnDerived.java
+++ b/src/org/python/antlr/ast/ReturnDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/SliceDerived.java b/src/org/python/antlr/ast/SliceDerived.java
--- a/src/org/python/antlr/ast/SliceDerived.java
+++ b/src/org/python/antlr/ast/SliceDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/StrDerived.java b/src/org/python/antlr/ast/StrDerived.java
--- a/src/org/python/antlr/ast/StrDerived.java
+++ b/src/org/python/antlr/ast/StrDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/SubscriptDerived.java b/src/org/python/antlr/ast/SubscriptDerived.java
--- a/src/org/python/antlr/ast/SubscriptDerived.java
+++ b/src/org/python/antlr/ast/SubscriptDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/SuiteDerived.java b/src/org/python/antlr/ast/SuiteDerived.java
--- a/src/org/python/antlr/ast/SuiteDerived.java
+++ b/src/org/python/antlr/ast/SuiteDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/TryExceptDerived.java b/src/org/python/antlr/ast/TryExceptDerived.java
--- a/src/org/python/antlr/ast/TryExceptDerived.java
+++ b/src/org/python/antlr/ast/TryExceptDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/TryFinallyDerived.java b/src/org/python/antlr/ast/TryFinallyDerived.java
--- a/src/org/python/antlr/ast/TryFinallyDerived.java
+++ b/src/org/python/antlr/ast/TryFinallyDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/TupleDerived.java b/src/org/python/antlr/ast/TupleDerived.java
--- a/src/org/python/antlr/ast/TupleDerived.java
+++ b/src/org/python/antlr/ast/TupleDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/UnaryOpDerived.java b/src/org/python/antlr/ast/UnaryOpDerived.java
--- a/src/org/python/antlr/ast/UnaryOpDerived.java
+++ b/src/org/python/antlr/ast/UnaryOpDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/WhileDerived.java b/src/org/python/antlr/ast/WhileDerived.java
--- a/src/org/python/antlr/ast/WhileDerived.java
+++ b/src/org/python/antlr/ast/WhileDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/WithDerived.java b/src/org/python/antlr/ast/WithDerived.java
--- a/src/org/python/antlr/ast/WithDerived.java
+++ b/src/org/python/antlr/ast/WithDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/YieldDerived.java b/src/org/python/antlr/ast/YieldDerived.java
--- a/src/org/python/antlr/ast/YieldDerived.java
+++ b/src/org/python/antlr/ast/YieldDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/aliasDerived.java b/src/org/python/antlr/ast/aliasDerived.java
--- a/src/org/python/antlr/ast/aliasDerived.java
+++ b/src/org/python/antlr/ast/aliasDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/argumentsDerived.java b/src/org/python/antlr/ast/argumentsDerived.java
--- a/src/org/python/antlr/ast/argumentsDerived.java
+++ b/src/org/python/antlr/ast/argumentsDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/comprehensionDerived.java b/src/org/python/antlr/ast/comprehensionDerived.java
--- a/src/org/python/antlr/ast/comprehensionDerived.java
+++ b/src/org/python/antlr/ast/comprehensionDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/ast/keywordDerived.java b/src/org/python/antlr/ast/keywordDerived.java
--- a/src/org/python/antlr/ast/keywordDerived.java
+++ b/src/org/python/antlr/ast/keywordDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/AddDerived.java b/src/org/python/antlr/op/AddDerived.java
--- a/src/org/python/antlr/op/AddDerived.java
+++ b/src/org/python/antlr/op/AddDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/AndDerived.java b/src/org/python/antlr/op/AndDerived.java
--- a/src/org/python/antlr/op/AndDerived.java
+++ b/src/org/python/antlr/op/AndDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/AugLoadDerived.java b/src/org/python/antlr/op/AugLoadDerived.java
--- a/src/org/python/antlr/op/AugLoadDerived.java
+++ b/src/org/python/antlr/op/AugLoadDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/AugStoreDerived.java b/src/org/python/antlr/op/AugStoreDerived.java
--- a/src/org/python/antlr/op/AugStoreDerived.java
+++ b/src/org/python/antlr/op/AugStoreDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/BitAndDerived.java b/src/org/python/antlr/op/BitAndDerived.java
--- a/src/org/python/antlr/op/BitAndDerived.java
+++ b/src/org/python/antlr/op/BitAndDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/BitOrDerived.java b/src/org/python/antlr/op/BitOrDerived.java
--- a/src/org/python/antlr/op/BitOrDerived.java
+++ b/src/org/python/antlr/op/BitOrDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/BitXorDerived.java b/src/org/python/antlr/op/BitXorDerived.java
--- a/src/org/python/antlr/op/BitXorDerived.java
+++ b/src/org/python/antlr/op/BitXorDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/DelDerived.java b/src/org/python/antlr/op/DelDerived.java
--- a/src/org/python/antlr/op/DelDerived.java
+++ b/src/org/python/antlr/op/DelDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/DivDerived.java b/src/org/python/antlr/op/DivDerived.java
--- a/src/org/python/antlr/op/DivDerived.java
+++ b/src/org/python/antlr/op/DivDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/EqDerived.java b/src/org/python/antlr/op/EqDerived.java
--- a/src/org/python/antlr/op/EqDerived.java
+++ b/src/org/python/antlr/op/EqDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/FloorDivDerived.java b/src/org/python/antlr/op/FloorDivDerived.java
--- a/src/org/python/antlr/op/FloorDivDerived.java
+++ b/src/org/python/antlr/op/FloorDivDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/GtDerived.java b/src/org/python/antlr/op/GtDerived.java
--- a/src/org/python/antlr/op/GtDerived.java
+++ b/src/org/python/antlr/op/GtDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/GtEDerived.java b/src/org/python/antlr/op/GtEDerived.java
--- a/src/org/python/antlr/op/GtEDerived.java
+++ b/src/org/python/antlr/op/GtEDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/InDerived.java b/src/org/python/antlr/op/InDerived.java
--- a/src/org/python/antlr/op/InDerived.java
+++ b/src/org/python/antlr/op/InDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/InvertDerived.java b/src/org/python/antlr/op/InvertDerived.java
--- a/src/org/python/antlr/op/InvertDerived.java
+++ b/src/org/python/antlr/op/InvertDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/IsDerived.java b/src/org/python/antlr/op/IsDerived.java
--- a/src/org/python/antlr/op/IsDerived.java
+++ b/src/org/python/antlr/op/IsDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/IsNotDerived.java b/src/org/python/antlr/op/IsNotDerived.java
--- a/src/org/python/antlr/op/IsNotDerived.java
+++ b/src/org/python/antlr/op/IsNotDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/LShiftDerived.java b/src/org/python/antlr/op/LShiftDerived.java
--- a/src/org/python/antlr/op/LShiftDerived.java
+++ b/src/org/python/antlr/op/LShiftDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/LoadDerived.java b/src/org/python/antlr/op/LoadDerived.java
--- a/src/org/python/antlr/op/LoadDerived.java
+++ b/src/org/python/antlr/op/LoadDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/LtDerived.java b/src/org/python/antlr/op/LtDerived.java
--- a/src/org/python/antlr/op/LtDerived.java
+++ b/src/org/python/antlr/op/LtDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/LtEDerived.java b/src/org/python/antlr/op/LtEDerived.java
--- a/src/org/python/antlr/op/LtEDerived.java
+++ b/src/org/python/antlr/op/LtEDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/ModDerived.java b/src/org/python/antlr/op/ModDerived.java
--- a/src/org/python/antlr/op/ModDerived.java
+++ b/src/org/python/antlr/op/ModDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/MultDerived.java b/src/org/python/antlr/op/MultDerived.java
--- a/src/org/python/antlr/op/MultDerived.java
+++ b/src/org/python/antlr/op/MultDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/NotDerived.java b/src/org/python/antlr/op/NotDerived.java
--- a/src/org/python/antlr/op/NotDerived.java
+++ b/src/org/python/antlr/op/NotDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/NotEqDerived.java b/src/org/python/antlr/op/NotEqDerived.java
--- a/src/org/python/antlr/op/NotEqDerived.java
+++ b/src/org/python/antlr/op/NotEqDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/NotInDerived.java b/src/org/python/antlr/op/NotInDerived.java
--- a/src/org/python/antlr/op/NotInDerived.java
+++ b/src/org/python/antlr/op/NotInDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/OrDerived.java b/src/org/python/antlr/op/OrDerived.java
--- a/src/org/python/antlr/op/OrDerived.java
+++ b/src/org/python/antlr/op/OrDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/ParamDerived.java b/src/org/python/antlr/op/ParamDerived.java
--- a/src/org/python/antlr/op/ParamDerived.java
+++ b/src/org/python/antlr/op/ParamDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/PowDerived.java b/src/org/python/antlr/op/PowDerived.java
--- a/src/org/python/antlr/op/PowDerived.java
+++ b/src/org/python/antlr/op/PowDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/RShiftDerived.java b/src/org/python/antlr/op/RShiftDerived.java
--- a/src/org/python/antlr/op/RShiftDerived.java
+++ b/src/org/python/antlr/op/RShiftDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/StoreDerived.java b/src/org/python/antlr/op/StoreDerived.java
--- a/src/org/python/antlr/op/StoreDerived.java
+++ b/src/org/python/antlr/op/StoreDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/SubDerived.java b/src/org/python/antlr/op/SubDerived.java
--- a/src/org/python/antlr/op/SubDerived.java
+++ b/src/org/python/antlr/op/SubDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/UAddDerived.java b/src/org/python/antlr/op/UAddDerived.java
--- a/src/org/python/antlr/op/UAddDerived.java
+++ b/src/org/python/antlr/op/UAddDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/antlr/op/USubDerived.java b/src/org/python/antlr/op/USubDerived.java
--- a/src/org/python/antlr/op/USubDerived.java
+++ b/src/org/python/antlr/op/USubDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/ClasspathPyImporterDerived.java b/src/org/python/core/ClasspathPyImporterDerived.java
--- a/src/org/python/core/ClasspathPyImporterDerived.java
+++ b/src/org/python/core/ClasspathPyImporterDerived.java
@@ -132,6 +132,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyArrayDerived.java b/src/org/python/core/PyArrayDerived.java
--- a/src/org/python/core/PyArrayDerived.java
+++ b/src/org/python/core/PyArrayDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyBaseExceptionDerived.java b/src/org/python/core/PyBaseExceptionDerived.java
--- a/src/org/python/core/PyBaseExceptionDerived.java
+++ b/src/org/python/core/PyBaseExceptionDerived.java
@@ -132,6 +132,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyByteArrayDerived.java b/src/org/python/core/PyByteArrayDerived.java
--- a/src/org/python/core/PyByteArrayDerived.java
+++ b/src/org/python/core/PyByteArrayDerived.java
@@ -1,1116 +1,1124 @@
-/* Generated file, do not modify.  See jython/src/templates/gderived.py. */
-package org.python.core;
-
-import java.io.Serializable;
-
-public class PyByteArrayDerived extends PyByteArray implements Slotted {
-
-    public PyObject getSlot(int index) {
-        return slots[index];
-    }
-
-    public void setSlot(int index,PyObject value) {
-        slots[index]=value;
-    }
-
-    private PyObject[]slots;
-
-    private PyObject dict;
-
-    public PyObject fastGetDict() {
-        return dict;
-    }
-
-    public PyObject getDict() {
-        return dict;
-    }
-
-    public void setDict(PyObject newDict) {
-        if (newDict instanceof PyStringMap||newDict instanceof PyDictionary) {
-            dict=newDict;
-        } else {
-            throw Py.TypeError("__dict__ must be set to a Dictionary "+newDict.getClass().getName());
-        }
-    }
-
-    public void delDict() {
-        // deleting an object's instance dict makes it grow a new one
-        dict=new PyStringMap();
-    }
-
-    public PyByteArrayDerived(PyType subtype) {
-        super(subtype);
-        slots=new PyObject[subtype.getNumSlots()];
-        dict=subtype.instDict();
-    }
-
-    public PyString __str__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__str__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyString)
-                return(PyString)res;
-            throw Py.TypeError("__str__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
-        }
-        return super.__str__();
-    }
-
-    public PyString __repr__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__repr__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyString)
-                return(PyString)res;
-            throw Py.TypeError("__repr__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
-        }
-        return super.__repr__();
-    }
-
-    public PyString __hex__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__hex__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyString)
-                return(PyString)res;
-            throw Py.TypeError("__hex__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
-        }
-        return super.__hex__();
-    }
-
-    public PyString __oct__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__oct__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyString)
-                return(PyString)res;
-            throw Py.TypeError("__oct__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
-        }
-        return super.__oct__();
-    }
-
-    public PyFloat __float__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__float__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyFloat)
-                return(PyFloat)res;
-            throw Py.TypeError("__float__"+" returned non-"+"float"+" (type "+res.getType().fastGetName()+")");
-        }
-        return super.__float__();
-    }
-
-    public PyComplex __complex__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__complex__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyComplex)
-                return(PyComplex)res;
-            throw Py.TypeError("__complex__"+" returned non-"+"complex"+" (type "+res.getType().fastGetName()+")");
-        }
-        return super.__complex__();
-    }
-
-    public PyObject __pos__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__pos__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__();
-        return super.__pos__();
-    }
-
-    public PyObject __neg__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__neg__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__();
-        return super.__neg__();
-    }
-
-    public PyObject __abs__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__abs__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__();
-        return super.__abs__();
-    }
-
-    public PyObject __invert__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__invert__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__();
-        return super.__invert__();
-    }
-
-    public PyObject __reduce__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__reduce__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__();
-        return super.__reduce__();
-    }
-
-    public PyObject __add__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__add__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__add__(other);
-    }
-
-    public PyObject __radd__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__radd__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__radd__(other);
-    }
-
-    public PyObject __sub__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__sub__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__sub__(other);
-    }
-
-    public PyObject __rsub__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rsub__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rsub__(other);
-    }
-
-    public PyObject __mul__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__mul__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__mul__(other);
-    }
-
-    public PyObject __rmul__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rmul__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rmul__(other);
-    }
-
-    public PyObject __div__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__div__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__div__(other);
-    }
-
-    public PyObject __rdiv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rdiv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rdiv__(other);
-    }
-
-    public PyObject __floordiv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__floordiv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__floordiv__(other);
-    }
-
-    public PyObject __rfloordiv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rfloordiv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rfloordiv__(other);
-    }
-
-    public PyObject __truediv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__truediv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__truediv__(other);
-    }
-
-    public PyObject __rtruediv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rtruediv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rtruediv__(other);
-    }
-
-    public PyObject __mod__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__mod__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__mod__(other);
-    }
-
-    public PyObject __rmod__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rmod__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rmod__(other);
-    }
-
-    public PyObject __divmod__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__divmod__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__divmod__(other);
-    }
-
-    public PyObject __rdivmod__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rdivmod__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rdivmod__(other);
-    }
-
-    public PyObject __rpow__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rpow__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rpow__(other);
-    }
-
-    public PyObject __lshift__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__lshift__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__lshift__(other);
-    }
-
-    public PyObject __rlshift__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rlshift__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rlshift__(other);
-    }
-
-    public PyObject __rshift__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rshift__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rshift__(other);
-    }
-
-    public PyObject __rrshift__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rrshift__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rrshift__(other);
-    }
-
-    public PyObject __and__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__and__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__and__(other);
-    }
-
-    public PyObject __rand__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rand__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rand__(other);
-    }
-
-    public PyObject __or__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__or__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__or__(other);
-    }
-
-    public PyObject __ror__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ror__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ror__(other);
-    }
-
-    public PyObject __xor__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__xor__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__xor__(other);
-    }
-
-    public PyObject __rxor__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__rxor__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__rxor__(other);
-    }
-
-    public PyObject __lt__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__lt__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__lt__(other);
-    }
-
-    public PyObject __le__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__le__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__le__(other);
-    }
-
-    public PyObject __gt__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__gt__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__gt__(other);
-    }
-
-    public PyObject __ge__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ge__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ge__(other);
-    }
-
-    public PyObject __eq__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__eq__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__eq__(other);
-    }
-
-    public PyObject __ne__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ne__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ne__(other);
-    }
-
-    public PyObject __iadd__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__iadd__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__iadd__(other);
-    }
-
-    public PyObject __isub__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__isub__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__isub__(other);
-    }
-
-    public PyObject __imul__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__imul__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__imul__(other);
-    }
-
-    public PyObject __idiv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__idiv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__idiv__(other);
-    }
-
-    public PyObject __ifloordiv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ifloordiv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ifloordiv__(other);
-    }
-
-    public PyObject __itruediv__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__itruediv__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__itruediv__(other);
-    }
-
-    public PyObject __imod__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__imod__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__imod__(other);
-    }
-
-    public PyObject __ipow__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ipow__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ipow__(other);
-    }
-
-    public PyObject __ilshift__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ilshift__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ilshift__(other);
-    }
-
-    public PyObject __irshift__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__irshift__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__irshift__(other);
-    }
-
-    public PyObject __iand__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__iand__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__iand__(other);
-    }
-
-    public PyObject __ior__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ior__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ior__(other);
-    }
-
-    public PyObject __ixor__(PyObject other) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__ixor__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(other);
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__ixor__(other);
-    }
-
-    public PyObject __int__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__int__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyInteger||res instanceof PyLong)
-                return res;
-            throw Py.TypeError("__int__"+" should return an integer");
-        }
-        return super.__int__();
-    }
-
-    public PyObject __long__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__long__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyLong||res instanceof PyInteger)
-                return res;
-            throw Py.TypeError("__long__"+" returned non-"+"long"+" (type "+res.getType().fastGetName()+")");
-        }
-        return super.__long__();
-    }
-
-    public int hashCode() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__hash__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyInteger) {
-                return((PyInteger)res).getValue();
-            } else
-                if (res instanceof PyLong) {
-                    return((PyLong)res).getValue().intValue();
-                }
-            throw Py.TypeError("__hash__ should return a int");
-        }
-        if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
-            throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
-        }
-        return super.hashCode();
-    }
-
-    public PyUnicode __unicode__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__unicode__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyUnicode)
-                return(PyUnicode)res;
-            if (res instanceof PyString)
-                return new PyUnicode((PyString)res);
-            throw Py.TypeError("__unicode__"+" should return a "+"unicode");
-        }
-        return super.__unicode__();
-    }
-
-    public int __cmp__(PyObject other) {
-        PyType self_type=getType();
-        PyObject[]where_type=new PyObject[1];
-        PyObject impl=self_type.lookup_where("__cmp__",where_type);
-        // Full Compatibility with CPython __cmp__:
-        // If the derived type don't override __cmp__, the
-        // *internal* super().__cmp__ should be called, not the
-        // exposed one. The difference is that the exposed __cmp__
-        // throws a TypeError if the argument is an instance of the same type.
-        if (impl==null||where_type[0]==TYPE||Py.isSubClass(TYPE,where_type[0])) {
-            return super.__cmp__(other);
-        }
-        PyObject res=impl.__get__(this,self_type).__call__(other);
-        if (res==Py.NotImplemented) {
-            return-2;
-        }
-        int c=res.asInt();
-        return c<0?-1:c>0?1:0;
-    }
-
-    public boolean __nonzero__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__nonzero__");
-        if (impl==null) {
-            impl=self_type.lookup("__len__");
-            if (impl==null)
-                return super.__nonzero__();
-        }
-        PyObject o=impl.__get__(this,self_type).__call__();
-        Class c=o.getClass();
-        if (c!=PyInteger.class&&c!=PyBoolean.class) {
-            throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName()));
-        }
-        return o.__nonzero__();
-    }
-
-    public boolean __contains__(PyObject o) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__contains__");
-        if (impl==null)
-            return super.__contains__(o);
-        return impl.__get__(this,self_type).__call__(o).__nonzero__();
-    }
-
-    public int __len__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__len__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyInteger)
-                return((PyInteger)res).getValue();
-            throw Py.TypeError("__len__ should return a int");
-        }
-        return super.__len__();
-    }
-
-    public PyObject __iter__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__iter__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__();
-        impl=self_type.lookup("__getitem__");
-        if (impl==null)
-            return super.__iter__();
-        return new PySequenceIter(this);
-    }
-
-    public PyObject __iternext__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("next");
-        if (impl!=null) {
-            try {
-                return impl.__get__(this,self_type).__call__();
-            } catch (PyException exc) {
-                if (exc.match(Py.StopIteration))
-                    return null;
-                throw exc;
-            }
-        }
-        return super.__iternext__(); // ???
-    }
-
-    public PyObject __finditem__(PyObject key) { // ???
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__getitem__");
-        if (impl!=null)
-            try {
-                return impl.__get__(this,self_type).__call__(key);
-            } catch (PyException exc) {
-                if (exc.match(Py.LookupError))
-                    return null;
-                throw exc;
-            }
-        return super.__finditem__(key);
-    }
-
-    public PyObject __finditem__(int key) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__getitem__");
-        if (impl!=null)
-            try {
-                return impl.__get__(this,self_type).__call__(new PyInteger(key));
-            } catch (PyException exc) {
-                if (exc.match(Py.LookupError))
-                    return null;
-                throw exc;
-            }
-        return super.__finditem__(key);
-    }
-
-    public PyObject __getitem__(PyObject key) {
-        // Same as __finditem__, without swallowing LookupErrors. This allows
-        // __getitem__ implementations written in Python to raise custom
-        // exceptions (such as subclasses of KeyError).
-        //
-        // We are forced to duplicate the code, instead of defining __finditem__
-        // in terms of __getitem__. That's because PyObject defines __getitem__
-        // in terms of __finditem__. Therefore, we would end with an infinite
-        // loop when self_type.lookup("__getitem__") returns null:
-        //
-        //  __getitem__ -> super.__getitem__ -> __finditem__ -> __getitem__
-        //
-        // By duplicating the (short) lookup and call code, we are safe, because
-        // the call chains will be:
-        //
-        // __finditem__ -> super.__finditem__
-        //
-        // __getitem__ -> super.__getitem__ -> __finditem__ -> super.__finditem__
-
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__getitem__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__(key);
-        return super.__getitem__(key);
-    }
-
-    public void __setitem__(PyObject key,PyObject value) { // ???
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__setitem__");
-        if (impl!=null) {
-            impl.__get__(this,self_type).__call__(key,value);
-            return;
-        }
-        super.__setitem__(key,value);
-    }
-
-    public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ???
-        if (step!=null) {
-            return __getitem__(new PySlice(start,stop,step));
-        }
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__getslice__");
-        if (impl!=null) {
-            PyObject[]indices=PySlice.indices2(this,start,stop);
-            return impl.__get__(this,self_type).__call__(indices[0],indices[1]);
-        }
-        return super.__getslice__(start,stop,step);
-    }
-
-    public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) {
-        if (step!=null) {
-            __setitem__(new PySlice(start,stop,step),value);
-            return;
-        }
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__setslice__");
-        if (impl!=null) {
-            PyObject[]indices=PySlice.indices2(this,start,stop);
-            impl.__get__(this,self_type).__call__(indices[0],indices[1],value);
-            return;
-        }
-        super.__setslice__(start,stop,step,value);
-    }
-
-    public void __delslice__(PyObject start,PyObject stop,PyObject step) {
-        if (step!=null) {
-            __delitem__(new PySlice(start,stop,step));
-            return;
-        }
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__delslice__");
-        if (impl!=null) {
-            PyObject[]indices=PySlice.indices2(this,start,stop);
-            impl.__get__(this,self_type).__call__(indices[0],indices[1]);
-            return;
-        }
-        super.__delslice__(start,stop,step);
-    }
-
-    public void __delitem__(PyObject key) { // ???
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__delitem__");
-        if (impl!=null) {
-            impl.__get__(this,self_type).__call__(key);
-            return;
-        }
-        super.__delitem__(key);
-    }
-
-    public PyObject __call__(PyObject args[],String keywords[]) {
-        ThreadState ts=Py.getThreadState();
-        if (ts.recursion_depth++>ts.systemState.getrecursionlimit())
-            throw Py.RuntimeError("maximum __call__ recursion depth exceeded");
-        try {
-            PyType self_type=getType();
-            PyObject impl=self_type.lookup("__call__");
-            if (impl!=null)
-                return impl.__get__(this,self_type).__call__(args,keywords);
-            return super.__call__(args,keywords);
-        } finally {
-            --ts.recursion_depth;
-        }
-    }
-
-    public PyObject __findattr_ex__(String name) {
-        return Deriveds.__findattr_ex__(this,name);
-    }
-
-    public void __setattr__(String name,PyObject value) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__setattr__");
-        if (impl!=null) {
-            impl.__get__(this,self_type).__call__(PyString.fromInterned(name),value);
-            return;
-        }
-        super.__setattr__(name,value);
-    }
-
-    public void __delattr__(String name) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__delattr__");
-        if (impl!=null) {
-            impl.__get__(this,self_type).__call__(PyString.fromInterned(name));
-            return;
-        }
-        super.__delattr__(name);
-    }
-
-    public PyObject __get__(PyObject obj,PyObject type) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__get__");
-        if (impl!=null) {
-            if (obj==null)
-                obj=Py.None;
-            if (type==null)
-                type=Py.None;
-            return impl.__get__(this,self_type).__call__(obj,type);
-        }
-        return super.__get__(obj,type);
-    }
-
-    public void __set__(PyObject obj,PyObject value) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__set__");
-        if (impl!=null) {
-            impl.__get__(this,self_type).__call__(obj,value);
-            return;
-        }
-        super.__set__(obj,value);
-    }
-
-    public void __delete__(PyObject obj) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__delete__");
-        if (impl!=null) {
-            impl.__get__(this,self_type).__call__(obj);
-            return;
-        }
-        super.__delete__(obj);
-    }
-
-    public PyObject __pow__(PyObject other,PyObject modulo) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__pow__");
-        if (impl!=null) {
-            PyObject res;
-            if (modulo==null) {
-                res=impl.__get__(this,self_type).__call__(other);
-            } else {
-                res=impl.__get__(this,self_type).__call__(other,modulo);
-            }
-            if (res==Py.NotImplemented)
-                return null;
-            return res;
-        }
-        return super.__pow__(other,modulo);
-    }
-
-    public void dispatch__init__(PyObject[]args,String[]keywords) {
-        Deriveds.dispatch__init__(this,args,keywords);
-    }
-
-    public PyObject __index__() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__index__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (res instanceof PyInteger||res instanceof PyLong) {
-                return res;
-            }
-            throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName()));
-        }
-        return super.__index__();
-    }
-
-    public Object __tojava__(Class c) {
-        // If we are not being asked by the "default" conversion to java, then
-        // we can provide this as the result, as long as it is a instance of the
-        // specified class. Without this, derived.__tojava__(PyObject.class)
-        // would broke. (And that's not pure speculation: PyReflectedFunction's
-        // ReflectedArgs asks for things like that).
-        if ((c!=Object.class)&&(c!=Serializable.class)&&(c.isInstance(this))) {
-            return this;
-        }
-        // Otherwise, we call the derived __tojava__, if it exists:
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__tojava__");
-        if (impl!=null)
-            return impl.__get__(this,self_type).__call__(Py.java2py(c)).__tojava__(Object.class);
-        return super.__tojava__(c);
-    }
-
-    public Object __coerce_ex__(PyObject o) {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__coerce__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__(o);
-            if (res==Py.NotImplemented)
-                return Py.None;
-            if (!(res instanceof PyTuple))
-                throw Py.TypeError("__coerce__ didn't return a 2-tuple");
-            return((PyTuple)res).getArray();
-        }
-        return super.__coerce_ex__(o);
-    }
-
-    public String toString() {
-        PyType self_type=getType();
-        PyObject impl=self_type.lookup("__repr__");
-        if (impl!=null) {
-            PyObject res=impl.__get__(this,self_type).__call__();
-            if (!(res instanceof PyString))
-                throw Py.TypeError("__repr__ returned non-string (type "+res.getType().fastGetName()+")");
-            return((PyString)res).toString();
-        }
-        return super.toString();
-    }
-
-}
+/* Generated file, do not modify.  See jython/src/templates/gderived.py. */
+package org.python.core;
+
+import java.io.Serializable;
+
+public class PyByteArrayDerived extends PyByteArray implements Slotted {
+
+    public PyObject getSlot(int index) {
+        return slots[index];
+    }
+
+    public void setSlot(int index,PyObject value) {
+        slots[index]=value;
+    }
+
+    private PyObject[]slots;
+
+    private PyObject dict;
+
+    public PyObject fastGetDict() {
+        return dict;
+    }
+
+    public PyObject getDict() {
+        return dict;
+    }
+
+    public void setDict(PyObject newDict) {
+        if (newDict instanceof PyStringMap||newDict instanceof PyDictionary) {
+            dict=newDict;
+        } else {
+            throw Py.TypeError("__dict__ must be set to a Dictionary "+newDict.getClass().getName());
+        }
+    }
+
+    public void delDict() {
+        // deleting an object's instance dict makes it grow a new one
+        dict=new PyStringMap();
+    }
+
+    public PyByteArrayDerived(PyType subtype) {
+        super(subtype);
+        slots=new PyObject[subtype.getNumSlots()];
+        dict=subtype.instDict();
+    }
+
+    public PyString __str__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__str__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyString)
+                return(PyString)res;
+            throw Py.TypeError("__str__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
+        }
+        return super.__str__();
+    }
+
+    public PyString __repr__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__repr__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyString)
+                return(PyString)res;
+            throw Py.TypeError("__repr__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
+        }
+        return super.__repr__();
+    }
+
+    public PyString __hex__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__hex__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyString)
+                return(PyString)res;
+            throw Py.TypeError("__hex__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
+        }
+        return super.__hex__();
+    }
+
+    public PyString __oct__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__oct__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyString)
+                return(PyString)res;
+            throw Py.TypeError("__oct__"+" returned non-"+"string"+" (type "+res.getType().fastGetName()+")");
+        }
+        return super.__oct__();
+    }
+
+    public PyFloat __float__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__float__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyFloat)
+                return(PyFloat)res;
+            throw Py.TypeError("__float__"+" returned non-"+"float"+" (type "+res.getType().fastGetName()+")");
+        }
+        return super.__float__();
+    }
+
+    public PyComplex __complex__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__complex__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyComplex)
+                return(PyComplex)res;
+            throw Py.TypeError("__complex__"+" returned non-"+"complex"+" (type "+res.getType().fastGetName()+")");
+        }
+        return super.__complex__();
+    }
+
+    public PyObject __pos__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__pos__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__pos__();
+    }
+
+    public PyObject __neg__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__neg__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__neg__();
+    }
+
+    public PyObject __abs__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__abs__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__abs__();
+    }
+
+    public PyObject __invert__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__invert__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__invert__();
+    }
+
+    public PyObject __reduce__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__reduce__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__reduce__();
+    }
+
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
+    public PyObject __add__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__add__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__add__(other);
+    }
+
+    public PyObject __radd__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__radd__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__radd__(other);
+    }
+
+    public PyObject __sub__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__sub__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__sub__(other);
+    }
+
+    public PyObject __rsub__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rsub__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rsub__(other);
+    }
+
+    public PyObject __mul__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__mul__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__mul__(other);
+    }
+
+    public PyObject __rmul__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rmul__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rmul__(other);
+    }
+
+    public PyObject __div__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__div__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__div__(other);
+    }
+
+    public PyObject __rdiv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rdiv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rdiv__(other);
+    }
+
+    public PyObject __floordiv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__floordiv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__floordiv__(other);
+    }
+
+    public PyObject __rfloordiv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rfloordiv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rfloordiv__(other);
+    }
+
+    public PyObject __truediv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__truediv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__truediv__(other);
+    }
+
+    public PyObject __rtruediv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rtruediv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rtruediv__(other);
+    }
+
+    public PyObject __mod__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__mod__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__mod__(other);
+    }
+
+    public PyObject __rmod__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rmod__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rmod__(other);
+    }
+
+    public PyObject __divmod__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__divmod__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__divmod__(other);
+    }
+
+    public PyObject __rdivmod__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rdivmod__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rdivmod__(other);
+    }
+
+    public PyObject __rpow__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rpow__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rpow__(other);
+    }
+
+    public PyObject __lshift__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__lshift__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__lshift__(other);
+    }
+
+    public PyObject __rlshift__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rlshift__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rlshift__(other);
+    }
+
+    public PyObject __rshift__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rshift__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rshift__(other);
+    }
+
+    public PyObject __rrshift__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rrshift__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rrshift__(other);
+    }
+
+    public PyObject __and__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__and__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__and__(other);
+    }
+
+    public PyObject __rand__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rand__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rand__(other);
+    }
+
+    public PyObject __or__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__or__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__or__(other);
+    }
+
+    public PyObject __ror__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ror__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ror__(other);
+    }
+
+    public PyObject __xor__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__xor__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__xor__(other);
+    }
+
+    public PyObject __rxor__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__rxor__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__rxor__(other);
+    }
+
+    public PyObject __lt__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__lt__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__lt__(other);
+    }
+
+    public PyObject __le__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__le__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__le__(other);
+    }
+
+    public PyObject __gt__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__gt__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__gt__(other);
+    }
+
+    public PyObject __ge__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ge__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ge__(other);
+    }
+
+    public PyObject __eq__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__eq__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__eq__(other);
+    }
+
+    public PyObject __ne__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ne__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ne__(other);
+    }
+
+    public PyObject __iadd__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__iadd__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__iadd__(other);
+    }
+
+    public PyObject __isub__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__isub__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__isub__(other);
+    }
+
+    public PyObject __imul__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__imul__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__imul__(other);
+    }
+
+    public PyObject __idiv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__idiv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__idiv__(other);
+    }
+
+    public PyObject __ifloordiv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ifloordiv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ifloordiv__(other);
+    }
+
+    public PyObject __itruediv__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__itruediv__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__itruediv__(other);
+    }
+
+    public PyObject __imod__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__imod__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__imod__(other);
+    }
+
+    public PyObject __ipow__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ipow__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ipow__(other);
+    }
+
+    public PyObject __ilshift__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ilshift__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ilshift__(other);
+    }
+
+    public PyObject __irshift__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__irshift__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__irshift__(other);
+    }
+
+    public PyObject __iand__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__iand__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__iand__(other);
+    }
+
+    public PyObject __ior__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ior__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ior__(other);
+    }
+
+    public PyObject __ixor__(PyObject other) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__ixor__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(other);
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__ixor__(other);
+    }
+
+    public PyObject __int__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__int__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyInteger||res instanceof PyLong)
+                return res;
+            throw Py.TypeError("__int__"+" should return an integer");
+        }
+        return super.__int__();
+    }
+
+    public PyObject __long__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__long__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyLong||res instanceof PyInteger)
+                return res;
+            throw Py.TypeError("__long__"+" returned non-"+"long"+" (type "+res.getType().fastGetName()+")");
+        }
+        return super.__long__();
+    }
+
+    public int hashCode() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__hash__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyInteger) {
+                return((PyInteger)res).getValue();
+            } else
+                if (res instanceof PyLong) {
+                    return((PyLong)res).getValue().intValue();
+                }
+            throw Py.TypeError("__hash__ should return a int");
+        }
+        if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) {
+            throw Py.TypeError(String.format("unhashable type: '%.200s'",getType().fastGetName()));
+        }
+        return super.hashCode();
+    }
+
+    public PyUnicode __unicode__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__unicode__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyUnicode)
+                return(PyUnicode)res;
+            if (res instanceof PyString)
+                return new PyUnicode((PyString)res);
+            throw Py.TypeError("__unicode__"+" should return a "+"unicode");
+        }
+        return super.__unicode__();
+    }
+
+    public int __cmp__(PyObject other) {
+        PyType self_type=getType();
+        PyObject[]where_type=new PyObject[1];
+        PyObject impl=self_type.lookup_where("__cmp__",where_type);
+        // Full Compatibility with CPython __cmp__:
+        // If the derived type don't override __cmp__, the
+        // *internal* super().__cmp__ should be called, not the
+        // exposed one. The difference is that the exposed __cmp__
+        // throws a TypeError if the argument is an instance of the same type.
+        if (impl==null||where_type[0]==TYPE||Py.isSubClass(TYPE,where_type[0])) {
+            return super.__cmp__(other);
+        }
+        PyObject res=impl.__get__(this,self_type).__call__(other);
+        if (res==Py.NotImplemented) {
+            return-2;
+        }
+        int c=res.asInt();
+        return c<0?-1:c>0?1:0;
+    }
+
+    public boolean __nonzero__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__nonzero__");
+        if (impl==null) {
+            impl=self_type.lookup("__len__");
+            if (impl==null)
+                return super.__nonzero__();
+        }
+        PyObject o=impl.__get__(this,self_type).__call__();
+        Class c=o.getClass();
+        if (c!=PyInteger.class&&c!=PyBoolean.class) {
+            throw Py.TypeError(String.format("__nonzero__ should return bool or int, returned %s",self_type.getName()));
+        }
+        return o.__nonzero__();
+    }
+
+    public boolean __contains__(PyObject o) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__contains__");
+        if (impl==null)
+            return super.__contains__(o);
+        return impl.__get__(this,self_type).__call__(o).__nonzero__();
+    }
+
+    public int __len__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__len__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyInteger)
+                return((PyInteger)res).getValue();
+            throw Py.TypeError("__len__ should return a int");
+        }
+        return super.__len__();
+    }
+
+    public PyObject __iter__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__iter__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        impl=self_type.lookup("__getitem__");
+        if (impl==null)
+            return super.__iter__();
+        return new PySequenceIter(this);
+    }
+
+    public PyObject __iternext__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("next");
+        if (impl!=null) {
+            try {
+                return impl.__get__(this,self_type).__call__();
+            } catch (PyException exc) {
+                if (exc.match(Py.StopIteration))
+                    return null;
+                throw exc;
+            }
+        }
+        return super.__iternext__(); // ???
+    }
+
+    public PyObject __finditem__(PyObject key) { // ???
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__getitem__");
+        if (impl!=null)
+            try {
+                return impl.__get__(this,self_type).__call__(key);
+            } catch (PyException exc) {
+                if (exc.match(Py.LookupError))
+                    return null;
+                throw exc;
+            }
+        return super.__finditem__(key);
+    }
+
+    public PyObject __finditem__(int key) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__getitem__");
+        if (impl!=null)
+            try {
+                return impl.__get__(this,self_type).__call__(new PyInteger(key));
+            } catch (PyException exc) {
+                if (exc.match(Py.LookupError))
+                    return null;
+                throw exc;
+            }
+        return super.__finditem__(key);
+    }
+
+    public PyObject __getitem__(PyObject key) {
+        // Same as __finditem__, without swallowing LookupErrors. This allows
+        // __getitem__ implementations written in Python to raise custom
+        // exceptions (such as subclasses of KeyError).
+        //
+        // We are forced to duplicate the code, instead of defining __finditem__
+        // in terms of __getitem__. That's because PyObject defines __getitem__
+        // in terms of __finditem__. Therefore, we would end with an infinite
+        // loop when self_type.lookup("__getitem__") returns null:
+        //
+        //  __getitem__ -> super.__getitem__ -> __finditem__ -> __getitem__
+        //
+        // By duplicating the (short) lookup and call code, we are safe, because
+        // the call chains will be:
+        //
+        // __finditem__ -> super.__finditem__
+        //
+        // __getitem__ -> super.__getitem__ -> __finditem__ -> super.__finditem__
+
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__getitem__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__(key);
+        return super.__getitem__(key);
+    }
+
+    public void __setitem__(PyObject key,PyObject value) { // ???
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__setitem__");
+        if (impl!=null) {
+            impl.__get__(this,self_type).__call__(key,value);
+            return;
+        }
+        super.__setitem__(key,value);
+    }
+
+    public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ???
+        if (step!=null) {
+            return __getitem__(new PySlice(start,stop,step));
+        }
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__getslice__");
+        if (impl!=null) {
+            PyObject[]indices=PySlice.indices2(this,start,stop);
+            return impl.__get__(this,self_type).__call__(indices[0],indices[1]);
+        }
+        return super.__getslice__(start,stop,step);
+    }
+
+    public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) {
+        if (step!=null) {
+            __setitem__(new PySlice(start,stop,step),value);
+            return;
+        }
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__setslice__");
+        if (impl!=null) {
+            PyObject[]indices=PySlice.indices2(this,start,stop);
+            impl.__get__(this,self_type).__call__(indices[0],indices[1],value);
+            return;
+        }
+        super.__setslice__(start,stop,step,value);
+    }
+
+    public void __delslice__(PyObject start,PyObject stop,PyObject step) {
+        if (step!=null) {
+            __delitem__(new PySlice(start,stop,step));
+            return;
+        }
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__delslice__");
+        if (impl!=null) {
+            PyObject[]indices=PySlice.indices2(this,start,stop);
+            impl.__get__(this,self_type).__call__(indices[0],indices[1]);
+            return;
+        }
+        super.__delslice__(start,stop,step);
+    }
+
+    public void __delitem__(PyObject key) { // ???
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__delitem__");
+        if (impl!=null) {
+            impl.__get__(this,self_type).__call__(key);
+            return;
+        }
+        super.__delitem__(key);
+    }
+
+    public PyObject __call__(PyObject args[],String keywords[]) {
+        ThreadState ts=Py.getThreadState();
+        if (ts.recursion_depth++>ts.systemState.getrecursionlimit())
+            throw Py.RuntimeError("maximum __call__ recursion depth exceeded");
+        try {
+            PyType self_type=getType();
+            PyObject impl=self_type.lookup("__call__");
+            if (impl!=null)
+                return impl.__get__(this,self_type).__call__(args,keywords);
+            return super.__call__(args,keywords);
+        } finally {
+            --ts.recursion_depth;
+        }
+    }
+
+    public PyObject __findattr_ex__(String name) {
+        return Deriveds.__findattr_ex__(this,name);
+    }
+
+    public void __setattr__(String name,PyObject value) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__setattr__");
+        if (impl!=null) {
+            impl.__get__(this,self_type).__call__(PyString.fromInterned(name),value);
+            return;
+        }
+        super.__setattr__(name,value);
+    }
+
+    public void __delattr__(String name) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__delattr__");
+        if (impl!=null) {
+            impl.__get__(this,self_type).__call__(PyString.fromInterned(name));
+            return;
+        }
+        super.__delattr__(name);
+    }
+
+    public PyObject __get__(PyObject obj,PyObject type) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__get__");
+        if (impl!=null) {
+            if (obj==null)
+                obj=Py.None;
+            if (type==null)
+                type=Py.None;
+            return impl.__get__(this,self_type).__call__(obj,type);
+        }
+        return super.__get__(obj,type);
+    }
+
+    public void __set__(PyObject obj,PyObject value) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__set__");
+        if (impl!=null) {
+            impl.__get__(this,self_type).__call__(obj,value);
+            return;
+        }
+        super.__set__(obj,value);
+    }
+
+    public void __delete__(PyObject obj) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__delete__");
+        if (impl!=null) {
+            impl.__get__(this,self_type).__call__(obj);
+            return;
+        }
+        super.__delete__(obj);
+    }
+
+    public PyObject __pow__(PyObject other,PyObject modulo) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__pow__");
+        if (impl!=null) {
+            PyObject res;
+            if (modulo==null) {
+                res=impl.__get__(this,self_type).__call__(other);
+            } else {
+                res=impl.__get__(this,self_type).__call__(other,modulo);
+            }
+            if (res==Py.NotImplemented)
+                return null;
+            return res;
+        }
+        return super.__pow__(other,modulo);
+    }
+
+    public void dispatch__init__(PyObject[]args,String[]keywords) {
+        Deriveds.dispatch__init__(this,args,keywords);
+    }
+
+    public PyObject __index__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__index__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (res instanceof PyInteger||res instanceof PyLong) {
+                return res;
+            }
+            throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName()));
+        }
+        return super.__index__();
+    }
+
+    public Object __tojava__(Class c) {
+        // If we are not being asked by the "default" conversion to java, then
+        // we can provide this as the result, as long as it is a instance of the
+        // specified class. Without this, derived.__tojava__(PyObject.class)
+        // would broke. (And that's not pure speculation: PyReflectedFunction's
+        // ReflectedArgs asks for things like that).
+        if ((c!=Object.class)&&(c!=Serializable.class)&&(c.isInstance(this))) {
+            return this;
+        }
+        // Otherwise, we call the derived __tojava__, if it exists:
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__tojava__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__(Py.java2py(c)).__tojava__(Object.class);
+        return super.__tojava__(c);
+    }
+
+    public Object __coerce_ex__(PyObject o) {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__coerce__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__(o);
+            if (res==Py.NotImplemented)
+                return Py.None;
+            if (!(res instanceof PyTuple))
+                throw Py.TypeError("__coerce__ didn't return a 2-tuple");
+            return((PyTuple)res).getArray();
+        }
+        return super.__coerce_ex__(o);
+    }
+
+    public String toString() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__repr__");
+        if (impl!=null) {
+            PyObject res=impl.__get__(this,self_type).__call__();
+            if (!(res instanceof PyString))
+                throw Py.TypeError("__repr__ returned non-string (type "+res.getType().fastGetName()+")");
+            return((PyString)res).toString();
+        }
+        return super.toString();
+    }
+
+}
diff --git a/src/org/python/core/PyClassMethodDerived.java b/src/org/python/core/PyClassMethodDerived.java
--- a/src/org/python/core/PyClassMethodDerived.java
+++ b/src/org/python/core/PyClassMethodDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyComplexDerived.java b/src/org/python/core/PyComplexDerived.java
--- a/src/org/python/core/PyComplexDerived.java
+++ b/src/org/python/core/PyComplexDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyDictionaryDerived.java b/src/org/python/core/PyDictionaryDerived.java
--- a/src/org/python/core/PyDictionaryDerived.java
+++ b/src/org/python/core/PyDictionaryDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyEnumerateDerived.java b/src/org/python/core/PyEnumerateDerived.java
--- a/src/org/python/core/PyEnumerateDerived.java
+++ b/src/org/python/core/PyEnumerateDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyFileDerived.java b/src/org/python/core/PyFileDerived.java
--- a/src/org/python/core/PyFileDerived.java
+++ b/src/org/python/core/PyFileDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyFloatDerived.java b/src/org/python/core/PyFloatDerived.java
--- a/src/org/python/core/PyFloatDerived.java
+++ b/src/org/python/core/PyFloatDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyFrozenSetDerived.java b/src/org/python/core/PyFrozenSetDerived.java
--- a/src/org/python/core/PyFrozenSetDerived.java
+++ b/src/org/python/core/PyFrozenSetDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyIntegerDerived.java b/src/org/python/core/PyIntegerDerived.java
--- a/src/org/python/core/PyIntegerDerived.java
+++ b/src/org/python/core/PyIntegerDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyListDerived.java b/src/org/python/core/PyListDerived.java
--- a/src/org/python/core/PyListDerived.java
+++ b/src/org/python/core/PyListDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyLongDerived.java b/src/org/python/core/PyLongDerived.java
--- a/src/org/python/core/PyLongDerived.java
+++ b/src/org/python/core/PyLongDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyModuleDerived.java b/src/org/python/core/PyModuleDerived.java
--- a/src/org/python/core/PyModuleDerived.java
+++ b/src/org/python/core/PyModuleDerived.java
@@ -132,6 +132,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyObjectDerived.java b/src/org/python/core/PyObjectDerived.java
--- a/src/org/python/core/PyObjectDerived.java
+++ b/src/org/python/core/PyObjectDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyPropertyDerived.java b/src/org/python/core/PyPropertyDerived.java
--- a/src/org/python/core/PyPropertyDerived.java
+++ b/src/org/python/core/PyPropertyDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PySetDerived.java b/src/org/python/core/PySetDerived.java
--- a/src/org/python/core/PySetDerived.java
+++ b/src/org/python/core/PySetDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyStringDerived.java b/src/org/python/core/PyStringDerived.java
--- a/src/org/python/core/PyStringDerived.java
+++ b/src/org/python/core/PyStringDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PySuperDerived.java b/src/org/python/core/PySuperDerived.java
--- a/src/org/python/core/PySuperDerived.java
+++ b/src/org/python/core/PySuperDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyTupleDerived.java b/src/org/python/core/PyTupleDerived.java
--- a/src/org/python/core/PyTupleDerived.java
+++ b/src/org/python/core/PyTupleDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyTypeDerived.java b/src/org/python/core/PyTypeDerived.java
--- a/src/org/python/core/PyTypeDerived.java
+++ b/src/org/python/core/PyTypeDerived.java
@@ -132,6 +132,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/core/PyUnicodeDerived.java b/src/org/python/core/PyUnicodeDerived.java
--- a/src/org/python/core/PyUnicodeDerived.java
+++ b/src/org/python/core/PyUnicodeDerived.java
@@ -156,6 +156,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/_collections/PyDefaultDictDerived.java b/src/org/python/modules/_collections/PyDefaultDictDerived.java
--- a/src/org/python/modules/_collections/PyDefaultDictDerived.java
+++ b/src/org/python/modules/_collections/PyDefaultDictDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/_collections/PyDequeDerived.java b/src/org/python/modules/_collections/PyDequeDerived.java
--- a/src/org/python/modules/_collections/PyDequeDerived.java
+++ b/src/org/python/modules/_collections/PyDequeDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/_csv/PyDialectDerived.java b/src/org/python/modules/_csv/PyDialectDerived.java
--- a/src/org/python/modules/_csv/PyDialectDerived.java
+++ b/src/org/python/modules/_csv/PyDialectDerived.java
@@ -133,6 +133,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/_fileio/PyFileIODerived.java b/src/org/python/modules/_fileio/PyFileIODerived.java
--- a/src/org/python/modules/_fileio/PyFileIODerived.java
+++ b/src/org/python/modules/_fileio/PyFileIODerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/_functools/PyPartialDerived.java b/src/org/python/modules/_functools/PyPartialDerived.java
--- a/src/org/python/modules/_functools/PyPartialDerived.java
+++ b/src/org/python/modules/_functools/PyPartialDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/_weakref/ReferenceTypeDerived.java b/src/org/python/modules/_weakref/ReferenceTypeDerived.java
--- a/src/org/python/modules/_weakref/ReferenceTypeDerived.java
+++ b/src/org/python/modules/_weakref/ReferenceTypeDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/random/PyRandomDerived.java b/src/org/python/modules/random/PyRandomDerived.java
--- a/src/org/python/modules/random/PyRandomDerived.java
+++ b/src/org/python/modules/random/PyRandomDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/thread/PyLocalDerived.java b/src/org/python/modules/thread/PyLocalDerived.java
--- a/src/org/python/modules/thread/PyLocalDerived.java
+++ b/src/org/python/modules/thread/PyLocalDerived.java
@@ -133,6 +133,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/org/python/modules/zipimport/zipimporterDerived.java b/src/org/python/modules/zipimport/zipimporterDerived.java
--- a/src/org/python/modules/zipimport/zipimporterDerived.java
+++ b/src/org/python/modules/zipimport/zipimporterDerived.java
@@ -157,6 +157,14 @@
         return super.__reduce__();
     }
 
+    public PyObject __dir__() {
+        PyType self_type=getType();
+        PyObject impl=self_type.lookup("__dir__");
+        if (impl!=null)
+            return impl.__get__(this,self_type).__call__();
+        return super.__dir__();
+    }
+
     public PyObject __add__(PyObject other) {
         PyType self_type=getType();
         PyObject impl=self_type.lookup("__add__");
diff --git a/src/templates/object.derived b/src/templates/object.derived
--- a/src/templates/object.derived
+++ b/src/templates/object.derived
@@ -12,6 +12,7 @@
 unary1: __abs__
 unary1: __invert__
 unary1: __reduce__
+unary1: __dir__
 binary: __add__ __radd__ \
   __sub__ __rsub__ \
   __mul__ __rmul__ \

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list