SShortSingh.
Back to feed

5 Common Python Mistakes Beginners Make and How to Fix Them

0
·1 views

A beginner Python developer has shared five recurring coding mistakes they encountered while learning the language. The errors include misusing return instead of print inside loops, misplacing brackets in f-string ternary expressions, and forgetting to prefix nested strings with f for interpolation. Other pitfalls involve accidentally using a list's plural name instead of the loop variable, and omitting self when accessing object attributes inside class methods. None of the mistakes trigger obvious errors in some cases, making them harder to catch without careful review. The developer notes that writing down these errors proved more effective for retention than silently fixing them and moving on.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer creates software-focused guide to understanding the European power grid

A software engineer who joined the energy industry found that existing resources on the European power grid were written for electrical engineers or energy specialists, not developers. Realizing there was no accessible entry point for software professionals, he spent several months rebuilding his understanding of the system from first principles. The result is a four-part series titled 'A Developer's Map of the European Power Grid', published on his personal blog. The series covers topics such as how electricity behaves, how the grid is structured, the roles of key players like TSOs and DSOs, and where software fits into the overall system. It is intended as a practical mental model for software engineers entering the energy sector, rather than a technical engineering reference.

0
ProgrammingDEV Community ·

Catastrophic Forgetting: How Fine-Tuning AI Models Can Erase General Knowledge

Fine-tuning AI models on specific tasks often causes 'catastrophic forgetting,' where the model gains specialised skills but loses broader general knowledge. This happens because adjusting a model's weights for a new task tends to overwrite previously learned patterns, given the model's limited capacity. Techniques such as regularisation, rehearsal with old data, multi-task learning, and parameter-efficient methods like LoRA can reduce but not fully eliminate this trade-off. For many real-world applications, however, specialisation may outweigh the cost of reduced generality. Researchers expect advances in continuous and meta-learning to gradually address forgetting over the next decade.

0
ProgrammingDEV Community ·

Developer open-sources SaaS boilerplate with real multi-tenancy and row-level security

A developer has released an open-source SaaS starter kit called saas-root, built after repeatedly writing the same authentication, team management, and permissions code across multiple projects. The boilerplate addresses a common shortcoming in existing solutions — fake multi-tenancy that relies on application-level filters rather than true database isolation. It implements PostgreSQL Row-Level Security to enforce data boundaries at the database layer, ensuring users cannot access another organisation's data even if application code contains bugs. Granular permissions are handled via the CASL library, allowing role-specific rules such as members editing only their own tasks. The project also abstracts email delivery behind a provider interface, currently supporting Resend, SMTP, and a console logger for development.

0
ProgrammingDEV Community ·

EU AI Act Article 50 Now in Force; Developer Tool Legalithm Helps Teams Comply

Article 50 of the EU AI Act officially began applying on 2 August 2026, imposing transparency obligations on developers who deploy chatbots or generate synthetic content for EU users. Two upcoming deadlines follow: legacy synthetic-content systems must meet Article 50(2) marking requirements by 2 December 2026, while high-risk AI obligations under Annex III take effect on 2 December 2027. To help developers navigate the roughly 100-page regulation, an open-source tool called Legalithm has been released as an MCP server compatible with Claude Code, Cursor, and Codex. The tool classifies AI features by risk tier, cites the relevant Article, and can generate disclosures and watermark AI-generated media, with most functions running fully offline without an API key. Its developers caution it is a starting point rather than legal advice, and it flags uncertain classifications for human review rather than asserting a potentially wrong answer.