I have a Python script in which I have an assert. The assert is always true; that's why I'm asserting it. The assert is a canary in case I change a constant in one place without changing code that depends on it having that value.

Python 3 gives me a warning that the assertion is always true. That's annoying. Can I turn the warning off?

/path/toplevel.py:10: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert(VID_V_ACTIVE == 144, "constant different from expected")

@mcc the parentheses means you're asserting that the tuple is not false, which is trivial and not what you want

@mcc @Pashhur okay but uh... why would they make the syntax for assert different than every other method call?

🤦🏻‍♀️

@tess @mcc @Pashhur it's that way because of the law of Equivalent Exchange. Python added parentheses to print, so it had to take them from somewhere else to maintain balance.

@rotopenguin @tess @mcc @Pashhur you do not want to see the timeline where a time traveler killed Python 3 as a baby

@falken how familiar are you with the Zope Wars, exactly?

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.