plum icon indicating copy to clipboard operation
plum copied to clipboard

method return value is changed

Open Wouter1 opened this issue 1 year ago • 0 comments

I have this method (minimal just to show the issue)

from typing import List
def f() -> List[int]:
 return (None)

f()==None as expected

Now I wrap it in @dispatch (note you may have to restart python because otherwise you get a warning on overwriting f):

from typing import List
from plum import dispatch
@dispatch
def f() -> List[int]:
  return (None)

and suddenly my function misbehaves

f()==[None]

So it returns a list with 1 element, instead of None. Can this please be fixed?

Wouter1 avatar Oct 17 '24 09:10 Wouter1