Implementing the Python List (list) Class in C

Publié le: 19 mars 2023
sur la chaîne: Chuck Severance
2,040
65

This lecture details the implementation of a Python list class in C using a linked list structure. The PyList object contains head and tail pointers and a count field. The implementation appends strings, prints the list, checks the length, and performs index lookups, returning negative one for missing elements.

The destructor traverses the linked list from head to tail, freeing each node's string data before the node itself to avoid memory leaks. The list printing method uses printf to output the list in Python-like format without string concatenation, and the lecture covers the implementation of the len, index, and append methods.

For more materials, auto graders, and more courses, please see www.masterprogrammer.com.


Sur cette page du site, vous pouvez voir la vidéo en ligne Implementing the Python List (list) Class in C durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Chuck Severance 19 mars 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 2,040 fois et il a aimé 65 téléspectateurs. Bon visionnage!