List comprehensions Python

All, Tips

I think one of the most beautiful things and also powerful are the list compreehensions, which makes the language quite interesting.

The syntax is quite simple:

[ expression for item in list if conditional ]

The tutorial [1] explains specifically how to do it. I confess it’s not easy to take it at first try. You can also use directly from the source [3].

But when you learn it, you will want to use all over your code. EVEN WHEN YOU SHOULDN’T!

In some cases, when you dont need a list actually, its better to use a simple NEXT() function[2].






C++ Tip [warning surpressing]

All, Tips

Sometimes we are facing so many warning that we cant just ignore them. Actually we should not, at least by Cpp Coding Standard by Andrei Alexandrescu. In this book, it is recommended to clean those high level warnings.

To do this in VS 2015 we just need to change the project properties by adding the Specific Warning. So going in the project configuration, below C/C++ tab, in Advanced Settings and adding the code to be ignored in ”Disable Specific Warning”


Image demonstrating how to do it: