Q:

Python creation of flags, for self created class

Some Python standard libraries use flags like this:
re.match(pattern, str, re.MULTILINE | re.IGNORECASE)

I am wondering, how to implement that, if you are creating a class yourself.
I have searched the Internet and found that:
Python: passing flags to functions
That question is not satisfying for me, as it only show's the approach of saying 
bla.function(argument, flag1=0, flag3=1)

But I really want it like
bla.function(argument, bla.SOMEFLAG | bla.SOMEOTHERFLAG)

is this possible?
Furthermore is it possible to create these flags, without letting them refer to an actual value?, so you really ask for bla.SOMEFLAG in the code and not for an int, that is represented by the flag? An example usage for that would be:
mask_list = [
    [             15,           "foo",           "bar"],
    [bla.TRANSPARENT,           "egg",            14.3],
    [        (4,7,2), {"name":"john"}, bla.TRANSPARENT]
]

where mask_list represents a mask(containing any elements), which can later be compared to another list by a function, all indexes where a bla.TRANSPARENT flag is set, get ignored by the comparison.
If someone could pass me a link to a file, where this is explained, or could come up with a simple explanation, I would be really grateful. (I am using Python3)
Thanks in advance!

A:

There is nothing stopping you doing this:
bla.function(argument, bla.SOMEFLAG | bla.SOMEOTHERFLAG)

if your function signature is
def function(arg, flags):

But | is a bitwise operator and so it implies that its operands are integers, or integer-like. And so bla.SOMEFLAG and bla.SOMEOTHERFLAG must be integer values for this to work.
The other option is to use keyword parameters:
bla.function(argument, SOMEFLAG = True, SOMEOTHERFLAG = True)

and define your function like this:
def function(arg, **flags):

Inside that function, flags will be:
{'SOMEFLAG': True, 'SOMEOTHERFLAG': True}

