Hacker News new | ask | show | jobs
by jgbuddy 62 days ago
one liner:

eval(str)

3 comments

I 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.

and as soon as one tries to meaningfully add features to this sort of metainterpreter, the usefulness of homoiconic syntax becomes abundantly clear
Went into comments looking for this exact comment. Wasn't disappointed
Great minds think alike ;)