Skip to content

Tag Archives: Python-ctype

Prerequisite: Python | Unit Test Objects Patching Unit Testing is the first level of software testing where the smallest testable parts of the software are… Read More
A lot of people use Python as a replacement for shell scripts, using it to automate common system tasks, such as manipulating files, configuring systems,… Read More
MagicMock instances that are normally used as replacement values are meant to mimic callables and instances. They record information about usage and allow to make… Read More
The problem is writing unit tests and need to apply patches to selected objects in order to make assertions about how they were used in… Read More
Testing is a critical part of development as there is no compiler to analyze the code before Python executes it. Given a program that has… Read More
Filename has to be encoded according to the system’s expected filename encoding before passing filenames to C library functions. Code #1 : To write an… Read More
The article aims to write C extension code that consumes items from any iterable object such as a list, tuple, file, or generator. Code #1… Read More
String handling in extension modules is a problem. C strings in extensions might not follow the strict Unicode encoding/decoding rules that Python normally expects. Thus,… Read More
Writing C extension code that consumes data from any Python file-like object (e.g., normal files, StringIO objects, etc.). read() method has to be repeatedly invoke… Read More
One can convert strings between C and Python vice-versa but the C encoding is of a doubtful or unknown nature. Let’s suppose that a given… Read More
Given that one wants to write an extension module that needs to pass a Python string to C library function. So, the question arises to… Read More
Well, the memory address of a compiled function is obtained but how to turn it to Python callable that can be used as an extension.… Read More
For C strings represented as a pair char *, int, it is to decide whether or not – the string presented as a raw byte… Read More
If one wants an extension module that needs to pass a NULL-terminated string to a C library. Let’s see how to do it with Python’s… Read More
Prerequisite: High-Performance Array Operations with Cython | Set 1The resulting code in the first part works fast. In this article, we will compare the performance… Read More

Start Your Coding Journey Now!