4 ms·
one liner: eval(str)
by jgbuddy 6mo ago
one liner:
eval(str)
- nasretdinov 6mo agoWent into comments looking for this exact comment. Wasn't disappointed
- _blk 6mo agoGreat minds think alike ;)
- PhunkyPhil 6mo agoI can do you one better: ```python3 from openai import OpenAI import sys client = OpenAI() response = client.chat.completions.create( model="gpt-4", messages=[{ "role": "user", "content": f"generate valid python byte code this program compiles to: {sys.argv[1]}" }] ) print(response.choices[0].message.content) ``` Actually, probably not better.
- nagaiaida 6mo agoand as soon as one tries to meaningfully add features to this sort of metainterpreter, the usefulness of homoiconic syntax becomes abundantly clear