Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2 support #4

Merged
merged 4 commits into from
Mar 26, 2017
Merged

Python 2 support #4

merged 4 commits into from
Mar 26, 2017

Conversation

tonycpsu
Copy link
Contributor

Addresses #3, support for Python < 3.0

* Use PYTHON3 constant (from sys.version_info) to special-case some behavior,
  with the goal of supporting Python 2.x
* Several cases of list.copy() instead do list[:] when using Python 2.x
* Renamed DataFrame's .print() -> .show() to avoid clash with "print" keyword.
* Removed type hints
* Replace print() with show()
* Tests shouldn't expect TypeError in many cases with Python 2, so code that
  would raise it under Python 3 isn't executed if running 2.x
@rsheftel
Copy link
Owner

rsheftel commented Mar 25, 2017

Question, why does Python2.7 not raise a TypeError in the tests that have a mixed types for the index and attempt to get sorted? I see you had to remove those tests for Python2.7 and I am curious why. Thanks.

I think I answered my own question here: https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons

Do you think it is OK for pyhton2 and 3 to have different results? Or should the code somehow force an error on Python2 as well?

@rsheftel rsheftel self-requested a review March 25, 2017 22:19
@tonycpsu
Copy link
Contributor Author

tonycpsu commented Mar 26, 2017

Yeah, Python 2 is basically ¯\(ツ)/¯ when it comes to types, which is a blessing and a curse. Constantly checking the types of all of the items in the lists every time they're modified probably doesn't make a lot of sense, and most people who use Python 2 are aware of its quirks, so I wouldn't worry about it.

@rsheftel rsheftel merged commit 545277e into rsheftel:master Mar 26, 2017
Copy link
Owner

@rsheftel rsheftel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests updated and passed

@rsheftel rsheftel mentioned this pull request Mar 26, 2017
@tonycpsu tonycpsu deleted the python_2_support branch March 31, 2017 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants