Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABC documentation needs more details on usage #132

Open
cdorsman opened this issue Sep 13, 2024 · 4 comments
Open

ABC documentation needs more details on usage #132

cdorsman opened this issue Sep 13, 2024 · 4 comments
Labels
question Further information is requested

Comments

@cdorsman
Copy link

cdorsman commented Sep 13, 2024

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?

@willingc
Copy link
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.

@willingc willingc added the question Further information is requested label Sep 13, 2024
@cdorsman
Copy link
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.

@Mariatta
Copy link
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?

@cdorsman
Copy link
Author

cdorsman commented Sep 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants