mame82 / duckencoder.py

Python port of infamous duckencoder for RubberDucky
136 stars 49 forks source link

from __future__ import print_function for Python 3 #2

Closed cclauss closed 7 years ago

cclauss commented 7 years ago

altReadResource() uses a generator and a dict comprehension to do what readResource() does but I can not be 100% sure that it handles all corner cases so I left readResource() in place for now.

mame82 commented 7 years ago

Have to take some time to review this (and learn to build tests to assure the "alt" function produces the intended result). Big thanks for your support tidying the code. The long if blocks are a result of the one-o-one port of the DuckEncoder Hava implementation. It included even logical errors, as I want to have the exact same functionality. Should have rebuilt it from scratch. What is the benefit of changing the print function to future? Is that all what has to be done to get python 3 ready?

cclauss commented 7 years ago

Understood. No rush.

The advantage there are two advantages to putting in the future bit:

  1. old style print is a syntax error even on Python 2 which prevents Py2 coders from re-breaking code that has been fixed to be Py3 compatible.
  2. print() parameters like end and file work the same in both Py2 and Py3

It is unclear if these are the last changes that are required to by Python 3 compatible but no issues were picked up by flake8 or by my eyeballs -- but neither is perfect.

mame82 commented 7 years ago

Thanks again for your support