{"id":22837393,"url":"https://github.com/hubtou/pylists4c","last_synced_at":"2026-05-18T10:08:52.865Z","repository":{"id":53881684,"uuid":"521764189","full_name":"HubTou/PyLists4C","owner":"HubTou","description":"Python-style lists for the C language","archived":false,"fork":false,"pushed_at":"2023-04-06T20:06:03.000Z","size":462,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-07T12:06:03.926Z","etag":null,"topics":["c","data-structures","dll","library","linked-list","linked-lists","linkedlist","list","lists","lists-python","pylists4c","python","queue","queues","shared-library","stack","stacks","tree","tree-structure","trees"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HubTou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security/RATS_2.4_on_version_1.0.0.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-08-05T20:10:11.000Z","updated_at":"2022-11-05T11:46:26.000Z","dependencies_parsed_at":"2024-01-16T12:47:23.043Z","dependency_job_id":"af29ef2c-7971-4d04-b843-26069851c2e1","html_url":"https://github.com/HubTou/PyLists4C","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/HubTou/PyLists4C","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2FPyLists4C","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2FPyLists4C/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2FPyLists4C/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2FPyLists4C/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HubTou","download_url":"https://codeload.github.com/HubTou/PyLists4C/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2FPyLists4C/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33174091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","data-structures","dll","library","linked-list","linked-lists","linkedlist","list","lists","lists-python","pylists4c","python","queue","queues","shared-library","stack","stacks","tree","tree-structure","trees"],"created_at":"2024-12-12T23:16:41.093Z","updated_at":"2026-05-18T10:08:52.842Z","avatar_url":"https://github.com/HubTou.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![alt text](https://github.com/HubTou/PyLists4C/blob/main/logo/pylists4c-logo.png \"PyLists4C: Python-style lists for the C language\")\n# PyLists4C: Python-style lists for the C language\n## Features\nThis library provides a [Python-style](https://docs.python.org/3/tutorial/datastructures.html) (within the limits of the C language syntax of course) [lists](https://en.wikipedia.org/wiki/List_(abstract_data_type)) implementation, as doubly-[linked lists](https://en.wikipedia.org/wiki/Linked_list):\n* List items are ordered, changeable, and allow duplicate values.\n* List items can be of any standard C data type, plus:\n  * strings,\n  * sub-lists (thus enabling [trees](https://en.wikipedia.org/wiki/Tree_(data_structure)) data structures)\n  * and self-contained (= without pointers) structs of variable sizes.\n* A list can contain different data types at the same time.\n\nBeyond Python lists emulation, you'll also find:\n* List initialization with a powerful constructor or from C language tables\n* Conversion from or to [arrays](https://en.wikipedia.org/wiki/Array_(data_structure))\n* List deduplication, sorted insertion (with optional removal of duplicate values) or shuffling\n* List joining (beyond concatenation or extension) or splitting\n* [Stacks](https://en.wikipedia.org/wiki/Stack_(abstract_data_type)) (push/pop) and [queues](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) (enqueue/dequeue) management aliases\n* Statistics and debugging, including memory allocation followup\n\nWith:\n* Over 60 base functions,\n* Plus over 320 convenience type-oriented functions and intuitive aliases,\n* High modularity so your linker only includes what you use in your own executables,\n* Identical behavior across Unix-like and Windows operating systems for your programs portability,\n* Extensive [documentation](DOC.md) with examples for almost everything,\n* And friendly [BSD license](License), for open and free usage.\n\n## Base functions overview\nBase function | Aliases | Description\n--- | --- | ---\n**Creating a list**||\n[LIST](DOC.md#list-type)* MyList = NULL;||Creates an empty [LIST](DOC.md#list-type)\n[listCreateElement()](DOC.md#listcreateelement)||Creates an unlinked LIST element (rather for internal use)\n[list()](DOC.md#list)||Creates a LIST from a [Python-style LIST declaration string](DOC.md#list)\n[listFromTable()](DOC.md#listfromtable)||Converts a C language table into a LIST\n**Adding \u0026 changing elements**||\n[listAppend()](DOC.md#listappend)|[listPush()](DOC.md#listpush)\u003cbr\u003e[listEnqueue()](DOC.md#listenqueue)|Adds an element at the end of a LIST\n[listInsertFirst()](DOC.md#listinsertfirst)|[listPrepend()](DOC.md#listprepend)|Adds an element at the start of a LIST\n[listInsert(n)](DOC.md#listinsertn)||Inserts an element at the Nth position of a LIST\n[listInsertSorted()](DOC.md#listinsertsorted)||Inserts an element in a sorted LIST\n[listInsertList(n)](DOC.md#listinsertlistn)||Inserts a copy of the elements of a LIST at the Nth position of another LIST\n[listChange(n)](DOC.md#listchangen)||Changes the value of the element at the Nth position of a LIST\n[listChangeSlice(n, m)](DOC.md#listchangeslicen-m)||Changes the elements at the defined LIST [slice](https://docs.python.org/3/library/stdtypes.html#typesseq) with those from the second LIST\n**Displaying lists**||\n[listStr()](DOC.md#liststr)|[listAscii()](DOC.md#listascii)\u003cbr\u003e[listRepr()](DOC.md#listrepr)|Returns a pointer to a string containing a [Python-style LIST representation](DOC.md#displaying-lists)\n[listFreeStr()](DOC.md#listfreestr)||Frees the memory allocated to a [Python-style LIST representation](DOC.md#displaying-lists)\n[listPrint()](DOC.md#listprint)||Prints a [Python-style LIST representation](DOC.md#displaying-lists) to [stdout](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout))\n[listDebug()](DOC.md#listdebug)||Prints all LIST details to [stderr](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr))\n**Getting list information**||\n[listLen()](DOC.md#listlen)||Returns the number of elements in a LIST\n[listStats()](DOC.md#liststats)||Fills statistics about a LIST in one walkthrough\n[listStatsPrint()](DOC.md#liststatsprint)||Prints statistics about a LIST to [stdout](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout))\n**Searching for elements**||\n[listContains()](DOC.md#listcontains)||Tests if a value appears in a LIST\n[listCount()](DOC.md#listcount)||Returns the number of elements with the specified value\n[listIndex()](DOC.md#listindex)||Returns the index of the first element with the specified value\n[listIndexAll()](DOC.md#listindexall)|[listFind()](DOC.md#listfind)\u003cbr\u003e[listSearch()](DOC.md#listsearch)|Returns a LIST of all the indexes of the elements with the specified value\n**Working with numerical lists**||\n[listMaxXXX()](DOC.md#listmaxxxx)||Returns the maximum value in the LIST for the XXX type\n[listMinXXX()](DOC.md#listminxxx)||Returns the minimum value in the LIST for the XXX type\n[listSumXXX()](DOC.md#listsumxxx)||Returns the sum of values in the LIST for the XXX type\n**Fetching elements**||\n[listGet(n)](DOC.md#listgetn)||Returns the Nth [LIST_ELEMENT](DOC.md#list_element-type) of a LIST\n[listGetLast()](DOC.md#listgetlast)||Returns the last LIST_ELEMENT of a LIST\n[listSetIterator()](DOC.md#listsetiterator)||Defines a [LIST_ITERATOR](DOC.md#list_iterator-type) from a LIST_ELEMENT of a LIST\n[listNext()](DOC.md#listnext)||Returns the next LIST_ELEMENT of a LIST starting from a LIST_ITERATOR\n[listPrevious()](DOC.md#listprevious)||Returns the previous LIST_ELEMENT of a LIST starting from a LIST_ITERATOR\n**Fetching elements values**||\n[listValueXXX()](DOC.md#listvaluexxx)||Returns the element value in the requested type\n**Testing lists**||\n[listAreEqual()](DOC.md#listareequal)||Tests if two LISTs contain the same values\n**Working with lists**||\n[listCopy()](DOC.md#listcopy)||Returns a copy of the LIST (a full/deep copy as we don't want multiple references to the same values)\n[listSlice(n, m)](DOC.md#listslicen-m)\u003cbr\u003e[listSliceFrom(n)](DOC.md#listslicefromn)\u003cbr\u003e[listSliceTo(m)](DOC.md#listslicetom)||Returns a copy of a [slice](https://docs.python.org/3/library/stdtypes.html#typesseq) (i.e.: [n:m]) of a LIST\n[listFilter()](DOC.md#listfilter)||Returns a filtered copy of the LIST according to a user defined function telling if a LIST_ELEMENT should be included or not\n[listComprehension()](DOC.md#listcomprehension)|[listForEach()](DOC.md#listforeach)|Returns a new LIST according to a user defined function producing 0-N elements for each LIST_ELEMENT\n[listConcat()](DOC.md#listconcat)||Returns a new LIST with the concatenation of the elements of LIST1 and LIST2\n[listExtend()](DOC.md#listextend)||Adds a copy of the elements of the second LIST to the end of the first one\n[listJoin()](DOC.md#listjoin)||Moves the elements of the second LIST to the end of the first one\n[listSplit(n)](DOC.md#listsplitn)|[listHalve()](DOC.md#listhalve) for n = length/2|Cuts a LIST in two parts and returns a pointer to the second part\n**Changing list order**||\n[listSort()](DOC.md#listsort)||Sorts a LIST\n[listSorted()](DOC.md#listsorted)||Returns a sorted copy of a LIST\n[listSetDefaultSort()](DOC.md#listsetdefaultsort)||Sets the default sorting algorithm\n[listSortedByInsertion()](DOC.md#listsortedbyinsertion)||Returns a sorted copy of a LIST, using an [insertion sort](DOC.md#listinsertsorted) algorithm\n[listSortedByQsort()](DOC.md#listsortedbyqsort)||Returns a sorted copy of a LIST, using a [Quicksort](https://en.wikipedia.org/wiki/Quicksort) algorithm\n[listReverse()](DOC.md#listreverse)||Reverses the order of a LIST\n[listReversed()](DOC.md#listreversed)||Returns a reversed copy of a LIST\n[listShuffle()](DOC.md#listshuffle)||Shuffles a LIST\n[listShuffled()](DOC.md#listshuffled)||Returns a shuffled copy of a LIST\n**Lists to arrays conversion**||\n[listToArray()](DOC.md#listtoarray)||Converts a LIST into an [ARRAY](DOC.md#array-type)\n[listFromArray()](DOC.md#listfromarray)||Converts an ARRAY into a LIST\n[listFreeArray()](DOC.md#listfreearray)||Frees the memory allocated to an ARRAY\n**Removing elements**||\n[listDelNth(n)](DOC.md#listdelnthn)|[listDelFirst()](DOC.md#listdelfirst) for n=0\u003cbr\u003e[listDelLast()](DOC.md#listdellast) for n=-1|Removes the element at the specified position\n[listDelSlice(n, m)](DOC.md#listdelslicen-m)||Removes the elements at the specified [slice](https://docs.python.org/3/library/stdtypes.html#typesseq)\n[listPopNth(n)](DOC.md#listpopnthn)|[listPopFirst()](doc.md#listpopfirst) for n=0\u003cbr\u003e[listDequeue()](DOC.md#listdequeue) for n=0\u003cbr\u003e[listPop()](DOC.md#listpop) for n=-1|Removes the element at the specified position and returns it\u003cbr\u003e(you'll have to free it after use with [listClear()](DOC.md#listclear))\n[listRemove()](DOC.md#listremove)||Removes the first item with the specified value\n[listRemoveAll()](DOC.md#listremoveall)||Removes all the items with the specified value\n[listRemoveDuplicates()](DOC.md#listremoveduplicates)||Removes adjacent duplicate items in a sorted LIST\n**Clearing lists**||\n[listClear()](DOC.md#listclear)|[listDel()](DOC.md#listdel)\u003cbr\u003e[listFree()](DOC.md#listfree)|Removes all the elements of the LIST\n**Structs handling**||\n[listSetStructSize()](DOC.md#listsetstructsize)||Sets the size of a STRUCT you want to compare\n[listSetStructComparator()](DOC.md#listsetstructcomparator)||Sets the function to be used to compare STRUCTs\n[listSetStructStringer()](DOC.md#listsetstructstringer)||Sets the function to be used to string STRUCTs\n[listSetStructPrinter()](DOC.md#listsetstructprinter)||Sets the function to be used to print STRUCTs to [stdout](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout))\n[listSetStructDebugger()](DOC.md#listsetstructdebugger)||Sets the function to be used to debug STRUCTs to [stderr](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr))\n**Miscellaneous**||\n[listSetDebugMessagesDisplay()](DOC.md#listsetdebugmessagesdisplay)||Sets whether or not to print debugging messages to [stderr](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr))\n[listSetFatalMallocErrors()](DOC.md#listsetfatalmallocerrors)||Sets whether memory allocation errors are fatal or not\n[listGetAllocatedMemory()](DOC.md#listgetallocatedmemory)||Returns the quantity of allocated/unfreed memory used by this library\n\n## Where to go from here?\nInterested? Then go to the [documentation](DOC.md) to learn more about this library and find multiple [examples](tests/).\n\nStill missing something? Then go to the [discussions](https://github.com/HubTou/PyLists4C/discussions) and tell me!\n\nEncountering an issue? Then report it in the [issues](https://github.com/HubTou/PyLists4C/issues) section.\n\nHappy with it? Then please help me promote this library.\n* Go, tell it on the mountain(s), over the hills and everywhere!\n* If your code is also on GitHub, reference and co-promote your own creations with the [pylists4c](https://github.com/topics/pylists4c) topic \n\nVolunteering to contribute? Then check our [evolution ideas](TODO.md). For example:\n* Make a package for your favourite operating system\n* Translate the [documentation](DOC.md)\n* Help with missing features and evolution ideas\n* ...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubtou%2Fpylists4c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubtou%2Fpylists4c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubtou%2Fpylists4c/lists"}