+    str_type = str(type(object))
+    if str_type == "<type 'array'>":
+        attributes += dir(object)
+    else:
+        attrdict = getAllAttributeNames(object)
+        # Store the object's dir.
+        object_dir = dir(object)
+        for (obj_type_name, technique, count), attrlist in attrdict.items():
+            # This complexity is necessary to avoid accessing all the
+            # attributes of the object.  This is very handy for objects
+            # whose attributes are lazily evaluated.
+            if type(object).__name__ == obj_type_name and technique == 'dir':
+                attributes += attrlist
+            else:
+                attributes += [attr for attr in attrlist \
+                               if attr not in object_dir and hasattr(object, attr)]
+