GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Possible small mistake in the documentation of importlib.util.LazyLoader.factory · Issue #101390 · python/cpython

Possible small mistake in the documentation of importlib.util.LazyLoader.factory #101390

New issue
Copy link
New issue
Copy link
Closed
Closed
Possible small mistake in the documentation of importlib.util.LazyLoader.factory#101390
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-importlib

Description

@busywhitespace
busywhitespace
opened on Jan 28, 2023
Issue body actions

The documentation of LoazyLoader.factory in the module importlib.util says:

classmethod factory(loader)

A static method which returns a callable that creates a lazy loader. This is meant to be used in situations where the loader is passed by class instead of by instance.

The problem is that there is a mixing of words classmethod and static method. And the documentation defines the static method as ... Static method objects are created by the built-in staticmethod() constructor.

The source code for the method is:

@classmethod
def factory(cls, loader):
    """Construct a callable which returns the eager loader made lazy."""
    cls.__check_eager_loader(loader)
    return lambda *args, **kwargs: cls(loader(*args, **kwargs))

So, in my opition, "a static method" in the documentation should be corrected to "a class method".

I've created the PR in case the issue is right.

Linked PRs

  • gh-101390: Fix docs for imporlib.util.LazyLoader.factory to properly call it a class method #101391
  • [3.11] gh-101390: Fix docs for imporlib.util.LazyLoader.factory to properly call it a class method (GH-101391) #101813
  • [3.10] gh-101390: Fix docs for imporlib.util.LazyLoader.factory to properly call it a class method (GH-101391) #101814

Activity

  1. busywhitespace
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Jan 28, 2023
  2. AlexWaygood
    added
    topic-importlib
    on Jan 28, 2023
  3. brettcannon commented on Feb 10, 2023

    @brettcannon
    brettcannon
    on Feb 10, 2023
    Member
    More actions

    The specific code lines in question:

    cpython/Lib/importlib/util.py

    Lines 170 to 171 in 61f2be0

    @classmethod
    def factory(cls, loader):

    So @busywhitespace is correct that the docs are wrong about calling it a static method.

  4. brettcannon
    added a commit that references this issue on Feb 10, 2023

    gh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to properl…

    17143e2
  5. miss-islington
    added 2 commits that reference this issue on Feb 10, 2023

    pythongh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to p…

    3974c6b

    pythongh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to p…

    cea61cc
  6. brettcannon
    added 2 commits that reference this issue on Feb 11, 2023

    [3.11] gh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to …

    91fb7c3

    [3.10] gh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to …

    6c0e3dc
  7. carljm
    added a commit that references this issue on Feb 13, 2023

    Merge branch 'main' into inlinecomp2

    ae0bd02
  8. hauntsaninja commented on Feb 25, 2023

    @hauntsaninja
    hauntsaninja
    on Feb 25, 2023
    Contributor
    More actions

    Thanks, looks like this was fixed

  9. hauntsaninja
    closed this as completedon Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-importlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.