Featured Post

14 Top Data Pipeline Key Terms Explained

Image
 Here are some key terms commonly used in data pipelines 1. Data Sources Definition: Points where data originates (e.g., databases, APIs, files, IoT devices). Examples: Relational databases (PostgreSQL, MySQL), APIs, cloud storage (S3), streaming data (Kafka), and on-premise systems. 2. Data Ingestion Definition: The process of importing or collecting raw data from various sources into a system for processing or storage. Methods: Batch ingestion, real-time/streaming ingestion. 3. Data Transformation Definition: Modifying, cleaning, or enriching data to make it usable for analysis or storage. Examples: Data cleaning (removing duplicates, fixing missing values). Data enrichment (joining with other data sources). ETL (Extract, Transform, Load). ELT (Extract, Load, Transform). 4. Data Storage Definition: Locations where data is stored after ingestion and transformation. Types: Data Lakes: Store raw, unstructured, or semi-structured data (e.g., S3, Azure Data Lake). Data Warehous...

How to Work with 'Pointers' in Python

Pointers denote an address (memory location). It has three identities - Name, Value, and Location (Address). Python doesn't support pointers as-is. You need to import 'ctypes' package to work with C Language.

Note: Pointer is popular in C, C++. The called module just uses the value of Pointer (not address).  Below is my detailed post on pointers.  


An article on how to work with pointers


How to work with Pointers

  • To pass a reference(address) to the C interface.
  • You can use C Language in Python by importing 'ctypes.' 

Pointer Notation

1. Value
2. Address
3. Name

Python Pointers


Python doesn't support pointers. C and C++ extensively support pointers. Pointer is nothing but an ADDRESS. It is immutable. That means you can't change the value. Python supports pointers for the purpose to interact with C Language.



Pointers

How to Import 'ctypes'

  1. Import 'ctypes' library for the purpose of working with C language. 
  2. Here's how to import 'ctypes' for windows and Linux.

How to denote Pointers

Here's the way to denote pointers in Python. Check out here Python Pointers.

 
from ctypes import * 
i = c_int(42) 
pi = pointer(i) 


Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

SQL Query: 3 Methods for Calculating Cumulative SUM

Big Data: Top Cloud Computing Interview Questions (1 of 4)