logoalt Hacker News

jgbuddylast Friday at 2:09 PM3 repliesview on HN

one liner:

eval(str)


Replies

PhunkyPhillast Friday at 3:13 PM

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.

nagaiaidayesterday at 7:56 PM

and as soon as one tries to meaningfully add features to this sort of metainterpreter, the usefulness of homoiconic syntax becomes abundantly clear

nasretdinovlast Friday at 2:55 PM

Went into comments looking for this exact comment. Wasn't disappointed

show 1 reply