SlideShare a Scribd company logo
python3
@andrewsmedina
‣   o que os outros pensam...




globo
 .com
‣   o que eu penso...




globo
 .com
‣   o que minha mãe pensa...




globo
 .com
‣   como realmente é!




globo
 .com
python 2
‣   pep8              ‣   generators
        ‣   zen of python     ‣   iterators
        ‣   decorators        ‣   comprehension
        ‣   descriptors       ‣   abstract
        ‣   metaclass         ‣   magic methods
        ‣   context manager
        ‣   subproccess
        ‣   multiproccess

globo
 .com
mas...
‣   unicode
        ‣   classes new x old style
        ‣   // vs /
        ‣   print vs print()
        ‣   int vs long
        ‣   urllib, urllib2, urlparse
        ‣   xmlrpclib, DocXMLRPCServer, SimpleXMLRPCServer



globo
 .com
:(
python3
        ‣   pep8
        ‣   zen of python
        ‣   generators
        ‣   iterators
        ‣   objetos




globo
 .com
python3.0
           2008..




globo
 .com
python3.0
        ‣   pip, distribute não funcionava no python3
        ‣   2to3 não foi suficiente




globo
 .com
python3.3
        ‣   pip, distribute
        ‣   venv nativo
        ‣   2to3, 3to2, six
        ‣   várias features já funcionam no python2.7




globo
 .com
python3 no python2
divisão (python2)
         >>> 4 / 2
         2
         >>> 3 / 2
         1



globo
 .com
divisão (python3)
         >>> 3 / 2
         1.5




globo
 .com
divisão (python2)
         from __future__ import division
         >>> 3 / 2
         1.5




globo
 .com
divisão (python2)
         from __future__ import division
         >>> 3 // 2
         1




globo
 .com
string.format()
        “{0} - {1}”.format(“andrews”, 19)
        “{name} - {idade}”.format(name=”andrews”, idade=19)



globo
 .com
comprehension
        {x for x in [1,2,3,3]}




globo
 .com
comprehension
        {key.upper(): value for key, value in d.items()}




globo
 .com
generators


globo
 .com
classes abstratas


globo
 .com
multiprocessing


globo
 .com
bytes e strings
        bytes para transferência
        string para representação



globo
 .com
bytes e strings
        bytes (python3) == str (python2)
        string (python3 == bytes (python2)



globo
 .com
bytes e strings (python2)
        u"andrews " + b"medina"
        u”andrews medina”



globo
 .com
bytes e strings (python3)
        >>> u"andrews " + b"medina"
        Traceback (most recent call last):
         File "<stdin>", line 1, in <module>
        TypeError: Can't convert 'bytes' object to str implicitly


globo
 .com
strings para bytes
        u"andrews ".encode(“utf-8”) + b"medina"




globo
 .com
bytes para strings
        u"andrews " + b"medina".decode(“utf-8”)




globo
 .com
print
        objeto
        novos parâmetros (sep, end, file, flush)



globo
 .com
print (python2)
        >>> help(print)
         File "<stdin>", line 1
           help(print)
                  ^
        SyntaxError: invalid syntax


globo
 .com
print (python3)
        >>> help(print)



globo
 .com
print (python2)
        >>> from __future__ import print_function
        >>> help(print)


globo
 .com
print (python2)
        >>> print(", ".join(["banana", "batata"]))
        banana, batata


globo
 .com
print (python3)
        >>> alimentos = ["banana", "batata"]
        >>> print(*alimentos, sep=", ")
        banana, batata


globo
 .com
print (python3)
        from StringIO import StringIO
        out = StringIO()
        >>> print("ble", file=out)
        >>> out.getvalue()
        'blen'


globo
 .com
range, zip, map, filter
        retornam iterators




globo
 .com
range, zip, map, filter
        lista = list(range(10))




globo
 .com
range, zip, map, filter
        for item in range(10):
           print item




globo
 .com
expections
        except IOError as e:




globo
 .com
class Class:
        new style por padrão




globo
 .com
int
        int = long




globo
 .com
novidades
annotations
        adiciona meta dados em uma função




globo
 .com
annotations
        def hello(name: str, age: int) -> int:
           print(name, age)




globo
 .com
annotations
        >>> hello.__annotations__
        {'return': <class 'int'>, 'name': <class 'str'>, 'age': <class 'int'>}




globo
 .com
annotations
        >>> hello("ble", "ble")
        ble ble




globo
 .com
io
        io.FileIO
        io.StringIO
        io.BufferIO



globo
 .com
concurrent.future
        paralelismo




globo
 .com
concurrent.future
        interface Executor




globo
 .com
concurrent.future
        from concurrent.futures import ThreadPoolExecutor

        with ThreadPoolExecutor(max_workers=1) as executor:
           future = executor.submit(pow, 323, 1235)
           print(future.result())

globo
 .com
concurrent.future
        from concurrent.futures import ProcessPoolExecutor

        with ProcessPoolExecutor(max_workers=4) as executor:
           future = executor.submit(pow, 323, 1235)
           print(future.result())

globo
 .com
functools.lru_cache
        memoização nativa




globo
 .com
functools.lru_cache
        from functools import lru_cache

        @lru_cache(maxsize=None)
        def fib(n):
           if n < 2:
               return n
           return fib(n-1) + fib(n-2)


globo
 .com
venv (virtualenv)


globo
 .com
unittest(2)


globo
 .com
unittest.mock


globo
 .com
pep 420
        Implicit Namespace Packages




globo
 .com
como portar
apenas python3


globo
 .com
branches diferentes
        manter dois projetos :(




globo
 .com
2to3
        convertor automágico




globo
 .com
2to3
        print “ble” -> print(ble)
        except Exception, e -> except Exception as e




globo
 .com
2to3
        2to3=true #distribute




globo
 .com
3to2


globo
 .com
mesma base de código
        tratamento de excessões




globo
 .com
six
        :)




globo
 .com
leitura
        ‣   http://python3porting.com/
        ‣   http://docs.python.org/3/
        ‣   http://getpython3.com/diveintopython3/




globo
 .com
perguntas?

More Related Content

What's hot

Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
akaptur
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
Mahmoud Samir Fayed
 
An Intro to Python in 30 minutes
An Intro to Python in 30 minutesAn Intro to Python in 30 minutes
An Intro to Python in 30 minutes
Sumit Raj
 
Golang勉強会
Golang勉強会Golang勉強会
Golang勉強会
Shin Sekaryo
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 Autumn
Moriyoshi Koizumi
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
Raveen Perera
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
Ian Ozsvald
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...akaptur
 
OpenGurukul : Language : Python
OpenGurukul : Language : PythonOpenGurukul : Language : Python
OpenGurukul : Language : Python
Open Gurukul
 
Functional Pe(a)rls version 2
Functional Pe(a)rls version 2Functional Pe(a)rls version 2
Functional Pe(a)rls version 2
osfameron
 
C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)
Yuki Tamura
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
Michiel Borkent
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my day
Tor Ivry
 
Full Stack Clojure
Full Stack ClojureFull Stack Clojure
Full Stack Clojure
Michiel Borkent
 
Snakes for Camels
Snakes for CamelsSnakes for Camels
Snakes for Camels
miquelruizm
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Hans Höchtl
 
Dts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinDts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlin
Ahmad Arif Faizin
 
OpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpenGurukul : Language : PHP
OpenGurukul : Language : PHP
Open Gurukul
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
Frank Müller
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
Michiel Borkent
 

What's hot (20)

Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
 
An Intro to Python in 30 minutes
An Intro to Python in 30 minutesAn Intro to Python in 30 minutes
An Intro to Python in 30 minutes
 
Golang勉強会
Golang勉強会Golang勉強会
Golang勉強会
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 Autumn
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 
OpenGurukul : Language : Python
OpenGurukul : Language : PythonOpenGurukul : Language : Python
OpenGurukul : Language : Python
 
Functional Pe(a)rls version 2
Functional Pe(a)rls version 2Functional Pe(a)rls version 2
Functional Pe(a)rls version 2
 
C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my day
 
Full Stack Clojure
Full Stack ClojureFull Stack Clojure
Full Stack Clojure
 
Snakes for Camels
Snakes for CamelsSnakes for Camels
Snakes for Camels
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Dts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinDts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlin
 
OpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpenGurukul : Language : PHP
OpenGurukul : Language : PHP
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
 

Viewers also liked

JSON Schema: Valide e navegue entre suas APIS
JSON Schema: Valide e navegue entre suas APISJSON Schema: Valide e navegue entre suas APIS
JSON Schema: Valide e navegue entre suas APIS
Wilson Júnior
 
Design de código: princípios e práticas para ter um código sustentável
Design de código: princípios e práticas para ter um código sustentávelDesign de código: princípios e práticas para ter um código sustentável
Design de código: princípios e práticas para ter um código sustentável
Andrews Medina
 
CEJS 2016 - Please learn that shit
CEJS 2016 - Please learn that shitCEJS 2016 - Please learn that shit
CEJS 2016 - Please learn that shit
Emerson Macedo
 
Escalando aplicações web
Escalando aplicações webEscalando aplicações web
Escalando aplicações web
Andrews Medina
 
256 Shades of R, G and B
256 Shades of R, G and B256 Shades of R, G and B
256 Shades of R, G and B
Almir Filho
 
React Native na globo.com
React Native na globo.comReact Native na globo.com
React Native na globo.com
Guilherme Heynemann Bruzzi
 

Viewers also liked (6)

JSON Schema: Valide e navegue entre suas APIS
JSON Schema: Valide e navegue entre suas APISJSON Schema: Valide e navegue entre suas APIS
JSON Schema: Valide e navegue entre suas APIS
 
Design de código: princípios e práticas para ter um código sustentável
Design de código: princípios e práticas para ter um código sustentávelDesign de código: princípios e práticas para ter um código sustentável
Design de código: princípios e práticas para ter um código sustentável
 
CEJS 2016 - Please learn that shit
CEJS 2016 - Please learn that shitCEJS 2016 - Please learn that shit
CEJS 2016 - Please learn that shit
 
Escalando aplicações web
Escalando aplicações webEscalando aplicações web
Escalando aplicações web
 
256 Shades of R, G and B
256 Shades of R, G and B256 Shades of R, G and B
256 Shades of R, G and B
 
React Native na globo.com
React Native na globo.comReact Native na globo.com
React Native na globo.com
 

Similar to Python 3

Python 3 - tutorial
Python 3 - tutorialPython 3 - tutorial
Python 3 - tutorial
Andrews Medina
 
Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
Lennart Regebro
 
Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
Lennart Regebro
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
Henry Schreiner
 
Python-GTK
Python-GTKPython-GTK
Python-GTKYuren Ju
 
Python 3000
Python 3000Python 3000
Python 3000
Bob Chao
 
Boost.Python: C++ and Python Integration
Boost.Python: C++ and Python IntegrationBoost.Python: C++ and Python Integration
Boost.Python: C++ and Python Integration
GlobalLogic Ukraine
 
Learn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersLearn Python 3 for absolute beginners
Learn Python 3 for absolute beginners
KingsleyAmankwa
 
Python in 30 minutes!
Python in 30 minutes!Python in 30 minutes!
Python in 30 minutes!
Fariz Darari
 
Class 1: Welcome to programming
Class 1: Welcome to programmingClass 1: Welcome to programming
Class 1: Welcome to programming
Marc Gouw
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Yuren Ju
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
 
GoLang & GoatCore
GoLang & GoatCore GoLang & GoatCore
GoLang & GoatCore
Sebastian Pożoga
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
akaptur
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
Tatiana Al-Chueyr
 
EuroPython 2016 : A Deep Dive into the Pymongo Driver
EuroPython 2016 : A Deep Dive into the Pymongo DriverEuroPython 2016 : A Deep Dive into the Pymongo Driver
EuroPython 2016 : A Deep Dive into the Pymongo Driver
Joe Drumgoole
 
Functional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with PythonFunctional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with Python
Carlos V.
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
Oon Arfiandwi
 
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
Yashpatel821746
 
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Yashpatel821746
 

Similar to Python 3 (20)

Python 3 - tutorial
Python 3 - tutorialPython 3 - tutorial
Python 3 - tutorial
 
Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
 
Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Python 3000
Python 3000Python 3000
Python 3000
 
Boost.Python: C++ and Python Integration
Boost.Python: C++ and Python IntegrationBoost.Python: C++ and Python Integration
Boost.Python: C++ and Python Integration
 
Learn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersLearn Python 3 for absolute beginners
Learn Python 3 for absolute beginners
 
Python in 30 minutes!
Python in 30 minutes!Python in 30 minutes!
Python in 30 minutes!
 
Class 1: Welcome to programming
Class 1: Welcome to programmingClass 1: Welcome to programming
Class 1: Welcome to programming
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
GoLang & GoatCore
GoLang & GoatCore GoLang & GoatCore
GoLang & GoatCore
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
 
EuroPython 2016 : A Deep Dive into the Pymongo Driver
EuroPython 2016 : A Deep Dive into the Pymongo DriverEuroPython 2016 : A Deep Dive into the Pymongo Driver
EuroPython 2016 : A Deep Dive into the Pymongo Driver
 
Functional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with PythonFunctional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with Python
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
 
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
 

More from Andrews Medina

testando interfaces web
testando interfaces webtestando interfaces web
testando interfaces web
Andrews Medina
 
desenvolvendo jogos para android
desenvolvendo jogos para androiddesenvolvendo jogos para android
desenvolvendo jogos para android
Andrews Medina
 
técnica de desenvolvimento de jogos para web
técnica de desenvolvimento de jogos para webtécnica de desenvolvimento de jogos para web
técnica de desenvolvimento de jogos para web
Andrews Medina
 
realtime - passado, presente e futuro
realtime - passado, presente e futurorealtime - passado, presente e futuro
realtime - passado, presente e futuro
Andrews Medina
 
Haskell para pythonistas
Haskell para pythonistasHaskell para pythonistas
Haskell para pythonistas
Andrews Medina
 
animações e jogos além do canvas
animações e jogos além do canvasanimações e jogos além do canvas
animações e jogos além do canvas
Andrews Medina
 
escalando aplicações django
escalando aplicações djangoescalando aplicações django
escalando aplicações djangoAndrews Medina
 
Desenvolvimento de Jogos em Python
Desenvolvimento de Jogos em PythonDesenvolvimento de Jogos em Python
Desenvolvimento de Jogos em PythonAndrews Medina
 

More from Andrews Medina (9)

testando interfaces web
testando interfaces webtestando interfaces web
testando interfaces web
 
desenvolvendo jogos para android
desenvolvendo jogos para androiddesenvolvendo jogos para android
desenvolvendo jogos para android
 
técnica de desenvolvimento de jogos para web
técnica de desenvolvimento de jogos para webtécnica de desenvolvimento de jogos para web
técnica de desenvolvimento de jogos para web
 
realtime - passado, presente e futuro
realtime - passado, presente e futurorealtime - passado, presente e futuro
realtime - passado, presente e futuro
 
Haskell para pythonistas
Haskell para pythonistasHaskell para pythonistas
Haskell para pythonistas
 
animações e jogos além do canvas
animações e jogos além do canvasanimações e jogos além do canvas
animações e jogos além do canvas
 
escalando aplicações django
escalando aplicações djangoescalando aplicações django
escalando aplicações django
 
Desenvolvimento de Jogos em Python
Desenvolvimento de Jogos em PythonDesenvolvimento de Jogos em Python
Desenvolvimento de Jogos em Python
 
Django Show
Django ShowDjango Show
Django Show
 

Recently uploaded

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 

Recently uploaded (20)

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 

Python 3

  • 2. o que os outros pensam... globo .com
  • 3. o que eu penso... globo .com
  • 4. o que minha mãe pensa... globo .com
  • 5. como realmente é! globo .com
  • 7. pep8 ‣ generators ‣ zen of python ‣ iterators ‣ decorators ‣ comprehension ‣ descriptors ‣ abstract ‣ metaclass ‣ magic methods ‣ context manager ‣ subproccess ‣ multiproccess globo .com
  • 9. unicode ‣ classes new x old style ‣ // vs / ‣ print vs print() ‣ int vs long ‣ urllib, urllib2, urlparse ‣ xmlrpclib, DocXMLRPCServer, SimpleXMLRPCServer globo .com
  • 10. :(
  • 11. python3 ‣ pep8 ‣ zen of python ‣ generators ‣ iterators ‣ objetos globo .com
  • 12. python3.0 2008.. globo .com
  • 13. python3.0 ‣ pip, distribute não funcionava no python3 ‣ 2to3 não foi suficiente globo .com
  • 14. python3.3 ‣ pip, distribute ‣ venv nativo ‣ 2to3, 3to2, six ‣ várias features já funcionam no python2.7 globo .com
  • 16. divisão (python2) >>> 4 / 2 2 >>> 3 / 2 1 globo .com
  • 17. divisão (python3) >>> 3 / 2 1.5 globo .com
  • 18. divisão (python2) from __future__ import division >>> 3 / 2 1.5 globo .com
  • 19. divisão (python2) from __future__ import division >>> 3 // 2 1 globo .com
  • 20. string.format() “{0} - {1}”.format(“andrews”, 19) “{name} - {idade}”.format(name=”andrews”, idade=19) globo .com
  • 21. comprehension {x for x in [1,2,3,3]} globo .com
  • 22. comprehension {key.upper(): value for key, value in d.items()} globo .com
  • 26. bytes e strings bytes para transferência string para representação globo .com
  • 27. bytes e strings bytes (python3) == str (python2) string (python3 == bytes (python2) globo .com
  • 28. bytes e strings (python2) u"andrews " + b"medina" u”andrews medina” globo .com
  • 29. bytes e strings (python3) >>> u"andrews " + b"medina" Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Can't convert 'bytes' object to str implicitly globo .com
  • 30. strings para bytes u"andrews ".encode(“utf-8”) + b"medina" globo .com
  • 31. bytes para strings u"andrews " + b"medina".decode(“utf-8”) globo .com
  • 32. print objeto novos parâmetros (sep, end, file, flush) globo .com
  • 33. print (python2) >>> help(print) File "<stdin>", line 1 help(print) ^ SyntaxError: invalid syntax globo .com
  • 34. print (python3) >>> help(print) globo .com
  • 35. print (python2) >>> from __future__ import print_function >>> help(print) globo .com
  • 36. print (python2) >>> print(", ".join(["banana", "batata"])) banana, batata globo .com
  • 37. print (python3) >>> alimentos = ["banana", "batata"] >>> print(*alimentos, sep=", ") banana, batata globo .com
  • 38. print (python3) from StringIO import StringIO out = StringIO() >>> print("ble", file=out) >>> out.getvalue() 'blen' globo .com
  • 39. range, zip, map, filter retornam iterators globo .com
  • 40. range, zip, map, filter lista = list(range(10)) globo .com
  • 41. range, zip, map, filter for item in range(10): print item globo .com
  • 42. expections except IOError as e: globo .com
  • 43. class Class: new style por padrão globo .com
  • 44. int int = long globo .com
  • 46. annotations adiciona meta dados em uma função globo .com
  • 47. annotations def hello(name: str, age: int) -> int: print(name, age) globo .com
  • 48. annotations >>> hello.__annotations__ {'return': <class 'int'>, 'name': <class 'str'>, 'age': <class 'int'>} globo .com
  • 49. annotations >>> hello("ble", "ble") ble ble globo .com
  • 50. io io.FileIO io.StringIO io.BufferIO globo .com
  • 51. concurrent.future paralelismo globo .com
  • 52. concurrent.future interface Executor globo .com
  • 53. concurrent.future from concurrent.futures import ThreadPoolExecutor with ThreadPoolExecutor(max_workers=1) as executor: future = executor.submit(pow, 323, 1235) print(future.result()) globo .com
  • 54. concurrent.future from concurrent.futures import ProcessPoolExecutor with ProcessPoolExecutor(max_workers=4) as executor: future = executor.submit(pow, 323, 1235) print(future.result()) globo .com
  • 55. functools.lru_cache memoização nativa globo .com
  • 56. functools.lru_cache from functools import lru_cache @lru_cache(maxsize=None) def fib(n): if n < 2: return n return fib(n-1) + fib(n-2) globo .com
  • 60. pep 420 Implicit Namespace Packages globo .com
  • 63. branches diferentes manter dois projetos :( globo .com
  • 64. 2to3 convertor automágico globo .com
  • 65. 2to3 print “ble” -> print(ble) except Exception, e -> except Exception as e globo .com
  • 66. 2to3 2to3=true #distribute globo .com
  • 68. mesma base de código tratamento de excessões globo .com
  • 69. six :) globo .com
  • 70. leitura ‣ http://python3porting.com/ ‣ http://docs.python.org/3/ ‣ http://getpython3.com/diveintopython3/ globo .com

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n