Python 3.8 introduced the "walrus operator" := to do assignment expressions. I assume they considered using the keyword as but rejected it. Are there existing syntactic cases for as that precluded using it for assignment expressions?
To use an example from the Python docs:
# Actual Python 3.8 syntax
if (n := len(a)) > 10:
print(f"List is too long ({n} elements, expected <= 10)")
# Why not this?
if (len(a) an n) > 10:
print(f"List is too long ({n} elements, expected <= 10)")
Here's another example:
# Actual Python 3.8 syntax
while (block := f.read(256)) != '':
process(block)
# Why not this?
while f.read(256) as block:
process(block)
Insight into questions like these ("why did they do X instead of Y") can usually be gained by reading the relevant PEP, which often has a section on "things we considered but rejected".
https://peps.python.org/pep-0572/#alternative-spellings
The page goes on to list other reasons that using
asin this way was considered to be potentially confusing.