weixin_39849671
2021-01-12 18:29 阅读 0

Add Python 3 compatibility

A bit slap-dash, but nothing major modified. Tweaks generally break down into 4 categories: 1. print() 2. Builtin/library generator wrangling (xrange, izip, forcing generator evaluation...) 3. Explicit relative imports (along with cleaning up imports I generally sorted them into stdlib vs. other) 4. Removing spaces at end of lines (because my editor does it automatically)

Another minor tweak was explicitly encoding a string (unicode in Python 3) into UTF-8 so it could be hashed.

With the changes, running example.py works just fine, but let me know if you want the commits cleaned up a bit.

该提问来源于开源项目:worldveil/dejavu

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

11条回答 默认 最新

  • weixin_39849671 weixin_39849671 2021-01-12 18:29

    Forgot about the tests for some reason (see 3b04a39)... There was some trouble with ast.literal_eval (maybe the replaces to reformat the string weren't enough?), so I just did an end-around and used JSON. Python 3 absolutely requires consistent space/tab usage across the entire file, so I cleaned that in run_tests.py and for funsies the entire project after converting example.py

    Again...my commit isn't super clean, but the code should be.

    点赞 评论 复制链接分享
  • weixin_39678493 weixin_39678493 2021-01-12 18:29

    My apologies for not looking at this sooner, I will do so this week!

    点赞 评论 复制链接分享
  • weixin_39714528 weixin_39714528 2021-01-12 18:29

    When will you add python3 compatibility?

    点赞 评论 复制链接分享
  • weixin_39816027 weixin_39816027 2021-01-12 18:29

    More interest in python3 here :)

    点赞 评论 复制链接分享
  • weixin_39785669 weixin_39785669 2021-01-12 18:29

    Python3 is the future!

    点赞 评论 复制链接分享
  • weixin_39747615 weixin_39747615 2021-01-12 18:29

    +1

    点赞 评论 复制链接分享
  • weixin_39612297 weixin_39612297 2021-01-12 18:29

    any luck with the python 3 yet ?

    点赞 评论 复制链接分享
  • weixin_39726131 weixin_39726131 2021-01-12 18:29

    Btw the python 2.7 deprecation is 2020 - https://pythonclock.org/ My question is: what is the reason to move to Python3 now?

    点赞 评论 复制链接分享
  • weixin_39598796 weixin_39598796 2021-01-12 18:29

    Any word on this?

    点赞 评论 复制链接分享
  • weixin_39522927 weixin_39522927 2021-01-12 18:29

    +1

    点赞 评论 复制链接分享
  • weixin_39678493 weixin_39678493 2021-01-12 18:29

    This has just been added!

    点赞 评论 复制链接分享

相关推荐