0

I saw something like:

def _count() -> int: ...

and


class LockType:
    def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
    def release(self) -> None: ...
    def locked(self) -> bool: ...
    def __enter__(self) -> bool: ...
    def __exit__(
        self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
    ) -> None: ...

I wonder what does the ... after def of function do? When should I use this? (this might be a stupid question. I am new to programming. I tried lookup on google but it just gave me a bunch of how to define a function tutoring pages)

DAF201
  • 11
  • 2
  • 1
    It does literally nothing. It's generally used to mean either (1) the programmer hasn't finished writing the code for that method yet, or (2) it's an abstract method and subclasses are expected to fill in the missing body. As far as Python is concerned, it's basically equivalent to `pass` in your examples. – Silvio Mayolo Nov 13 '21 at 02:52
  • 1
    @SilvioMayolo or is a stub file – eyllanesc Nov 13 '21 at 02:58

0 Answers0