Over Complicating Hello World

I came accross this TikTok video recently, where the presenter shows how to make an “Object Oriented” Hello World program. It made me laugh so much, I thought I would try my own hello world program.

This is my solution, which uses the Python ast module to inspect the script looking for functions to use in the hello world message.

#!/usr/bin/env python3

import ast

def Hello():
    ...

def World():
    ...

class Visitor(ast.NodeVisitor):
    def __init__(self):
        self.functions: list[str] = []

    def visit_FunctionDef(self, node: ast.AST):
        if '_' not in node.name and node.name[0].isupper():
            self.functions.append(node.name)
        self.generic_visit(node)

def _say_hi():
    with open(__file__, 'r') as fd:
        code = fd.read()
    node = ast.parse(code)
    visitor = Visitor()
    visitor.visit(node)
    print(' '.join(visitor.functions))

if __name__ == '__main__':
    _say_hi()

     

Wasabi Skin Care!

芥末味的护肤品😱😂?英国人吃日料的时候都不吃芥末,他们会喜欢芥末味在护肤品里吗。我想知道销量怎样。
我喜欢图二的味道,这个牌子在英国有,但买不到这些亚洲口味,除非去中国超市买,大部分英国人都不知道这两个味道的存在。