-
Notifications
You must be signed in to change notification settings - Fork 0
pointers
jasper-zanjani edited this page Aug 6, 2020
·
1 revision
Python, which emphasizes abstraction and usability, does not support pointers natively. realpython.com But there are some features of Python which provide the benefits of pointers.
-
id(object)
Return {object}'s memory address -
object is other
return True if {object} and {other} share the same memory address
Mutable primitives list
, set
, dict
can be used to simulate pointers, since their memory address will not change.
Custom objects can also be used to recreate the behavior of pointers.
Lastly, the ctypes
module allows you to use shared libraries compiled from C programs, calling C functions from within Python. dbader.org
- argparse ?
- array ?
- asyncio ?
- bisect ?
- csv ?
- ctypes ?
- curses ?
- datetime ?
- functools ?
- getpass ?
- glob ?
- heapq ?
- http ?
- json ?
- logging ?
- optparse ?
- os ?
- pathlib ?
- platform ?
- pythonnet ?
- random ?
- socket ?
- subprocess ?
- sqlite3 ?
- sys ?
- termcolor ?
- threading ?
- trace ?
- typing ?
- unittest ?
- urllib ?
- venv ?
- weakref ?
- winrm ?