I like to code in Python. I also like the concept of asynchronous workers to build loosely coupled applications. Luckily, RabbitMQ and Celery can help me do exactly that. This post is based on a very nice YouTube video by Max Mautner (the one below). For easy repeatability, I have transcribed the video in this […]
A few days ago I found out that using the Python debugger is so easy, I can’t believe I haven’t used it before. Import the module: import pdbimport pdb Set a breakpoint somewhere in your code: def some_function(self, x, y, z): pdb.set_trace() …def some_function(self, x, y, z): pdb.set_trace() … Run your program. Now every time […]
So you have a list of tuples, created with the zip built-in function in Python. Like this: z = [(1, ‘a’), (2, ‘b’), (3, ‘c’)]z = [(1, ‘a’), (2, ‘b’), (3, ‘c’)] And you want to reverse zip, to get these two lists: x = [1, 2, 3] y = [’a’, ‘b’, ‘c’]x = [1, […]
I’m just getting into this topic, but it seems that Python Eggs are the way to go. Here’s a good tutorial: http://mrtopf.de/blog/en/a-small-introduction-to-python-eggs/ In the long term, I’d like to be able to do: pip install <name of python lib I’ve made>pip install <name of python lib I’ve made> And host my code on PyPi etc.
Here are three thorough answers on Python topics from StackOverflow. Metaclasses Yield, iterables, iterators, generators Decorators