124 readline.set_completer(Completer(my_namespace).complete) |
124 readline.set_completer(Completer(my_namespace).complete) |
125 |
125 |
126 @param namespace namespace for the completer |
126 @param namespace namespace for the completer |
127 @exception TypeError raised to indicate a wrong namespace structure |
127 @exception TypeError raised to indicate a wrong namespace structure |
128 """ |
128 """ |
129 if namespace and type(namespace) != type({}): |
129 if namespace and isinstance(namespace, dict): |
130 raise TypeError('namespace must be a dictionary') |
130 raise TypeError('namespace must be a dictionary') |
131 |
131 |
132 # Don't bind to namespace quite yet, but flag whether the user wants a |
132 # Don't bind to namespace quite yet, but flag whether the user wants a |
133 # specific namespace or to use __main__.__dict__. This will allow us |
133 # specific namespace or to use __main__.__dict__. This will allow us |
134 # to bind to __main__.__dict__ at completion time, not now. |
134 # to bind to __main__.__dict__ at completion time, not now. |