# pass can still be used as before:
def foo(x):
pass
# in this demo, it can also be used as an expression, with
# some exceptions to normal evaluation rules.
# pass cannot be added to collections.
condition = False
my_tuple = (
"first_item",
"second_item" if condition else pass,
"third_item",
)
print(my_tuple)
assert set() == {pass}
# pass can't be used as a key or a value in a dictionary.
x = {1: 2, pass: 4, 5: pass}
x[pass] = 20
x[30] = pass
print(x)
# when provided as an arg or kwarg, pass is completely ignored
# (as though it was not provided at all)
def foo(x, y, z=1, a=2):
return x, y, z, a
print(foo(20, pass, 30, a=pass, z=70))
# for this demo, / is an alias for pass, as a way to try out
# some of the other syntax proposed in the thread for
# empty sets:
assert set() == {/}
The simple REPL provides a limited Python experience in the
browser.
Tools/wasm/README.md
contains a list of known limitations and issues. Networking,
subprocesses, and threading are not available.
SharedArrayBuffer, which is required for this demo,
is not available in your browser environment. One common cause
of this failure is loading index.html directly in
your browser instead of using server.py as
described in
Tools/wasm/README.md
.
For more details about security requirements for
SharedArrayBuffer, see
this MDN page.