Featured Post

8 Ways to Optimize AWS Glue Jobs in a Nutshell

Image
  Improving the performance of AWS Glue jobs involves several strategies that target different aspects of the ETL (Extract, Transform, Load) process. Here are some key practices. 1. Optimize Job Scripts Partitioning : Ensure your data is properly partitioned. Partitioning divides your data into manageable chunks, allowing parallel processing and reducing the amount of data scanned. Filtering : Apply pushdown predicates to filter data early in the ETL process, reducing the amount of data processed downstream. Compression : Use compressed file formats (e.g., Parquet, ORC) for your data sources and sinks. These formats not only reduce storage costs but also improve I/O performance. Optimize Transformations : Minimize the number of transformations and actions in your script. Combine transformations where possible and use DataFrame APIs which are optimized for performance. 2. Use Appropriate Data Formats Parquet and ORC : These columnar formats are efficient for storage and querying, signif

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

How to Check Kafka Available Brokers

SQL Query: 3 Methods for Calculating Cumulative SUM