Python Aumenta Cinco Veces la Productividad
Click here to load reader
-
Upload
francisco-palm -
Category
Technology
-
view
857 -
download
4
description
Transcript of Python Aumenta Cinco Veces la Productividad
![Page 1: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/1.jpg)
Python aumenta 5-10 veces la productividad
¿es cierto?
Francisco PalmULA/Cenditel
![Page 2: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/2.jpg)
Motivación Aunque es algo que tan sólo se
puede asegurar en la experiencia propia...
Por lo general después de programar en varios lenguajes...
Es necesario argumentar Es necesario mostrar
![Page 3: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/3.jpg)
¿en comparación a? A los lenguajes compilados y de
tipos fijos como Java, C, C++ y VB, que la mayoría de los programadores siguen utilizando. Aunque puede ser más productivo
que otros lenguajes dinámicos
![Page 4: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/4.jpg)
Menos código No hay que declarar las variables
x,y,z = 2,'hola',pow
Cada variable adquiere el tipo del valor asignado
print z
<built-in function pow>
![Page 5: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/5.jpg)
Menos código No sólo medido en número de
líneas, no hacen falta “{“, “}” o “begin” “end”, o perolitos como “$” o “#” en los identificadores.
for i in range(5):
if i == 3:
print "i es 3"
![Page 6: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/6.jpg)
Interactivo de fábrica Al ser interpretado puede ser
utilizado en modo interactivo. Sirve como calculadora, shell o
ambiente de pruebas.
$python
$ipython
![Page 7: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/7.jpg)
Todo es un objeto En python no hay primitivas, todo
son objetos.
>>> "hola".upper()
'HOLA'
>>> int(1).__add__(1)
2
![Page 8: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/8.jpg)
Estructuras dinámicas Se cuenta con listas y diccionarios
de fabrica, son dinámicos, manejan cualquier tipo de datos:
l = [3,'cuatro',5j,[0x6a,0x6b]] d = {“fpalm”:
[“impulsivo”,”distraido”, “extravagante”]}
![Page 9: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/9.jpg)
Listas y comprensivas Forma compacta de hacer
programación funcional como si nada.
>>> li = ['tel','cite','cnti','a']
>>> [i for i in li if 'te' in i]
['tel', 'cite']
![Page 10: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/10.jpg)
Viene con pilas incluídas
La librería de python es extensa y no coarta las decisiones del programador.
import smtplib
server = smtplib.SMTP('localhost')
server.sendmail('x@z','y@z','hola')
server.quit()
![Page 11: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/11.jpg)
Autodocumentado El código puede ser su propio
manual de referencia.>>> def tome_pim(x):
... """ y haga pum! """
... return "pum(%s)" % x
>>> tome_pim.__doc__
' y haga pum! '
![Page 12: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/12.jpg)
Introspectivo Los objetos pueden verse a sí
mismos, y sacar lo mejor de ellos!.
[(met,met.__doc__) for met in dir(math) if not(callable(getattr(math,met)))]
![Page 13: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/13.jpg)
Captura de Errores Todos los errores se capturan
como excepciones, ¡y te dicen donde está el error!
![Page 14: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/14.jpg)
Captura de ErroresTraceback (most recent call last):
File "simredes.py", line 229, in <module>
lee_nom_arch()
File "simredes.py", line 90, in lee_nom_arch
a_entrada = open(nombre_e,'r')
IOError: [Errno 2] No such file or directory: '.DEF'
![Page 15: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/15.jpg)
Depurar es un placer Todo lo que ha querido hacer con
su depurador y no lo han dejado hacer...
import pydb
...
pydb.set_trace()
![Page 16: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/16.jpg)
Habla web El desarrollo web es ágil porque el
propio Python provee todo el stack.
import BaseHTTPServer
httpd = BaseHTTPServer.HTTPServer(('',8000), BaseHTTPServer.BaseHTTPRequestHandler)
httpd.serve_forever()
![Page 17: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/17.jpg)
web2py Demo!
![Page 18: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/18.jpg)
Sage Demo!
![Page 19: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/19.jpg)
Crunchy Demo!
![Page 20: Python Aumenta Cinco Veces la Productividad](https://reader038.fdocument.pub/reader038/viewer/2022100506/555e28e6d8b42a6a4c8b508e/html5/thumbnails/20.jpg)
Conclusiones La respuesta final no está en el
código sino en la ideas que han guiado el diseño del lenguaje.
Python no será sino una promesa hasta que comiences a utilizarlo.
Los límites deben estar en el desarrollador no en la herramienta.