Por que você deveria aprender python?

Preview:

Citation preview

por que você deveria aprender python?

@felipevolponegithub.com/felipevolpone

história

quem usa

referências

onde é usadocomunidade

características

por que aprender uma nova linguagem?

o que vai rolar

por que aprender uma nova linguagem?

uma linguagem não resolve todos os problemas

novo modo de pensar !

paradigmas diferentes !

novas características !

linguagens possuem maneiras diferentes de resolver os mesmos problemas !

diferentes ferramentas !

nova comunidade

Programas se tornaram complexos e grandes demais para caber na mente humana. […], a ciência da computação pode ensinar como disciplinar seus trabalhos para que 500 programadores medianos, consigam juntos, produzir um software segundos suas necessidades.

conservativo

Simply Scheme: Introducing Computer Science

Programas se tornaram grandes e complexos demais para caber na mente humana. […], a ciência da computação pode ensinar como expandir a mente dos desenvolvedores para que os programas caibam. Ensinando como pensar em um vocabulário maior, mais poderoso e mais flexível.

radical

escolha PYTHON

história

Guido van Rossum@gvanrossum

baseada em ABCcomeçou em 1989

características

expressivadinâmica

orie

ntad

a a

obje

tos

fácil

legível

simples é melhor que complexo

expansível

produtividade

em evoluçãobonito é melhor que feio

$ python >>> import this !The Zen of Python, by Tim Peters !Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Unless explicitly silenced. There should be one-- and preferably only one --obvious way to do it. Now is better than never.

vs

x = 10 w = x + y Traceback: w = x + y NameError: name 'y' is not defined

numero = 27 nome = 'python' resultado = nome + numero Traceback: resultado = nome + numero TypeError: cannot concatenate ‘str' and ‘int' objects

public class HelloWorld { !

public static void main(String[] args) { System.out.println("Hello, World"); } }

print 'Hello, World'

for(int i = 1; i < 10; i++) { System.out.println(i); }

for i in range(1,10): print i !

!

def somar(a=0, b=1): return a+b !

somar() # 1 somar(a=5, b=3) # 8 !

class Colaborador { private String nome; private int salario = 1000; private String cargo = “"; public Employee(String nomeColaborador) { this(nomeColaborador, 1000); } ! public Employee(String nomeColaborador, int salario) { this(nomeColaborador, salario, "dev"); } ! public Employee(String nomeColaborador, int salario, String cargo) { this.nome = nomeColaborador; this.salario = salario; this.cargo = cargo; } }

class Colaborador(): ! def __init__(self, nomeColaborador, salarioColaborador =1000, cargoColaborador ="dev"): ! self.__nome = nomeColaborador self.__salario = salarioColaborador self.__cargo = cargoColaborador

objetos everywhere

!

def dobrar(numero): return numero*2 !

def funcao_invocadora(funcao, valor): return funcao(valor) !

funcao_invocadora(dobrar, 2) # 4 !

!

def somar(a=0, b=1): return a+b !

print dir(somar) ['__call__', ‘__class__’, '__defaults__', '__delattr__', '__dict__', '__doc__', '__format__', '__get__', '__getattribute__', '__globals__', '__hash__', '__init__', '__module__', '__name__', '__new__', '__repr__', '__setattr__', '__sizeof__', ‘__str__', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', ‘func_name'] !

somar.func_name # “somar" !

somar.func_defaults # (0, 1)

CPython (padrão)

!

PyPy (jit)

!

IronPython (.net)

!

Jython (jvm)

como pode ser usado?

web

desktop

redes

sysadmin

computaçãográfica

com

puta

ção

cie

ntífi

ca

web crawling

machine learning

big data

como onde pode ser usado?

linux windows

unix

mac

androidraspberry

Python without an operating system http://lwn.net/Articles/641244/

iOS

quem usa

lugar no langpop.com lugar no tiobe.com

popularidade

6º 8º

brasil.gov.br

FBI

CIA civilization IV

yah

oo m

aps

yahoodisney

blender 3D

NASAIBM

https://wiki.python.org/moin/OrganizationsUsingPython

como começar?

linux/mac$ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. !>>>

https://www.python.org/downloads/windows/windows

bottle

django

flask

torn

ado

webapp

web

2pycherrypy

pyramid

web.py

frameworks web

plone

turbogears

from bottle import route, run !

@route('/hello') def hello(): return "Hello World!" !

run(host='localhost', port=8080, debug=True)

https://docs.python.org/2/tutorial/

https://developers.google.com/edu/python/https://cloud.google.com/appengine/docs/python/gettingstartedpython27/introduction

http://www.dextraining.com.br/

comunidade

eventos

RuPy pythonbrasil[11]

devcamp

https://groups.google.com/forum/#!forum/python-brasilgrupo python brasil

https://mail.python.org/mailman/listinfolistas de email do python

referências

Fluent Python, Luciano Ramalho

http://importpython.com/books/

Python in a Nutshell, Alex Martelli

@felipevolpone