Closed kburk1997 closed 7 years ago
Thanks, this is brilliant! I'd love to use your code, but it seems that some changes you made aren't necessarily completely backwards compatible with Python 2.7 (e.g. by disallowing the use of unicode
type variables). Would it be a good idea to set this up as either a separate branch, or as a different part of the main branch? I see roughly three options:
1) Separate branch on GitHub for Python 3.5. (Personally, I don't prefer this, as the branching system isn't very user-friendly for people who aren't used to GitHub.)
2) Separate directory in the main branch, e.g. markovbut35
. Users download the entire package, and then choose the directory that's applicable to them. (Least effort for us.)
3) Separate class definition for MarkovBot27
and MarkovBot35
. Then we have a separate class MarkovBot
that morphs into either one of those, depending on what Python version it detects. (Most fancy option, probably the most user-friendly option too, but also the most work.)
BTW: I'm not a big user of 3.5, so it'd be great if you'd be open for taking responsibility for maintaining that part.
What do you think?
I'd start out with option 2 as a minimum viable solution, then eventually work up to option 3 when either of us have the chance.
I ended up implementing a solution that holds the middle between options 2 and 3. The class doesn't morph now, but only one of the two versions is loaded in __init__.py
:
import sys
# Check what version we're currently running, and import the corresponding
# MarkovBot class.
if sys.version_info[0] == 3:
from markovbot35 import MarkovBot
else:
from markovbot27 import MarkovBot
Various parts of the code threw errors in Python 3.5, including unicode checking, keys, and xrange. Fixed to work with 3.5