On Thu, Jan 22, 2015 at 7:10 PM, Mario Figueiredo <mar...@gmail.com> wrote: > Possibly one common use case will be Unions. And that factory syntax is > really awful and long when you look at a function definition with as > little as 3 arguments. The one below has only 2 arguments. > > def handle_employees(emp: Union[Employee, Sequence[Employee]], raise: > Union[float, Sequence[float]]) -> Union[Employee, Sequence[Employee], > None]:
Hold on a moment, how often do you really do this kind of thing with "might be one of them or a sequence"? Do you really have a function that could take an Employee and a float, or a sequence of Employees and a single float, or a single Employee and a sequence of floats, or a sequence of both? Or do you, much more likely, actually have two separate functions: def handle_employee(emp: Employee, raise: float) -> Optional[Employee]: def handle_employees(emp: Sequence[Employee], raise: Sequence[float]) -> List[Employee]: The union in the return value seems particularly unlikely... and unhelpful. ChrisA -- https://mail.python.org/mailman/listinfo/python-list