coderz.py

Keep Coding Keep Cheering!

Event Object in Python

What is an Event Object? An Event object in Python is a class that is used to signal the occurrence of a particular event. It is part of the threading module in Python and is used to synchronize threads. It is used to manage an internal flag that can be set to True using the […]

January 6, 2023 | python | No comments

RLock Object in Python

RLock (re-entrant lock) is a type of lock that allows the holder of the lock to acquire it multiple times without causing a deadlock. This can be useful in situations where a thread needs to acquire the same lock multiple times while performing some operation. Note: If a code can be safely called again, it […]

January 5, 2023 | python | No comments

Lock Object in Python

What is a Lock Object? In Python, a threading.Lock object is used to synchronize the execution of threads. It can protect critical sections of code that should not be executed concurrently. When a thread acquires a lock, it blocks other threads from entering the critical section until it is released. Syntax for creating a Lock […]

January 4, 2023 | python | No comments

Thread class and its Object

The Thread class in Python’s threading module is used to create and manage threads. We can extend this class to create a Thread or create a Thread class object directly and pass a member function from another class. There are two methods for creating the Thread object and specifying the activity to be carried out: […]

December 31, 2022 | python | No comments

threading Module In Python

Python threading, as we saw in the previous tutorial, allows us to run different parts of our program concurrently, which can simplify our design. Functions of threading Module: Following are some of the Functions: Function Description active_count() Return the number of active Thread objects. The count returned is the same as the length of the list […]

December 30, 2022 | python | No comments

Multithreading In Python

Let’s look at Python threads first before presenting the idea of multithreading. Threads: Threads are quick processes (smaller versions of larger processes) that can operate concurrently and in parallel with one another, with each thread capable of carrying out a specific task. Processes frequently house threads. Within a single process, several threads may exist. Threads share […]

December 29, 2022 | python | No comments

Python File Operations

Why are file operations required in Python?Working with files is a must when dealing with large datasets in machine learning problems. Because Python is a popular data science language, you should be familiar with the various file operations that Python provides. Reading a File: The readline() function reads a line from a document. The string […]

December 29, 2022 | python | No comments

File Handling in Python

What is File Handling? Every web app requires the handling of files. File handling is critical when data must be stored permanently in a file.  A file is a named location on the disc where related information is stored.  After the program has terminated, we can access the stored information (non-volatile). File Access Modes: Access Modes govern the activities you can perform on the opened file. These describe how to use the file once it has been opened. These modes also specify the location of the […]

December 25, 2022 | python | No comments

Python Exception Handling – III(Raise Keyword )

In Python, the raise keyword is primarily used for exception handling. Exception handling is responsible for handling exceptions or errors so that the system does not fail due to incorrect code. The raise keyword generates an error and halts the program’s control flow. It is used to invoke the current exception handler so that it […]

December 23, 2022 | python | No comments

Python Exception Handling – II(Finally Keyword )

Finally Keyword  Python has a finally keyword that is always executed after a try and except block. The finally block is always executed after the try block has terminated normally or due to an exception. Even if you return in the except block, the finally block will still be executed. Note: In Python, the keyword […]

December 22, 2022 | python | No comments

Advertisement