Should I use doctstrings for abstract classes or methods /u/dZArach Python Education

Hi everyone,

I am wondering whether I have should docstrings for my abstract classes and methods, explaining what the method is and explain what it should do in the concrete implementation. This is a generic, simple example:

from abc import ABC, abstractmethod class FileHandler(ABC): @abstractmethod def file_extension(self): ... """Returns the file extension""" @abstractmethod def read(self, filepath): """ Read the file """ pass 

Also, would the ellipses be preferred over pass?

Thanks in advance!

submitted by /u/dZArach
[link] [comments]

​r/learnpython Hi everyone, I am wondering whether I have should docstrings for my abstract classes and methods, explaining what the method is and explain what it should do in the concrete implementation. This is a generic, simple example: from abc import ABC, abstractmethod class FileHandler(ABC): @abstractmethod def file_extension(self): … “””Returns the file extension””” @abstractmethod def read(self, filepath): “”” Read the file “”” pass Also, would the ellipses be preferred over pass? Thanks in advance! submitted by /u/dZArach [link] [comments] 

Hi everyone,

I am wondering whether I have should docstrings for my abstract classes and methods, explaining what the method is and explain what it should do in the concrete implementation. This is a generic, simple example:

from abc import ABC, abstractmethod class FileHandler(ABC): @abstractmethod def file_extension(self): ... """Returns the file extension""" @abstractmethod def read(self, filepath): """ Read the file """ pass 

Also, would the ellipses be preferred over pass?

Thanks in advance!

submitted by /u/dZArach
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *