Hacker News new | ask | show | jobs
by Panzer04 1276 days ago
I guess the main concern with its use as a learning tool is what happens if it's wrong? It might be helpful for boilerplate when you already know what you want, but if you don't even know that it'll blow up in your face when it doesn't give you something workable.

Still, seems like a viable assistant so long as you have an understanding of what you're working with.

4 comments

It's basically an augmenting tool. Can't rely on it 100% without a check, can't just do it without a vague idea of what the code does. As a combined boilerplate + search assistant it takes crazy amounts of work away as long as your specs are well defined, though.
It is almost the same as stackoverflow. I've seen many answers which is runnable but without proper error handling or security mitigations. They are just as misleading as ChatGPT.
Umm, no. I haven't seen answers there where people just invent non-existing options like ChatGPT does.
It basically gives you suggestions of what could be correct, or close to correct, but yes you have to verify yourself, and possibly make some adjustments.
And honestly that's already amazingly valuable and I've been using it constantly for weeks because it narrows your search space through the documentation to the head of a pin.

Hey I need to process the EXIF data for an image; let's Google "pillow exif" and see what we get.

https://pillow.readthedocs.io/en/stable/reference/ExifTags.h...

Uhh, okay. Kinda? Maybe? This doesn't actually tell me how to actually get that data from a real image.

> Write a python program using pillow to print all the EXIF data for an image in a human readable way

    from PIL import Image
    from PIL.ExifTags import TAGS 

    # Create an Image object 
    img = Image.open('image.jpg') 

    # Get EXIF data
    exif_data = img._getexif() 
 
    # Iterate over all EXIF data fields
    for tag_id in exif_data: 
 
        # Get the tag name, instead of human unreadable tag id
        tag = TAGS.get(tag_id, tag_id) 
 
        data = exif_data.get(tag_id) 
 
        # Decode bytes 
        if isinstance(data, bytes): 
            data = data.decode() 
 
        print(f"{tag:25}: {data}")
Is it correct, sorta, close though. But it tells me I should look for a method on the image object called getexif -- hey it exists, nice! And that's what TAGS is for! Makes way more sense.
what happened after AI introduce undefined behaviour...