Additional improvements to the dir implementation
- Added dir0 which would in theory return the local scope, but
for just returns the content of the builtins module
- Added a unit test file for dir which won't print anything as the
list sorting does not work as expected at the moment
(missing full implementation) and the attributes are different
as well (pyston has some CPython 2.7.5 does not have and vice versa)
- dir1 implements the lookup on a passed object
- If the object has a __dir__ method, it will call it and return the result
returned by this method
- Otherwise all class and instance attributes and methods are returned
- If the object has a __dict__ attribute, additional to the previous one
it will return the keys from that one as well
Signed-off-by: Vinzenz Feenstra <evilissimo@gmail.com>
Showing
test/tests/dir.py
0 → 100644
Please register or sign in to comment