Implementing the Python List (list) Class in C

Pubblicato il: 19 marzo 2023
sul canale di: 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.


In questa pagina del sito puoi guardare il video online Implementing the Python List (list) Class in C della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Chuck Severance 19 marzo 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,040 volte e gli è piaciuto 65 spettatori. Buona visione!