Tag: Python

Remove Duplicates From a List

Remove Duplicates From a List

What's the fastest way to remove duplicates from a list?

type() vs. isinstance()

type() vs. isinstance()

What's the difference between type() and isinstance() methods, and which one is better for checking the type of an object?

Membership Testing

Membership Testing

Why iterating over the whole list is a bad idea, what data structure is best for membership testing, and when it makes sense to use it?

Checking for True or False

Checking for True or False

How can we compare a variable to True or False, what's the difference between "is" and "==" operators, and what are truthy values?

Sorting Lists

Sorting Lists

What's the fastest way to sort a list? When can you use sort() and when you need to use sorted() instead?

For Loop vs. List Comprehension

For Loop vs. List Comprehension

Simple "for loops" can be replaced with a list comprehension. But is it going to make our code faster? And what limitations list comprehension has?

Ordered Dictionaries

Ordered Dictionaries

Dictionaries in the latest Python versions preserve the insertion order. So, is there any reason to use the OrderedDict as we used to do in the past?

Easy Speedup Wins With Numba

Easy Speedup Wins With Numba

Numba library has plenty of tools to speed up your mathematical-heavy programs. From a simple @jit decorator, all the way to running your code on a CUDA GPU.

Find Item in a List

Find Item in a List

How to quickly find something in a collection of items, like a list or a range? When a generator expression is a great solution, and when it's not?

Ask for Forgiveness or Look Before You Leap?

Ask for Forgiveness or Look Before You Leap?

Is it faster to "ask for forgiveness" or "look before you leap" in Python? And when it's better to use one over the other?

Writing Faster Python - Introduction

Writing Faster Python - Introduction

Introduction to the "Writing Faster Python" series. What it is about, how do I benchmark, frequently asked questions, and additional resources.

18 Plugins for Writing Python in VS Code

18 Plugins for Writing Python in VS Code

List of my favorite VS Code plugins that helps me build Python application.

5 Ways of Debugging with IPython

5 Ways of Debugging with IPython

Tips and tricks on how to use IPython as your debugger.

Disable pip Outside of Virtual Environments

Disable pip Outside of Virtual Environments

How to stop pip from running outside of a virtual environment and messing up your dependencies?

You Don't Have to Migrate to Python 3

You Don't Have to Migrate to Python 3

Python 3 is great! But not every Python 2 project has to be migrated. There are different ways how you can prepare for the upcoming Python 2 End of Life.

IPython Extensions Guide

IPython Extensions Guide

What are IPython extensions, how to install them, and how to write and publish your own extension?

Automatically Reload Modules with %autoreload

Automatically Reload Modules with %autoreload

Tired of having to reload a module each time you change it? %autoreload to the rescue!

It's 2019 and I'm Still Using Python 2

It's 2019 and I'm Still Using Python 2

Slides for my talk "It's 2019 and I'm still using Python 2. Should I be worried?"

Wait, IPython Can Do That?!

Wait, IPython Can Do That?!

Slides for my talk "Wait, IPython can do that?!"

Creating Magic Functions in IPython - Part 3

Creating Magic Functions in IPython - Part 3

In this last part of the magic functions series, we will create a Magics class.

Creating Magic Functions in IPython - Part 2

Creating Magic Functions in IPython - Part 2

Continue the magic functions journey and create a cell magic function that checks type hints in IPython.

Creating Magic Functions in IPython - Part 1

Creating Magic Functions in IPython - Part 1

Learn how to make your own magic functions in IPython by creating a line magic function.

__str__ vs. __repr__

__str__ vs. __repr__

How to easily remember the difference between __str__ and __repr__ functions in Python?

IPython Startup Files

IPython Startup Files

How you can automatically run Python scripts when starting IPython and why this can be useful?

All tags