Skip to content

Instantly share code, notes, and snippets.

@macagua
Last active September 27, 2018 02:48
Show Gist options
  • Save macagua/bf96adbe4c129aee16e7cc0c3e58cc48 to your computer and use it in GitHub Desktop.
Save macagua/bf96adbe4c129aee16e7cc0c3e58cc48 to your computer and use it in GitHub Desktop.
Uso tipado dinámico en Python 2.7.x
# -*- 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"
>>> print (variable), type(variable)
activo <type 'str'>
"""
variable = 11 # "variable" guarda un valor entero
print variable, type(variable)
variable = "activo" # "variable" guarda un valor cadena
print (variable), type(variable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment