C++ dev needs advice on Python best practices

dennisfen profile image Denis Borisevich ・1 min read


I've recently thought about familiarizing myself with backend web-development (I came from embedded Linux programming, industrial automation, etc.) and in this context decided to explore this web-dev side of python which I mostly used to aid my cross-compilation and deployment work.
I wrote small python app which uses Twitter API (via Tweepy lib) to check my tweets for dead links. It seems to work fine but I'm concerned if it is written 'python-way'.

So I'd be glad if someone experienced in python could look at my code and point out flaws, bad style, python anti-patterns, etc.
Here's link to GitHub repo: twitter-cleanser

Thanks in advance and have a nice day!


markdown guide

C++ and Python are my two main languages, with most of my experience in the former. Your code looks pretty good to me. However, if you plan on making it bigger, you'll probably want to switch to an object-oriented model.

You may consider using PyLint on your code, if you don't already. It integrates into Atom, NINJA-IDE, and many other Python IDEs. I never code without it, and it helps keep my code clean. (Just be ready to tweak pylint's configuration a bit as you learn more about it.)

On a related note, it may also be helpful to your transition from C++ to Python to read my article ITWAMTSP: I Think We're All Making The Same Point.

All the best!


Thanks, Jason! I'll definitely look into PyLint.

Any advice on Python IDE? I mostly use vim in my C++ projects, though.


It's really quite relative. There are so many good IDEs, but each is a little different. Here are a few to try out:

  • NINJA-IDE: My personal favorite Python IDE. However, it is temporarily incompatible with Ubuntu 17.04+, since they're still depending on Qt4 (which was DC'd on 17.04 onward). However, it works VERY well on any system that Qt4 can be installed on.

  • Atom: My current IDE. It supports many languages, Python being one of them. If you install the packages for the Python language syntax, linters, autocomplete, and debugger, it makes for a fantastic interface. However, I use the Terminal for running the Python code when using Atom.

  • Spyder: One of my employees was first introduced to coding via Matlab, so I suggested Spyder for him (due to its interface similiarity). As far as I know, he's still using it.

There are plenty more besides, but those three are at the top of my list. They're also all open source.


My Python IDE of choice is JetBrains' PyCharm. It is absolutely amazing, and has a community edition as well. It is somewhat heavyweight (memory, CPU) but the benefits in terms of code intelligence (auto-completion, warnings, automatic fixes) and refactoring tools are amazing.


Lacking a better alternative, I created a pull request with some tips: github.com/dennisfen/twitter-clean...


Thanks for the tips, Tamir! I've merged you pull request. Sorry for the delay — I'm traveling right now:)