The STL library “functools” have great features, allow us to modify our function, with little to no code, and add functionality to them.
This all results in cleaner, more effective code that is easy to understand, monitor, and review. So without farther ado, let us get started!
Reduce takes a function of 2 arguments, and an iterable.
And act cumulatively on the entire iterable!
For example, if we take a function that adds to numbers, using “reduce,” we could sum up every list we want! Or concatenate strings!
This method could come in handy in custom functions that want…
Unit-testing is a basic run of your code. It’s not QA. This way, you verify that you’ve written quality code and not something that will break the minute someone else tries to use it.
Recently, at a startup, I needed to write library code for a co-worker, I gave him the library code with a unit-test script.
Every time he complained, the unit-test saved me the time to check myself the bugs on his code. Since mine did work, this saves a lot of time, and time is your most valuable asset.
Python is, in my opinion, the simplest and most effective programming language you can learn, it is readable and open source, and the possibilities are just endless.
Well, pretty simple — teach Python, right?
Yes, and no, this article will teach you functional Python, the real fundamentals of Python, no fancy libraries, or email automation. Still, if you’ll stick through, you’ll have the understanding to dive into most articles, and benefit something from them.
With the first 1000 most common words of a language, you can understand somewhere between 60–70% of an every day chat, the second thousand — will…
Python has this charm to it. The crowds speak of it, almost romantically, how it is “just plain English.” It is so “simple and easy to understand” and the power of importing the fantastic modules of the open-source community — everything within your grasp.
It is, no doubt about it, but that my friends is level 1.
Level 1 is the path each python developer goes through his way to become a real python developer, and I hope by the end of this article, to get you to a more advanced level and show you the needed path you must…
Python is widely known for its simplicity, easy syntax, which requires basic English to understand, which made it so famous.
The simplicity of Python is what makes it so appealing for beginners, no declaration, without fancy words, or weird syntax. It continues with cools features, like decorators, and list comprehensions that do work wonders, but the *(asterisk) deserves the same spot, and I’m here to show you why.
I’ll start with a small trick:
Easy Way To Combine Dicts!
Now as you can easily see, I just concatenated to dictionaries with just a few asterisks, I’m going to explain…
Machine learning can save you the hassle of building a complex set of rules for a given problem, which might not be ideal and is much harder to maintain.
With the right guidance, machine learning can find better and quicker methods to solve your problems.
First, we will start with the basic concept. Later, we will do some graphing and coding just to have an easier understanding of the matter and its implications. Afterward, the actual implementation will be even simpler than this article’s concept (this part will be at the end).
Unit Testing is an important aspect of development. Without the basic runs of your code, how do you know if it works?
also, since unit-testing is often quick and short, by managing unit-testing correctly you can also know if you broke old code or someone else’s code!
Also it will be much easier to provide examples how to use your code, since you already have one!
Let us start by showing the wrong and common method.
here’s a simple class object:
As you can see, this class doesn’t do much, it takes a number power that number on a…
I'm sure you all heard, “learn python, its simple, easy, fun syntax, and it just works”.
That's all well and good — until you need to do some heavy lifting — then your code needs to step up to the next level.
Computer science has 2 major computation problems — I/O (input/output) problem, and CPU (computation) problems, this article will address these two.
The queue is a standard python object — build especially to synchronize your threads.
The queue object gives you a number of advantages, first, you can limit the amount of data waiting to be processed, which can help prevent memory leaks, you can have it organized by importance — and this way make sure that too much data from a less important thread — will not delay processing data from important thread.
Let's start with a simple example — you have a camera in a museum, guarding a painting, you're getting data from that camera through a read thread, and…
PyQt is a Python package to work with a cross-platform Qt GUI interface.
basically, you can write the code anywhere you'd like, and it will run on every OS of any user.
I'm not a GUI programmer, I don't plan to be one, and if you plan to be one, I wouldn't recommend python as the go-to language, but! if you need something “quick and dirty”, for an in-team solution, or just a convenience of a GUI instead of a terminal, this module fits in perfectly!
At the end of this article, you'll have a GUI that chooses a file…