<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/planning-meals-weekly-shop-alternative-constructors-using-class-methods-buxwbbwa6" -->

---
title: Planning Meals, Weekly Shop, Alternative Constructors...
description: Class methods in Python can serve as alternative constructors, providing multiple ways to create instances beyond the standard `__init__()` method. Using the...
canonical: https://daily.dev/posts/planning-meals-weekly-shop-alternative-constructors-using-class-methods-buxwbbwa6
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Planning Meals, Weekly Shop, Alternative Constructors Using Class Methods | daily.dev
og:description: Class methods in Python can serve as alternative constructors, providing multiple ways to create instances beyond the standard `__init__()` method. Using the...
og:url: https://daily.dev/posts/planning-meals-weekly-shop-alternative-constructors-using-class-methods-buxwbbwa6
og:image: https://api.daily.dev/og/posts/buxWbBWA6.png
og:image:alt: Planning Meals, Weekly Shop, Alternative Constructors Using Class Methods
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Planning Meals, Weekly Shop, Alternative Constructors Using Class Methods

**[Planet Python](https://daily.dev/sources/planetpython)** · 12 min read · 1 upvotes · 0 comments

## Summary

Class methods in Python can serve as alternative constructors, providing multiple ways to create instances beyond the standard `__init__()` method. Using the `@classmethod` decorator, you can define methods that create and customize instances before returning them. This pattern is common in Python's standard library (like `dict.fromkeys()` and `datetime.datetime.fromisoformat()`) and helps maintain loose coupling between classes while offering convenient initialization options. The article demonstrates this through a meal planning application where a `ShoppingList` can be created either empty or directly from a `WeeklyMealPlanner` instance.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.thepythoncodingstack.com/p/python-alternative-constructor-class-method>

## Similar posts on daily.dev

- [How to use Python dataclasses](https://daily.dev/posts/how-to-use-python-dataclasses-ajn3e5nse) · InfoWorld · 1 upvotes · 0 comments
- [Implementing the Factory Method Pattern in Python Quiz – Real Python](https://daily.dev/posts/implementing-the-factory-method-pattern-in-python-quiz-real-python-tfy6hcn6h) · Real Python · 1 upvotes · 0 comments
- [Python Dataclasses: A Complete Guide to Boilerplate‑Free Objects](https://daily.dev/posts/python-dataclasses-a-complete-guide-to-boilerplate-free-objects-apbo0iene) · The New Stack · 11 upvotes · 0 comments
- [Implementing the Coffee Machine Project in Python Using Object Oriented Programming](https://daily.dev/posts/implementing-the-coffee-machine-project-in-python-using-object-oriented-programming-fdvt0szv6) · Towards Data Science · 1 upvotes · 0 comments

---

Tags: [#design-patterns](https://daily.dev/tags/design-patterns), [#general-programming](https://daily.dev/tags/general-programming), [#python](https://daily.dev/tags/python)

[View this post on daily.dev](https://daily.dev/posts/planning-meals-weekly-shop-alternative-constructors-using-class-methods-buxwbbwa6)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Planning Meals, Weekly Shop, Alternative Constructors Using Class Methods","url":"https://daily.dev/posts/planning-meals-weekly-shop-alternative-constructors-using-class-methods-buxwbbwa6","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/planning-meals-weekly-shop-alternative-constructors-using-class-methods-buxwbbwa6"},"datePublished":"2026-01-30T16:48:55.900Z","dateModified":"2026-03-15T03:42:20.451Z","description":"Class methods in Python can serve as alternative constructors, providing multiple ways to create instances beyond the standard `__init__()` method. Using the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ec9ec06ba39e3241466e78e247e9a21d?_a=AQAEulh","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ec9ec06ba39e3241466e78e247e9a21d?_a=AQAEulh","isAccessibleForFree":true,"articleSection":"Planet Python","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet Python","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/eac3cc584cb043b5a242d13752bd3d0c","url":"https://daily.dev/sources/planetpython"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/planning-meals-weekly-shop-alternative-constructors-using-class-methods-buxwbbwa6","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"design-patterns,general-programming,python","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Python","item":"https://daily.dev/sources/planetpython"},{"@type":"ListItem","position":3,"name":"Planning Meals, Weekly Shop, Alternative Constructors Using Class Methods"}]}
```

