code: def attr_matches(self, text):
          
          import re
  
          # Another option, seems to work great. Catches things like ''.<tab>
          m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)  # @UndefinedVariable
  
          if not m:
              return []
  
          expr, attr = m.group(1, 3)
          try:
              obj = eval(expr, self.namespace)
          except:
              try:
                  obj = eval(expr, self.global_namespace)
              except:
                  return []
  
          filter = _StartsWithFilter(attr)
  
          words = dir2(obj, filter=filter)
  
          return words
docs: Compute matches when text contains a dot.
  
          Assuming the text is of the form NAME.NAME....[NAME], and is
          evaluatable in self.namespace or self.global_namespace, it will be
          evaluated and its attributes (as revealed by dir()) are used as
          possible completions.  (For class instances, class members are are
          also considered.)
  
          WARNING: this can still invoke arbitrary C code, if an object
          with a __getattr__ hook is evaluated.