I have this question, a simple code for example
#Clase de Herencias "
# "
from colorama import *
class vehiculos():
def __init__(self, marca, modelo):
self.marca = marca
self.modelo = modelo
self.enmarcha = False
self.acelera = False
self.frena = False
def arrancar(self):
self.enmarcha = True
def acelerar(self):
self.acelera = True
def frenar(self):
self.frena = True
def estado (self):
print ('Marca: ', self.marca, '\nModelo: ', self.modelo,'\nEn Marcha: ', self.enmarcha, '\nAcelera: ', self.acelera, '\nFrena: ', self.frena)
class Moto(vehiculos):
hcaballito= ''
def caballito(self):
self.hcaballito ='Haciendo caballito!'
def estado(self):
print ('Marca: ', self.marca, '\nModelo: ', self.modelo,'\nEn Marcha: ', self.enmarcha, '\nAcelera: ', self.acelera, '\nFrena: ', self.frena, '\nEstado del caballito:', self.hcaballito )
#Creando una instancia en esta clase
motor_1 = Moto('BMW', 'SP1')
motor_1.caballito()
motor_1.caballito()
the code works good! but the editor don't highlight the methods when I call them outside of the class definition.
Editors like Sublime Text do highlight the method name
Extension Material Theme Kit can help you. Turn to extension marketplace, search and install it, you will observe the result that the function is hightlighted: