Python e 10 motivos por que devo conhece-la ?

Preview:

DESCRIPTION

Apresentação realizada no dia 18 de maio de 2013 no I Startup Developer Day em Recife/PE.

Citation preview

Apresentando Python e 10 motivos pelo qual devo conhece-lo ?!

Marcel Caraciolo@marcelcaracioloDeveloper, Cientist, contributor to the Crab recsys project,works with Python for 6 years, interested at mobile,education, machine learning and dataaaaa!Recife, Brazil - http://aimotion.blogspot.com

Google em 1998

Disclaimer

Começando pelo básico...

Começando pelo básico...

Começando pelo básico...

print “Hello World”

Mas o que seria Python ?

Linguagem de Programação interpretada

Fácil de aprender e e altamente produtiva

Multi-Paradigma: Implementa OO, Funcional e Procedural

Multi-plataforma, Open-source e Divertido!

Mas o que seria Python ?

lista = [‘laranja’, ‘banana’, ‘uva’]lista.sort()

for item in lista: print item.capitalize()

Quem usa o

Sim, então é tudo bom assim é ?

http://en.wikipedia.org/wiki/Expressive_power

LinguagemExpressiva?

O que issosignifica

na prática?

Linguagem COBOL

Java

Python

Java

Python tem sido uma parte importante do Google desdeo início, e continua sendo à medida que o sistema crescee evolui... estamos procurando mais pessoas com habilidade nesta linguagem.

Peter Norvig, Google, Inc.

lis.py: interpretador Lisp (Scheme) em

113 linhas de Python,por Peter Norvig

>>> from lis import repl>>> repl()lis.py> (* 7 3)21lis.py> (define resposta (* 6 7))lis.py> resposta42lis.py> (define ! (lambda (n) (if (= n 0) 1 (* n (! (- n 1))))))lis.py> (! 4)24lis.py> (! 5)120lis.py> (! 197)100078405584080821221303894971344736599047761241456431563720437191558734323562679929991407036696693556694737848195477238497746661367777918006944650646265409257583733981874437495228286501182991424477395086576066353467353335798727837835328694280439305522603073118823862831864630209655642361092292378406702568679608855350476800000000000000000000000000000000000000000000000lis.py> !<function <lambda> at 0x1004cbd70>lis.py>

lis.py

Exemplo: relógio gráfico

import Tkinterfrom time import strftime

relogio = Tkinter.Label()

relogio.pack()relogio['font'] = 'Helvetica 120 bold'relogio['text'] = strftime('%H:%M:%S')

def tictac(): agora = strftime('%H:%M:%S') if agora != relogio['text']: relogio['text'] = agora relogio.after(100, tictac)

tictac()relogio.mainloop()

Exemplo: cliente Twitterimport sysimport urllibimport json

if len(sys.argv) == 2: busca = sys.argv[1]else: print 'Informe o texto da busca: {0} "texto"'.format(__file__) sys.exit(1)

url = 'http://search.twitter.com/search.json?q='+buscaresposta = urllib.urlopen(url).read()documento = json.loads(resposta)resultados = documento['results']for resultado in resultados: print u'{from_user}: {text}\n'.format(**resultado)print '{0} resuldados exibidos'.format(len(resultados))

Como colaborar em Python

Sim, então é tudo bom assim é ?

1. Python ainda é lento

Sim, então é tudo bom assim é ?

JIT Compiler em Python

YouTube

Globo.com

Mozilla Firefox Add-Ons

Dropbox

Google App Engine

The Foundry, NUKE

Industrial Light & Magic

Autodesk Maya

Civilization IV

FBI e CIA

brasil.gov.br

brasil.gov.br

Câmara dos Deputados

Integrações com outras linguagens

Python e C/C++static PyObject *my_callback = NULL;

