Search notes:

Python: list vs tuple

Tuples are immutable, lists are mutable. (That is, once a tuple is created, its not possible to add or replace elements in it.)
Because a dict only allows immutable objects as keys, a list cannot be used as a key in a dict. (In order for an object to be used as a key in a dict, the object needs to be hashable, that is: hash(obj) needs to be defined).
Typically, tuples are used in a similar fashion like a C struct with a predefined number of elements and types.
Lists on the other hand are often used like arrays with a varying number of elements.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758206325, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/types/list-vs-tuple(40): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78