Skip to content

ABC documentation needs more details on usage #132

Description

@cdorsman

I am trying to use Abstract Base Classes. But I find the documentation lacking on several points that makes the matter too 'abstract'.

For example. There is no explanation on making abstract objects mandatory by using exceptions

Or how to implement Iterable abstract bsse class that can be inherited from and still be usable.

Can someone shed more light onto this so that the documentation is more accessible?

Activity

  1. willingc commented on Sep 13, 2024

    @willingc
    Collaborator

    Could you provide a bit more detail on what areas of the docs you are looking at?

    For example. There is no explanation on making abstract objects mandatory by using exceptions

    I'm sorry but I'm not clear on what you are asking here.

    Or how to implement Iterable abstract bsse class that can be inherited from and still be usable.

    I'm sorry but I'm not clear on what you are asking here.

  2. cdorsman commented on Sep 16, 2024

    @cdorsman
    Author

    Could you provide a bit more detail on what areas of the docs you are looking at?

    I am looking at the module: https://docs.python.org/3/library/abc.html#module-abc

    For example. There is no explanation on making abstract objects mandatory by using exceptions

    I'm sorry but I'm not clear on what you are asking here.

    It is apparently possible to make methods and attributes mandatory by using the NotInplemented exception, but there are no examples. The user has to be aware of this possibility.

    Or how to implement Iterable abstract bsse class that can be inherited from and still be usable.

    I'm sorry but I'm not clear on what you are asking here.

    If a Iterator is being used in an Abstract Base Class, the Iterator is not passed down to the child class. What should the user do to make the Iterator work?

    These are just random two examples. But what I am generally asking if someone can look at the documentation and write more practical examples/instructions so that it makes more sense on the why and how to use the module for the more "advanced" usage, because the source code itself is not giving any information what is and isn't possible.

  3. Mariatta commented on Sep 16, 2024

    @Mariatta
    Member

    It is apparently possible to make methods and attributes mandatory by using the NotInplemented exception, but there are no examples

    Hmm you should use decorate the function with @abstractmethod which will raise exception if the child class doesn't implement it.

    However I agree that we need to provide clearer explanation and instructions overall.

    If a Iterator is being used in an Abstract Base Class, the Iterator is not passed down to the child class. What should the user do to make the Iterator work?

    Sorry I still don't fully understand this. Do you perhaps have code snippet of how you defined the iterator on your ABC and the child class?

  4. cdorsman commented on Sep 17, 2024

    @cdorsman
    Author
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

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions