Blog Archives
Page 1 of 4
1 2 3 4

01: Python Iterators, Generators & Decorators Tutorial

Assumes that Python3 is installed as described in Getting started with Python.

1. Iterators

Iterators don’t compute the value of each item when instantiated. They only compute it when you ask for it. This is known as lazy evaluation. Lazy evaluation is useful when you have a very large data set to compute.

Read more ›

02: Python comprehensions tutorial

Q. What is a comprehension?
A. Comprehensions are constructs that allow sequences to be built from other sequences. Python 2.0 introduced list comprehensions and Python 3.0 comes with dictionary, set and generator comprehensions.

List Comprehension

Set Comprehension

Given a list return a set.

Read more ›

03: Python context manager tutorial

Q. What is a Python context manager?
A. The most common use of context managers is to properly manage resources. Context managers are a way of allocating and releasing some sort of resource exactly where you need it. The simplest example is file access:

Instead of:

The following code ensures that the file handle is closed,

Read more ›

04: In Python functions are objects tutorial

Q. Are functions objects in Python?
A. Yes. In Python, a function is an object of type function. A function being an object means it is possible to pass a function object around as argument or as return value or to assign another name to the function object.

Read more ›

05: Python debugging tutorial

Q. How would you go about debugging Python code?
A. Firstly, import pdb

Secondly, use “pdb.set_trace()” where ever you want the execution to pause as shown below with “” file.


Read more ›

06: Object introspection in Python tutorial

Q1. What is an Object introspection? A1. It is the ability to determine type & properties of objects at runtime. Everything in Python is an object. Every object in Python may have attributes and methods. Python dir(..) function The dir(..) function returns a sorted list of attributes and methods belonging...

Members Only Content
Log In Register Home

Page 1 of 4
1 2 3 4

800+ Java Interview Q&As

Prepare to fast-track & go places
with multi-offers to choose from & increased earning potential. Expand your horizons along the way by taking the road less travelled.
Learn by categories on the go...
Learn by categories such as FAQs – Core Java, Key Area – Low Latency, Core Java – Java 8, JEE – Microservices, Big Data – NoSQL, etc. Some posts belong to multiple categories.