Sage Cell Server has migrated to Python 3

Applied Discrete Structures 2019-12-30

I recently discovered that many of the SageMath cells in the web version of Applied Discrete Structures (ADS) were no longer working as they had in the past. Then I found out why.  Apparently, 2020 is the Y2K of the Python Universe.  ... and I was oblivious to it!
The Python 2 language, i.e. Python 2.7.x, is officially being discontinued on January 1, 2020 (first planned for 2015) after which security patches and other improvements will not be released for it.[29][30] With Python 2's end-of-life, only Python 3.5.x[31] and later will be supported.
Due to differences in the two versions of Python, there are two main impacts on the code on the current web version of ADS.
  • "print expr" produces an error and needs to be replaced with "print(expr)"
  • map produces an iterator instead of a list.  This is fixed by wrapping  list( ) around the map expression if the original output is as desired.  More about iterators.
  • keys of a dictionary are are also an iterator and using list is the fix in this situation too.
Fortunately the PreTeXt project has my back and an automated system has been developed to identify all the problems.   I hope to have an updated web version ready for the spring semester.