CaselessList

Inheritance diagram of CaselessList
class CaselessList(inlist=[])[source]

Bases: list

A case insensitive lists that has some caseless methods. Only allows strings as list members. Most methods that would normally return a list, return a CaselessList. (Except list() and lowercopy()) Sequence Methods implemented are : __contains__, remove, count, index, append, extend, insert, __getitem__, __setitem__, __getslice__, __setslice__ __add__, __radd__, __iadd__, __mul__, __rmul__ Plus Extra methods: findentry, copy , lowercopy, list Inherited methods : __imul__, __len__, __iter__, pop, reverse, sort

append(item)[source]

Adds an item to the list and checks it’s a string.

copy()[source]

Return a CaselessList copy of self.

count(item)[source]

Counts references to ‘item’ in a caseless manner. If item is not a string it will always return 0.

extend(item)[source]

Extend the list with another list. Each member of the list must be a string.

findentry(item)[source]

A caseless way of checking if an item is in the list or not. It returns None or the entry.

index(item, minindex=0, maxindex=None)[source]

Provide an index of first occurence of item in the list. (or raise a ValueError if item not present) If item is not a string, will raise a TypeError. minindex and maxindex are also optional arguments s.index(x[, i[, j]]) return smallest k such that s[k] == x and i <= k < j

insert(i, x)[source]

s.insert(i, x) same as s[i:i] = [x] Raises TypeError if x isn’t a string.

list()[source]

Return a normal list version of self.

lowercopy()[source]

Return a lowercase (list) copy of self.

remove(item)[source]

Remove the first occurence of an item, the caseless way.