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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title>AdminLTE 2 | Dashboard</title> | |
| <!-- Tell the browser to be responsive to screen width --> | |
| <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> | |
| <!-- Bootstrap 3.3.7 --> | |
| <link rel="stylesheet" href="https://adminlte.io/themes/AdminLTE/bower_components/bootstrap/dist/css/bootstrap.min.css"> |
| """ 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() |