thefuck icon indicating copy to clipboard operation
thefuck copied to clipboard

Use `yield from`

Open abdulniyaspm opened this issue 6 years ago • 4 comments

Since the requirement is python (3.4+) we could use the shortened form of for item in iterable. ie, This PR suggest to change

 for command in sorted_commands:
       yield command

with

yield from sorted_commands

This is available from python 3.3 onwards

abdulniyaspm avatar Jan 05 '19 17:01 abdulniyaspm

Thanks for your PR, @abdulniyaspm.

While I'd like to approve and accept this change – as much as many others – I believe we can and should wait until Python 2 is eventually discontinued. I think it's fair to all users.

scorphus avatar Jan 06 '19 14:01 scorphus

I'd say it still is and will probably be for some time.

Once Python 2 is officially EOL'ed, we can then release a new version that is still compatible with both 2 and 3 and set it as the last Py2-compatible one. Then, for the next releases, we state that they are Py3-compatible only – although they might still work on Py2.

And I think, moving forward, it will probably be easier implementing new features as we won't need to worry about Py2 anymore.

But, when I think about refactoring code and removing Py2-compatible blocks, I wonder if it's really worth the time and effort of doing so only for the sake of removing. What are the real advantages of that? Yes, a cleaner codebase, fewer test cases, a bit easier to maintain, etc. But is it really that much of difference? Is it really worth the time/effort or should we spend that time with something else?

In reality, we actually don't need to do anything when it comes to Py2 being discontinued. TheFuck will continue to work as Python evolves. It is and will be compatible with Python 3, as opposed to some other apps that aren't – and won't ever be, it seems.

scorphus avatar Jan 16 '20 10:01 scorphus

Python 2 (as well as 3.5) are now EoL.

djh82 avatar Aug 08 '21 20:08 djh82

We've been slow at drafting the last 2.7-compatible release, haven't we? So, next release will be the one.

scorphus avatar Aug 09 '21 09:08 scorphus