cruise-automation / isopod

An expressive DSL and framework for Kubernetes configuration without YAML
Apache License 2.0
482 stars 32 forks source link

assert behavior inconsistent with python #70

Open bplotnick opened 4 years ago

bplotnick commented 4 years ago

assert is a reserved keyword in python and so it cannot be used as a function. So in python, there is a tricky gotcha where the following will not fail:

assert(1 == 2, "hello")

because it is equivalent to:

assert (1==2, "hello")

which is asserting the "truthiness" of a tuple, which is True.

However, in isopod we override the assert keyword to make it a function, so the two are equivalent.

This breaks python grammar rules, which affects the ability to re-use code formatting tools like black. It's also just confusing that something that the behavior is the opposite of the python behavior.

We should either fix the grammar to allow assert as a statement or use a different function name.