Last active
April 26, 2017 06:04
-
-
Save vikramdurai/60e4e37c3895e8c3d085b2d6aca9481f to your computer and use it in GitHub Desktop.
I know I'm probably an idiot to want another programming language. I'm doing this only for learning.
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
# a simple if statement | |
# no else statement for | |
# simplicity | |
class If: | |
def check(self, condition): | |
if condition: | |
self = True | |
# function code | |
class Func: | |
def __init__(self, args, code): | |
self.args = args | |
self.code = code | |
# a little trick for | |
# a function to run | |
# itself | |
def run(arg): | |
eval(self.code(args=arg)) | |
# class code | |
class Class: | |
def __init__(self, args, init_code): | |
# another trick to keep | |
# looping through the array | |
# and add all the attributes | |
for arg in args: | |
eval("self." + args[int(arg)]) | |
self.__init__ = init_code | |
# extend code | |
# mainly for extending classes | |
class Extends: | |
def __init__(self, which_class): | |
self = which_class + self | |
# import code | |
class Import: | |
def __init__(self, name): | |
try: | |
# trick to import itself | |
eval("import " + str(name)) | |
except ImportError: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment