Este es un ejemplo de Programación Orientado a Objetos usando la Herencia simple de Clase en Python 3.5.x.
Para crear objetos desde la clase Persona, entonces ejecute el siguiente comando:
python clases.py persona
""" El fuertemente tipado significa que el tipo de valor no | |
cambia repentinamente. Una cadena que contiene solo dígitos | |
no se convierte mágicamente en un número. Cada cambio de tipo | |
requiere una conversión explícita. | |
>>> valor1 = 2 | |
>>> valor2 = "5" | |
>>> total = valor1 + valor2 | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> |
# -*- coding: utf8 -*- | |
""" El fuertemente tipado significa que el tipo de valor no | |
cambia repentinamente. Una cadena que contiene solo dígitos | |
no se convierte mágicamente en un número. Cada cambio de tipo | |
requiere una conversión explícita. | |
>>> valor1 = 2 | |
>>> valor2 = "5" | |
>>> total = valor1 + valor2 |
""" El tipado dinámico significa que los objetos en tiempo de | |
ejecución (valores) tienen un tipo, a diferencia del tipado | |
estático donde las variables tienen un tipo. | |
>>> variable = 11 | |
>>> print ((variable), type(variable)) | |
<class 'int'> | |
>>> variable = "activo" | |
>>> print ((variable), type(variable)) | |
<class 'str'> |
# -*- coding: utf8 -*- | |
""" El tipado dinámico significa que los objetos en tiempo de | |
ejecución (valores) tienen un tipo, a diferencia del tipado | |
estático donde las variables tienen un tipo. | |
>>> variable = 11 | |
>>> print variable, type(variable) | |
11 <type 'int'> | |
>>> variable = "activo" |
# -*- coding: utf8 -*- | |
class Persona(object): | |
""" Clase que representa una persona. """ | |
def __init__(self, cedula, nombre, apellido, sexo): | |
""" Constructor de clase Persona """ | |
self.cedula = cedula | |
self.nombre = nombre | |
self.apellido = apellido |
mkdir -p $HOME/.buildout/{downloads,eggs,extends,zope} && echo $HOME $HOME $HOME $HOME | awk '{ printf( "[buildout]\neggs-directory = %s/.buildout/eggs\ndownload-cache = %s/.buildout/downloads\nextends-cache = %s/.buildout/extends\nzope-directory = %s/.buildout/zope\nabi-tag-eggs = true\n", $1, $2, $3, $4 ) }' >> ~/.buildout/default.cfg |
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
– The Git website
Choose one of the following options.
# -*- coding: utf-8 -*- | |
from zope.component.hooks import getSite | |
import logging | |
log = logging.getLogger(__name__) | |
def unregister_broken_persistent_components(context): | |
portal = getSite() | |
sm = portal.getSiteManager() |
TIP: When there is Internet latency and requires installing python packages by a requeriments file of pip but the installation failed, then you can prevent PIP from re-downloading previously downloaded packages, running this command:
mkdir -p ~/.cache/pip && mkdir ~/.pip && printf '[global]\ndownload_cache = ~/.cache/pip\n' >> ~/.pip/pip.conf