-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from radon-project/dir-builtin-function
Added `dir()` builtin function.
- Loading branch information
Showing
7 changed files
with
154 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import array | ||
|
||
# stdlibs | ||
print(dir(os)) | ||
print(dir(os.path)) | ||
print(dir(array)) | ||
print(dir(array.Array)) | ||
|
||
var arr = array.Array([]) | ||
print(dir(arr)) | ||
|
||
# built-in classes | ||
var j = String("Some random string") | ||
print(j) | ||
print(len(j)) | ||
print(len(dir(j))) | ||
print(dir(String)) | ||
print(dir(Requests)) | ||
|
||
# Datatypes | ||
var my_var = "Some" | ||
|
||
try { | ||
print(dir(my_var)) | ||
} catch as err { | ||
print(err) # TypeError: Argument is must be Modules or Classes. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import os | ||
|
||
assert len(dir(os)) == 22, "OS module has been changed" | ||
|
||
for method in dir(os) { | ||
assert type(method) == type(""), "dir() didn't return String data!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"code": 0, "stdout": "", "stderr": ""} |