Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: cataclysm v0.1 – the final Python module? (github.com/mattie)
7 points by thorax on March 31, 2023 | hide | past | favorite | 3 comments
cataclysm is an over-the-top experiment to take more of the human out of coding.

Any function you give it, it generates and executes. No need to think about what you need, it'll make it for you.

I haven't taught it to use itself yet if a module isn't installed, but that's next on the agenda once GPT4 isn't so slow.

Video intro here: https://www.youtube.com/watch?v=ZK8fUuQDgZ4

Some random examples when using global cataclysm:

  >>> uhoh = first_prime_with_3_digits()
  >>> print(uhoh)
  101

  >>> scary_words = get_italicized_phrases_wikipedia(page="Global catastrophic risk", only_lowercase_words=True, min_length=6)
  >>> print(scary_words[:5]) 
  ['existential risks', 'existential catastrophe[16]', 'global', 'terminal', 'permanent,']
Fun experiment: I fed it some of the 'tests' for other simple Python based modules and it was pretty good at implementing what was needed to succeed at them by replacing their module name with `doom.`. Obviously lots it can't do, but it's already surprisingly reliable.

You'll need a GPT4 API key-- it works with ChatGPT 3.5 turbo but that code is a little less reliable (and it can't generate as lengthy code).

It has two modes-- the ridiculous 'global' cataclysm mode for use in notebooks/interpreter that lets you hand-wave any function name and it'll cook it up for you. This is a bit scary (a typo turns into random code execution), so the second mode is just to use 'doom.' in front of any function name and it'll generate/cache its best guess for the right code given where it's called in the call stack (and its name/types/parameter names/etc).

A bit extreme, but a small concept to help us adjust to the impending cataclysm ahead of us. :)




Now that it's released, it's time to experiment with what it can do.

``` from cataclysm import doom

def mystery_func(): while True: pass

# predict if specified function halts print(doom.does_it_halt(mystery_func)) ```


Ah, really curious if it'll balk at the age old problem or just answer based on the code provided since it does inspect the nearby code to understand context for the generated code.

I'll have to try that when I get back to my desk!


Now that it's released, it's time to experiment with what it can do.

   from cataclysm import doom

   # App gets the img file from the command line and saves it as a new file at half size with _half appended to the name
   doom.resize_app()
Turned out to be all that's needed for a command-line file resize app (with PIL installed).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: