@@ -407,24 +407,63 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
407407
408408 Return ``True `` if the object is a bound method written in Python.
409409
410+ .. note ::
410411
411- .. function :: ispackage(object)
412+ For example, given this class::
412413
413- Return ``True `` if the object is a :term: `package `.
414+ >>> class Greeter:
415+ ... def say_hello(self):
416+ ... print('hello!')
414417
415- .. versionadded :: 3.14
418+ A bound method (also known as an *instance method *) is created when
419+ accessing ``say_hello `` (a :term: `function ` defined in the
420+ ``Greeter `` namespace) through an instance of the ``Greeter `` class::
421+
422+ >>> instance = Greeter()
423+
424+ >>> instance.say_hello
425+ <bound method Greeter.say_hello of <__main__.Greeter object ...>>
426+ >>> ismethod(instance.say_hello)
427+ True
428+ >>> isfunction(instance.say_hello)
429+ False
430+
431+ Accessing ``say_hello `` through the ``Greeter `` class will return the
432+ function itself. For this function, :func: `ismethod ` will return
433+ ``False ``, but :func: `isfunction ` will return ``True ``::
434+
435+ >>> Greeter.say_hello
436+ <function Greeter.say_hello at 0x7f7503854a90>
437+ >>> ismethod(Greeter.say_hello)
438+ False
439+ >>> isfunction(Greeter.say_hello)
440+ True
441+
442+ See :ref: `typesmethods ` for details.
416443
417444
418445.. function :: isfunction(object)
419446
420447 Return ``True `` if the object is a Python function, which includes functions
421448 created by a :term: `lambda ` expression.
422449
450+ See the note for :func: `~inspect.ismethod ` for an example.
451+
452+
453+ .. function :: ispackage(object)
454+
455+ Return ``True `` if the object is a :term: `package `.
456+
457+ .. versionadded :: 3.14
458+
423459
424460.. function :: isgeneratorfunction(object)
425461
426462 Return ``True `` if the object is a Python generator function.
427463
464+ It also returns ``True `` for bound methods created from Python generator functions
465+ (see :ref: `typesmethods ` for more information).
466+
428467 .. versionchanged :: 3.8
429468 Functions wrapped in :func: `functools.partial ` now return ``True `` if the
430469 wrapped function is a Python generator function.
0 commit comments