ppizarror / pygame-menu

A menu for pygame. Simple, and easy to use
https://pygame-menu.readthedocs.io/
Other
555 stars 141 forks source link

Function `is_callable` does not accept callable objects #394

Closed vnmabus closed 2 years ago

vnmabus commented 2 years ago

Describe the bug The is_callable function is supposed to check that an object is callable, for example to add it as a button action. There are two problems with it:

  1. There is already a builtin to do this: callable.
  2. The is_callable function is more restrictive than callable: it only allows functions, methods and partial objects. It does not allow objects with a __call__ method, for no particular reason.

I think that unless there is a powerful reason not to, the is_callable function should be replaced by the callable builtin.

ppizarror commented 2 years ago

Hi, that method was inherited from previous versions to support python 2. Feel free to create a new pull request with such feature