Tag: python

Home / python
Developing Python application: Virtual environment
Post

Developing Python application: Virtual environment

Nowadays Python is everywhere — academics, data science, machine learning, enterprise application, web application, scripting you name it python is everywhere. Whatever you do, python is there either to help you or give you a headache. Let us say, you have learnt python programming and ready to use to develop applications that wow your future employers and...

Explain Python classes and objects to my nephew (+advanced use)
Post

Explain Python classes and objects to my nephew (+advanced use)

It is common secret that Python programming language has a solid claim to being the fastest-growing major programming language witnessing an extraordinary growth in the last five years, as seen by Stack Overflow traffic. Based on data describing the Stack Overflow question views which go to late 2011, the growth of Python relative to five other major...

How to run Python in R
Post

How to run Python in R

Learn how to run Python code inside an R script using the reticulate R package As much as I love R, it’s clear that Python is also a great language—both for data science and general-purpose computing. And there can be good reasons an R user would want to do some things in Python. Maybe it’s a great...

List Comprehension in Python
Post

List Comprehension in Python

Lists are a basic building block for a developer in any language. Python is no different. However at first, list comprehension can sometimes seem confusing. Since it is not an available feature in all languages, it may also be a concept that is completely unfamiliar. Some popular languages that include list comprehension are JavaScript, Perl...

Python Virtual Environments made easy
Post

Python Virtual Environments made easy

I was starting a project where I had to quickly check if a package, Flask, worked with the Python installed on my machine. As I ran the command to install Flask, it alerted me that the package was already installed as I had Anaconda on my machine. But when I tried to run the Hello World Flask app on Sublime...

Python for Data Science: From Scratch
Post

Python for Data Science: From Scratch

Learning about Data Structures and important packages like Numpy and Pandas in Python. This article is the second piece in the Python For Data Science Series. In case you haven’t gone through the introduction of Python(part 1), go ahead and skim through that article here. After knowing about the basics, its time to indulge in more challenging...

Speed Up Your Python Program With Concurrency
Post

Speed Up Your Python Program With Concurrency

Table of Contents What Is Concurrency? What Is Parallelism? When Is Concurrency Useful? How to Speed Up an I/O-Bound Program Synchronous Version threading Version asyncio Version multiprocessing Version How to Speed Up a CPU-Bound Program CPU-Bound Synchronous Version threading and asyncio Versions CPU-Bound multiprocessing Version When to Use Concurrency Conclusion If you’ve heard lots of...

The Ultimate Guide to Python Type Checking
Post

The Ultimate Guide to Python Type Checking

Table of Contents Type Systems Dynamic Typing Static Typing Duck Typing Hello Types Pros and Cons Annotations Function Annotations Variable Annotations Type Comments So, Type Annotations or Type Comments? Playing With Python Types, Part 1 Example: A Deck of Cards Sequences and Mappings Type Aliases Functions Without Return Values Example: Play Some Cards The Any...

Introduction to Python’s Collections Module
Post

Introduction to Python’s Collections Module

Introduction Collections in Python are containers that are used to store collections of data, for example, list, dict, set, tuple etc. These are built-in collections. Several modules have been developed that provide additional data structures to store collections of data. One such module is the Python collections module. Python collections module was introduced to improve the functionalities of the built-in...

Dynamic class definition in Python
Post

Dynamic class definition in Python

Here’s a neat Python trick you might just find useful one day. Let’s look at how you can dynamically define classes, and create instances of them as required. This trick makes use of Python’s object oriented programming (OOP) capabilities, so we’ll review those first. Classes and objects Python is an object-oriented language, meaning it lets you...

Memory Management in Python
Post

Memory Management in Python

Table of Contents Memory Is an Empty Book Memory Management: From Hardware to Software The Default Python Implementation The Global Interpreter Lock (GIL) Garbage Collection CPython’s Memory Management Pools Blocks Arenas Conclusion Ever wonder how Python handles your data behind the scenes? How are your variables stored in memory? When do they get deleted? In...

Make a Web App Using Python & Flask!
Post

Make a Web App Using Python & Flask!

Creating a Python Website from the Bottom Up Note: This post requires you know some basic Python. You should be comfortable with what functions are and how to write them. Here is a quick refresher! It would also be nice if you understood the basics of dictionaries: what they are, how to access elements of one, and...

How to manage multiple Python versions and virtual environments
Post

How to manage multiple Python versions and virtual environments

Before we start, let’s briefly go over the terms used in the title: Multiple Python versions: Different installations of Python on the same machine, 2.7 and 3.4 for example. Virtual environments: isolated independent environments that can have both a specific version of Python and of any project-specific packages installed within them, without affecting any other...

Installing Python and Anaconda on Windows
Post

Installing Python and Anaconda on Windows

This tutorial will show you how to install Python (via Anaconda) on your machine. Before getting started with the installation, let’s learn a bit more about what Anaconda exactly is. Python is the programming language which will be installed on the machine and on top of that different IDEs and packages can be installed. Python...

Conditional Statements in Python
Post

Conditional Statements in Python

Table of Contents Introduction to the if Statement Grouping Statements: Indentation and Blocks Python: It’s All About the Indentation What Do Other Languages Do? Which Is Better? The else and elif Clauses One-Line if Statements Conditional Expressions The pass Statement Conclusion From the previous tutorials in this series, you now have quite a bit of...