Nested or Inner Classes in Python

Learn how to declare and use nested classes in python

“There is nothing either good or bad, but thinking makes it so.” ― William Shakespeare, Hamlet

1. Introduction

A nested or inner class is contained within another class. This could be for reasons of encapsulation, where the inner class is not useful by itself. Continue reading “Nested or Inner Classes in Python”

An Introduction to Python Classes

Here is a beginner’s introduction to classes in python

“Sometimes it’s worth lingering on the journey for a while before getting to the destination.” ― Richelle Mead, The Indigo Spell

1. Introduction

The concept of a class is the core of Object Oriented Programming. It defines a blue-print for constructing objects. It is a plan of how an object is laid out, including its data members, instance methods, class methods and inheritance hierarchy. Python supports object oriented programming and classes, although with certain differences from other languages like C++ and Java. In this article, we shall delve into python classes and learn how they work.

Continue reading “An Introduction to Python Classes”

What is the Python Yield Statement?

Learn about the Python yield statement which is used to create generators.

“Count your age by friends, not years. Count your life by smiles, not tears.”
― John Lennon

1. Introduction

Python provides an yield statement which allows you to create generator functions. What is a generator function and how does the yield statement help with it? Let us find out in this article.

Continue reading “What is the Python Yield Statement?”

An Introduction to Python Sets

Python supports sets which are a collection of unique elements and provide operations for computing set union, intersection and difference.

“The world is a book and those who do not travel read only one page.”
― Augustine of Hippo

1. Introduction

A set is a collection of unique elements. A common use is to eliminate duplicate elements from a list. In addition, it supports set operations like union intersection and difference.

Continue reading “An Introduction to Python Sets”

Getting Started with Scrapy

Learn how to use Python Scrapy to Extract information from Websites.

“When life gives you lemons, chunk it right back.”
― Bill Watterson

1. Introduction

Scrapy is a python-based web crawler which can be used to extract information from websites. It is fast, simple and can navigate pages just like a browser can.

Continue reading “Getting Started with Scrapy”

Listing a Directory With Python

Learn how to list contents of a directory from python. Also, easily find and process files matching conditions from your python program.

“If at first you don’t succeed, destroy all evidence that you tried.”
― Steven Wright

1. Introduction

There are several methods to list a directory in python. In this article we present a few of these along with the caveats for each.

Continue reading “Listing a Directory With Python”