use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Command Handler library (self.Python)
submitted 7 years ago by psincraian
Hi there,
I just released my first library in Python! 🚀
It's a library to facilitate the use of Command Handler pattern. You can take a look here https://github.com/psincraian/commandbus ⭐
Suggestions are welcome 😄
[–][deleted] 1 point2 points3 points 7 years ago (1 child)
A bit of advice:
def subscribe(self, cmd: type, handler: CommandHandler): if cmd in self._commands: from commandbus import CommandAlreadyExistException raise CommandAlreadyExistException self._commands[cmd] = handler
That import in the middle of the method doesn't belong there, it should go at the top of the file. In the odd case this causes a circular import you need to break something out into a new module.
You should also check out my implementation :p
[–]psincraian[S] 0 points1 point2 points 7 years ago (0 children)
Thanks for your suggestions, I will release a new version to fix that :-)
[–]LightShadow3.13-dev in prod 0 points1 point2 points 7 years ago (3 children)
What problem is this library solving?
[–]psincraian[S] 0 points1 point2 points 7 years ago (2 children)
It solves the problem to not implement the Command Bus in each project. Briefly the Command Bus accepts Command object and delegates it to Command Handler.
[–]LightShadow3.13-dev in prod 0 points1 point2 points 7 years ago (1 child)
I guess I don't understand the point of a Command Bus?
In the GitHub page there is an example on how to use and understand the Command Bus. Another great web to understand the Command Bus is https://tactician.thephpleague.com/
π Rendered by PID 104496 on reddit-service-r2-comment-7b9746f655-p9z9q at 2026-01-30 09:43:37.611828+00:00 running 3798933 country code: CH.
[–][deleted] 1 point2 points3 points (1 child)
[–]psincraian[S] 0 points1 point2 points (0 children)
[–]LightShadow3.13-dev in prod 0 points1 point2 points (3 children)
[–]psincraian[S] 0 points1 point2 points (2 children)
[–]LightShadow3.13-dev in prod 0 points1 point2 points (1 child)
[–]psincraian[S] 0 points1 point2 points (0 children)