Note that I'm new to this system, so I'm not sure if this will format correctly 
or whether I'll be able to edit it afterward to format it properly if not. 
Fingers crossed.

Examples:
    import re
    from collections import Sequence

    # Equivalent of re.compile(r'b.d').search(<str>)
    re.compile(r'b.d') in 'abcdef'  # -> <_sre.SRE_Match object; span=(1, 4), 
match='bcd'>
    re.compile(r'b.d') in 'xyz'  # -> None
    
    # Equivalent of isinstance([1, 2], Sequence)
    [1, 2] in Sequence  # -> True

    class BrightColorsMeta(type):
        def __rin__(self, other):
            other.startswith('bright ')

    class BrightColors(metaclass=BrightColorsMeta): pass

    'red' in BrightColors  # -> False
    'bright blue' in BrightColors  # -> True
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LOWRX42JL3SWG4QSOMV3WX4SOLJBXPXV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to