static PyObject *my_set_callback(PyObject *dummy, PyObject *args){ PyObject *result = NULL; PyObject *temp;

if (PyArg_ParseTuple(args, "O:set_callback", &temp)) { if (!PyCallable_Check(temp)) { PyErr_SetString(PyExc_TypeError, "parameter must be callable"); return NULL; } Py_XINCREF(temp); /* Add a reference to new callback */ Py_XDECREF(my_callback); /* Dispose of previous callback */ my_callback = temp; /* Remember new callback */ /* Boilerplate to return "None" */ Py_INCREF(Py_None); result = Py_None; } return result;}

Você pode extender Python ou usá-lo em

códigos C/C++

http://docs.python.org/extending/extending.html

Python e .Net

import syssys.path.append(r’C:\Python25\Lib’)import clrclr.AddReference(“System.Windows.Forms”)from System.Windows.Forms import Application,Formclass Hello World(Form): def __init__(self): self.Text = ʻHello Worldʼ self.Name = ʻHello Worldʼ

form = HelloWorld(Form)Application.Run(Form

http://ironpython.net/

Python e muito mais!

http://claymore.engineer.gvsu.edu/~steriana/Python/pymat.html

PyMat - Matlab

http://rpy.sourceforge.net/

http://code.google.com/p/pyswip/

http://appscript.sourceforge.net/

Tem alguém para pedirsocorro.

Pycon US PythonBrasilPUG-PE

24 hrs ao seu dispor!

http://br.groups.yahoo.com/group/python-brasil/

PUG - PE

Grupo de usuários de Python de Pernambuco (@pugpe)

http://groups.google.com/group/pug-pe?hl=pt-BR

Tem alguém para pedirsocorro.

http://pythonpeople.znc.com.br/

http://pycursos.com

Assistentes direto do seu Talk

Conheça o cãocurseiro (@caocurseiro)

Mascote do Atepassar que fala, dorme, menciona, segue e até RT.

Atepassar Março 2013

Rápida História

Fundada há 3 anos atrás

3 funcionários, apenas 1 não-era-de-computacao

Trafégo de 1milhão de visitas/mês

250 mil usuários cadastrados, 30k ativos

We  s%ll  rent  hardware,    cheaper  to  upgrade.

EC2  -­‐    8  instances  from  Micro  to  Large   (Atepassar  Store,  Atepassar  Network,  RecSys,    Q&A,  Load  Balancing)

SES  –  Quota  of    575.000  e-­‐mails  per  day  sent    at  90/s

RDS  –  MySQL  –    over  54  million  I/O  requests  -­‐    40  GB  stored.   (  For  storage)

S3  -­‐      Over  10.0  GB  and  15  million  requests   (  For  staKc  files  )

We  use  Amazon  third-­‐party  services  such  as  MongoMachine/MongoHQ  NoSQL  Storage

Infrastructure

Powered  By  Python  –  Django.

We  are  studying  EMR  MapReduce  to  power  our  recommender  system.           Over    100.000  recommendable  items  to  suggest  to  our  users.

Easy  to  deploy  our  apps  and  install  our  libraries              Easy  to  upgrade  our  infra-­‐structure.   Security  and  tolerance-­‐fault.   Mix  of  services  available  for  any  big  data  startup  around  the  world.  

Technology

e aí preparado ?

Você pode escolherficar no vermelho...

Você pode escolherficar no vermelho...

Ou ser “Livre”

Marcel Caraciolo

@marcelcaraciolo

marcel@atepassar.com ou marcel@caraciolo.com.br

contato

Marcel Caraciolo

@marcelcaraciolo

marcel@atepassar.com ou marcel@caraciolo.com.br

contato

Apresentando Python e 10 motivos pelo qual devo conhece-lo ?!

Marcel Caraciolo@marcelcaracioloDeveloper, Cientist, contributor to the Crab recsys project,works with Python for 6 years, interested at mobile,education, machine learning and dataaaaa!Recife, Brazil - http://aimotion.blogspot.com