I'm pretty sure this has to be dead code

Review Request #1960 - Created March 20, 2015 and submitted

Peter Seibel
benjyw, ity, stuhood

Note first, in passing, that isinstance(type(action), type) is a tautology. But, that aside, what this code seems to be trying to do is check whether the action is either a class representing a subclass of Task or a function of either zero or one arguments. In the latter case it wants to make a new subclass of Task that invokes the function when executed. However, the function wrapping code can't possibly work unless I'm deeply missing something: In the __init__ method of FuncTask the args parameter containing the positional arguments to __init__ has to be either empty or contain one argument. However TaskBase in task.py defines an __init__ that takes two positional arguments.

So any attempt to construct an instance of FuncTask would fail: if passed zero or one arguments, the call to super(FuncTask, self).__init__(...) will fail because the super constructer needs two positional arguments and if called with more than one arguments it will raise an AssertionError itself.

It's possible that the code was meant to refer to the args in the enclosing scope but, unless I'm very confused about Python, it does not so this code must never be used so might as well be deleted.



  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Benjy Weinberger
Mateo Rodriguez
Peter Seibel
Peter Seibel
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted @ 1ccd3ee3b3784fbb0d64574bd9cc21e1d7de1d86