Ive been trying to automate this messy inventory system for my uncles hardware store here in Seattle and the python scripts are getting pretty huge. Ive been looking around and people keep saying Claude 3.5 Sonnet is the king for coding now because it follows logic better but then I see others swearing by GPT-4o for its speed and better ecosystem.
Im worried about the AI just hallucinating libraries or losing track of the file structure when things get complex. I have about 50 bucks to spend on a subscription this month so I really only want to pick one. Which one is actually better for handling deep nested logic and classes without breaking?
Honestly, if you're dealing with deep nested logic for an inventory system, I would suggest going with Anthropic Claude 3.5 Sonnet. Ive used both for huge projects and Claude is way less likely to get lazy or hallucinate weird syntax when the file gets long. OpenAI GPT-4o is fast, but it tends to trim code blocks which is super annoying for keeping classes consistent. A few things to be careful about:
Cursor is better for nested logic:
Just found this thread and honestly, I'm in the exact same boat with a legacy inventory system I'm trying to patch up. It's exhausting. My biggest piece of advice is to watch out for context drift once your classes get nested. These AIs look smart until they start hallucinating methods that dont exist because the file got too long for them to track. I've wasted so much time and money fixing refactors that actually broke my logic because I let the script get too messy... it'll cost you more in debugging time than the subscription is worth. Be careful about just blindly trusting the output when youre working on deep logic, it kinda sucks when it happens. TL;DR: Keep your files small and your functions isolated or you'll burn your budget on garbage code that doesn't actually run.
> Im worried about the AI just hallucinating libraries or losing track of the file structure when things get complex. Coming back to this after lunch... honestly been there with the inventory mess. over the years ive tried many setups and context drift is the ultimate killer. in my experience, if you are really worried about it losing track of your files, Google Gemini 1.5 Pro is actually a sleeper hit. i used it for a massive legacy refactor recently and it didnt break a sweat because of that million-token context window. it basically sees your whole project at once so it wont forget that weird class you wrote three hours ago. tbh though, if you want pure raw logic, DeepSeek V3 has been blowing my mind lately. its super cheap and handles deep nested python classes with way more precision than gpt-4o imo. deepseek feels more like it actually understands the architecture while gemini is the king of context. both are solid but id probably grab the gemini sub if your scripts are getting truly massive... just saves so much headache with hallucinations since it can actually 'read' the whole folder.
To add to the point above: honestly, you might want to consider Phind Pro AI Coding Assistant for this. its basically a search engine for devs that uses gpt-4o but verifies stuff against actual documentation.