Python is Magic/Constants

From Esolang
Jump to navigation Jump to search
Back to Python is Magic

The following programs are constants in Python is Magic.

Booleans

Constant Code
False __doc__.__bool__()
True __doc__.__eq__(__doc__)

Integers

Constant Code
-2 __doc__.__eq__(__doc__).__invert__()
-1 __doc__.__bool__().__invert__()
0 __doc__.__bool__().__int__()
(__doc__.__bool__() can be used in some cases)
1 __doc__.__eq__(__doc__).__int__()
(__doc__.__eq__(__doc__) can be used in some cases)
2 __doc__.__eq__(__doc__).__invert__().__neg__()
3 __name__.__class__.__name__.__len__()
4 __doc__.__str__().__len__()
5 __doc__.__bool__().__str__().__len__()
6 __doc__.__eq__.__name__.__len__()
7 __doc__.__dir__.__name__.__len__()
8 __doc__.__bool__.__name__.__len__()
(__name__.__len__() can be used assuming __name__ == "__main__")

Lowercase letters

Constant Code
a __doc__.__bool__().__str__().__getitem__(__name__.__len__().__bool__())
(__name__.__getitem__(__name__.__class__.__name__.__len__()) can be used assuming __name__ == "__main__")
b __doc__.__bool__().__class__.__name__.__iter__().__next__()
c __doc__.__reduce__.__name__.__getitem__(__doc__.__eq__.__name__.__len__())
d __name__.__add__.__name__.__getitem__(__doc__.__str__().__len__())
e __doc__.__eq__.__doc__.__getitem__(__doc__.__eq__(__doc__)) (May change if Python changes doc for __eq__)
f __doc__.__sizeof__.__name__.__getitem__(__doc__.__dir__.__name__.__len__())
g __name__.__getnewargs__.__name__.__getitem__(__doc__.__format__.__name__.__len__())
h __doc__.__init_subclass__.__doc__.__getitem__(__doc__.__eq__(__doc__)) (May change if Python changes doc for __init_subclass__)
i __doc__.__sizeof__.__doc__.__getitem__(__doc__.__eq__(__doc__)) (May change if Python changes doc for __sizeof__)
(__name__.__getitem__(__doc__.__str__().__len__()) can be used assuming __name__ == "__main__")
j __name__.__doc__.__getitem__(__doc__.__eq__.__name__.__len__()) (May change if Python changes doc for str)
k __doc__.__reduce__.__doc__.__getitem__(__doc__.__str__().__len__().__neg__()) (May change if Python changes doc for __reduce__)
l __doc__.__dir__().__class__.__name__.__iter__().__next__()
m __doc__.__eq__.__class__.__name__.__iter__().__next__()
n __doc__.__init__.__doc__.__getitem__(__doc__.__eq__(__doc__)) (May change if Python changes doc for __init__)
(__name__.__getitem__(__doc__.__bool__().__str__().__len__()) can be used assuming __name__ == "__main__")
o __doc__.__str__().__getitem__(__doc__.__eq__(__doc__))
p __doc__.__repr__.__name__.__getitem__(__doc__.__str__().__len__())
q __doc__.__eq__.__name__.__getitem__(__name__.__class__.__name__.__len__())
r __doc__.__new__.__doc__.__getitem__(__doc__.__eq__(__doc__)) (May change if Python changes doc for __new__)
s __name__.__doc__.__iter__().__next__() (May change if Python changes doc for str)
t __name__.__getnewargs__().__class__.__name__.__iter__().__next__()
u __doc__.__dir__.__doc__.__getitem__(__doc__.__str__().__len__()) (May change if Python changes doc for __dir__)
v __name__.__len__().__invert__.__name__.__getitem__(__doc__.__str__().__len__())
w __doc__.__new__.__name__.__getitem__(__doc__.__str__().__len__())
x __doc__.__reduce_ex__.__name__.__getitem__(__doc__.__reduce__.__name__.__len__())
y __doc__.__class__.__name__.__getitem__(__doc__.__bool__().__str__().__len__())
z __doc__.__sizeof__.__name__.__getitem__(__doc__.__str__().__len__())