Comments

# This is a comment
# -*- coding: <encoding-name> -*-

Strings

"foo \"bar\" baz"
'foo \'bar\' baz'
""" "Multi-line" strings
are supported."""
''' 'Multi-line' strings
are supported.'''

Numbers

7
2147483647
0o177
0b100110111
3
79228162514264337593543950336
0o377
0x100000000
0xdeadbeef
3.14
10.
.001
1e100
3.14e-10
0e0
3.14j
10.j
10j
.001j
1e100j
3.14e-10j

Full example

def median(pool):
    '''Statistical median to demonstrate doctest.
    >>> median([2, 9, 9, 7, 9, 2, 4, 5, 8])
    7
    '''
    copy = sorted(pool)
    size = len(copy)
    if size % 2 == 1:
        return copy[(size - 1) / 2]
    else:
        return (copy[size/2 - 1] + copy[size/2]) / 2
if __name__ == '__main__':
    import doctest
    doctest.testmod()

Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. However, Prism dares to be open and honest about them. If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

Interpolation expressions containing strings with { or }

f"{'}'}"