class Foo: def __dir__(self): return ['a', 'b', 'c'] class Bar: def __dir__(self): return ('a', 'b', 'c') print dir(Foo()) print dir(Bar())