Closed xiangninglyu closed 1 month ago
Hey @xiangninglyu, you're right that the parameter name does not indicate that it accepts a callable. But because one can use keyword arguments in Python, this would technically be a breaking change and need a major release of TinyDB. I agree that the name is not ideal, but having to publish a major release for a small change like this would feel like overkill to me.
suggest migrate to
def update( self, fields_or_callable: Union[Mapping, Callable[[Mapping], None]], cond: Optional[QueryLike] = None, doc_ids: Optional[Iterable[int]] = None, ) -> List[int]:
fields => fields_or_callable to aid users search in the codebase and locate the update method. By a first glimpse, fields definitely is not a callable and thus causes confusion.