File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,27 +11,27 @@ def getattr(x, name):
1111def listattrs (x ):
1212 try :
1313 dictkeys = x .__dict__ .keys ()
14- except (NameError , TypeError ):
14+ except (AttributeError , TypeError ):
1515 dictkeys = []
1616 #
1717 try :
1818 methods = x .__methods__
19- except (NameError , TypeError ):
19+ except (AttributeError , TypeError ):
2020 methods = []
2121 #
2222 try :
2323 members = x .__members__
24- except (NameError , TypeError ):
24+ except (AttributeError , TypeError ):
2525 members = []
2626 #
2727 try :
2828 the_class = x .__class__
29- except (NameError , TypeError ):
29+ except (AttributeError , TypeError ):
3030 the_class = None
3131 #
3232 try :
3333 bases = x .__bases__
34- except (NameError , TypeError ):
34+ except (AttributeError , TypeError ):
3535 bases = ()
3636 #
3737 total = dictkeys + methods + members
@@ -69,7 +69,7 @@ def is_function(x):
6969# Use a class method to make a function that can be called
7070# with or without arguments.
7171#
72- class _dirclass () :
72+ class _dirclass :
7373 def dir (args ):
7474 if type (args ) = type (()):
7575 return listattrs (args [1 ])
Original file line number Diff line number Diff line change @@ -11,27 +11,27 @@ def getattr(x, name):
1111def listattrs (x ):
1212 try :
1313 dictkeys = x .__dict__ .keys ()
14- except (NameError , TypeError ):
14+ except (AttributeError , TypeError ):
1515 dictkeys = []
1616 #
1717 try :
1818 methods = x .__methods__
19- except (NameError , TypeError ):
19+ except (AttributeError , TypeError ):
2020 methods = []
2121 #
2222 try :
2323 members = x .__members__
24- except (NameError , TypeError ):
24+ except (AttributeError , TypeError ):
2525 members = []
2626 #
2727 try :
2828 the_class = x .__class__
29- except (NameError , TypeError ):
29+ except (AttributeError , TypeError ):
3030 the_class = None
3131 #
3232 try :
3333 bases = x .__bases__
34- except (NameError , TypeError ):
34+ except (AttributeError , TypeError ):
3535 bases = ()
3636 #
3737 total = dictkeys + methods + members
@@ -69,7 +69,7 @@ def is_function(x):
6969# Use a class method to make a function that can be called
7070# with or without arguments.
7171#
72- class _dirclass () :
72+ class _dirclass :
7373 def dir (args ):
7474 if type (args ) = type (()):
7575 return listattrs (args [1 ])
You can’t perform that action at this time.
0 commit comments