bastikr / boolean.py

Implements boolean algebra in one module.
BSD 2-Clause "Simplified" License
76 stars 34 forks source link

Remove py2-incompatible use of print statement. #95

Closed benjyw closed 4 years ago

benjyw commented 4 years ago

In python 2 print is a statement, not a function, so it cannot be used as the first argument to map().

benjyw commented 4 years ago

Context is that I want to use boolean.py in the pex python packaging system (https://github.com/pantsbuild/pex) to evaluate complex interpreter constraints.

E.g., "((CPython>=2.7,<3 OR CPython>=3.5) AND CPython>=3.6)".

Because interpeter constraint evaluation happens at runtime, we need to vendor boolean.py and rename its symbols, using RedBaron, so it doesn't collide with any version of boolean.py that mght happen to be in the packaged code.

RedBaron was choking on the two issues fixed in this PR. The first, using map(print, ...)), is an actual bug, The second is more of a workaround for a minor limitation in RedBaron's parser.

Thanks!

pombredanne commented 4 years ago

@benjyw sorry for the late reply! Let me merge thisi alright