Skip to content

jackjennings/unicodeset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unicodeset

image

image

unicodeset is a small module for managing sets of unique Unicode code points.

The classes UnicodeSet and FrozenUnicodeSet as superclasses of the respective Python builtins.

Supports Python 2.6 – 3.x

Installation

$ pip install unicodeset

Usage

from unicodeset import UnicodeSet, FrozenUnicodeSet

Values can be passed in as either integers or strings (or Unicode strings in Python 2.7).

>>> s = UnicodeSet(['a', 98, u'c'])
UnicodeSet([u'a', u'b', u'c'])

Inclusion can be checked using either an integer or string representations.

>>> s = UnicodeSet([u'a', u'b', u'c'])
>>> 98 in s
True
>>> 'b' in s
True

Iterating over UnicodeSet returns values sorted by code point.

>>> [c for c in UnicodeSet(['z', 'n', '$', 'a'])]
[u'$', u'a', u'n', u'z']

About

Superclass of set/frozenset for unicode character sets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages