msiemens / tinydb

TinyDB is a lightweight document oriented database optimized for your happiness :)
https://tinydb.readthedocs.org
MIT License
6.84k stars 550 forks source link

suggest renaming param for table.update() #564

Closed xiangninglyu closed 1 month ago

xiangninglyu commented 5 months ago

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.

msiemens commented 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.