VIP 👤
🏠 Ana Sayfa
Benchmarklar
📊 Tüm Benchmarklar 🦖 Dinozor v1 🦖 Dinozor v2 ✅ To-Do List Uygulamaları 🎨 Yaratıcı Serbest Sayfalar 🎯 FSACB - Nihai Gösteri 🌍 Çeviri Benchmarkı
Modeller
🏆 En İyi 10 Model 🆓 Ücretsiz Modeller 📋 Tüm Modeller ⚙️ Kilo Code
Kaynaklar
💬 Prompt Kütüphanesi 📖 YZ Sözlüğü 🔗 Faydalı Bağlantılar 🔌 Yapay Zeka API'leri ve Yönlendiriciler
Medium

Refactor Legacy Python Code

#coding #python #optimization

Improve the efficiency and readability of a provided Python code snippet by applying Pythonic idioms.

You are an expert Python developer. Please review the following code snippet. Identify any performance bottlenecks, readability issues, or anti-patterns. Refactor the code to be more efficient using Pythonic idioms, add docstrings where necessary, and explain the changes you made in a list format. Code snippet: def get_primes(n): primes = [] for num in range(2, n + 1): for i in range(2, num): if (num % i) == 0: break else: primes.append(num) return primes