Created
January 7, 2019 01:04
-
-
Save Fhernd/c3512a12b6f321cb58279f8943b6cd85 to your computer and use it in GitHub Desktop.
Definición de una clase abstracta en Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABCMeta, abstractmethod | |
class IStream(metaclass=ABCMeta): | |
@abstractmethod | |
def leer(self, bytes_maximos=-1): | |
pass | |
@abstractmethod | |
def escribir(self, datos): | |
pass | |
class SocketStream(IStream): | |
def leer(self, bytes_maximos=-1): | |
# Operaciones de lectura | |
pass | |
def escribir(self, datos): | |
# Operaciones de escritura | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment