You are on page 1of 26

Python,ellenguajedehoy

JohnAlexisGuerraGmez PULPA GrupodeusuariosGNU/LinuxdePereira

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

QuesPython?
Unlenguajedeprogramacin

OrientadoaObjetos. Portable. Interpretado. Dealtonivel. Consemnticadinmica(dynamictyping anddynamicbinding).


PULPAGrupodeUsuariosGNULinuxdePereira

JohnAlexisGuerraGmez

QuesPython?(II)

Sencillodeaprenderyleer. Poderoso. Conmanejodeexcepcionespornombre. Extensibleyflexible. Embebible. Estable. Softwarelibre.


PULPAGrupodeUsuariosGNULinuxdePereira

JohnAlexisGuerraGmez

ParaqusirvePython?

Paraaprenderaprogramar. Paraaplicacioneslivianasypesadas. ParagenerarGUIs. Paraaplicacionesdistribuidas. Paraaplicacionesclienteservidor,yde variascapas. Paraaccesoabasesdedatos.


PULPAGrupodeUsuariosGNULinuxdePereira

JohnAlexisGuerraGmez

ParaqusirvePython?(II)

Parahacerjuegos. Parahacersitioswebyelservidorporah derecho. Paraprogramarparasistemasembebidos. Parahacerscripting. Parahaceraplicacionescientficas. Paraunircosas.


PULPAGrupodeUsuariosGNULinuxdePereira

JohnAlexisGuerraGmez

ParaqusirvePython?(III)

Paraprogramacinfuncional. Paraaplicacionesconmuchos desarrolladores. Parainterpretarlenguajes. Parahacersoftwaremultiplataforma. Paraaprenderaprogramarorientadoa objetos. Parausarsuslibreras.


PULPAGrupodeUsuariosGNULinuxdePereira

JohnAlexisGuerraGmez

CundonousarPython?

Cuandoteobligan. Sinecesitasunalibreraquenoest implementadaenpythonynolaquieres implementar. Aplicacionesdevelocidadcrtica,igualse puedeusarcomofrontendyparaunirtodo. Cuandonotequieresenamorardel.


PULPAGrupodeUsuariosGNULinuxdePereira

JohnAlexisGuerraGmez

QuinusaPython?
BitTorrent,NASA,IndustrialLight&Magic, Google,Yahoo,RedHatLinux,GentooLinux, IBM,Disney,RealNetworks,TotallyGames, NationalInstitutesofHealth(USA),National WeatherService(USA),TheUSNavy,GDA, Animazione... Tomadode: http://pbf.strakt.com/success http://pythonology.org/success
JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

PythonvsPerlvsJavavsC++
Python Perl Java C++ import java.io.*; public class test { public static void main(String[] args) { try { File f = new File("/tmp/scratch"); PrintWriter pw= new PrintWriter( open new BufferedWriter( ($F,">/tmp/scratch"); new FileWriter(f))); for $i (0 .. 1000000for (int i = 0; i < 1000000; i++) { 1) { pw.print(i); print $F "$i\n"; } } pw.close(); close($F); } catch(IOException ioe) { ioe.printStackTrace(); } } } #include <iostream.h> #include <fstream> using namespace std; int main(int argc,char *argv[]) { ofstream out; out.open("/tmp/scratch"); for(int i=0;i<1000000;i++) { out<<i; } out.close(); }

f=open('/tmp/scratch','wb') for i in xrange(1000000): f.write(str(i)) f.close()

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

PythonvsJava
public class Employee { private String myEmployeeName; private int myTaxDeductions = 1; private String myMaritalStatus = "single"; //--------- constructor #1 ------------public Employee(String argEmployeName) { myEmployeeName = argEmployeeName; } //--------- constructor #2 ------------public Employee(String argEmployeName, int argTaxDeductions) { myEmployeeName = argEmployeeName; myTaxDeductions = argTaxDeductions; } //--------- constructor #3 ------------public Employee(String argEmployeName, int argTaxDeductions, String argMaritalStatus) { myEmployeeName = argEmployeeName; myTaxDeductions = argTaxDeductions; myMaritalStatus = argMaritalStatus; } ...

class Employee(): def __init__(self, argEmployeName, argTaxDeductions = 1, argMaritalStatus = "single"): self.EmployeeName = argEmployeeName self.TaxDeductions = argTaxDeductions self.MaritalStatus = argMaritalStatus ...

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

PythonvsJava(II)
public Vector aList = new Vector; public int aNumber = 5; public int anotherNumber; aList.addElement(new Integer(aNumber)); anotherNumber = ((Integer)aList.getElement(0)).intValue(); aList = [] aNumber = 5 aList.append(aNumber) anotherNumber = aList[0]

Algunascomparacionesquesalenalbusarpythonvsjavaengoogle

http://www.ferg.org/projects/python_java_sidebyside.html http://twistedmatrix.com/users/glyph/rant/pythonvsjava.html http://ambient.2y.net/leif/projects/pythonvsjava/ http://forums.devshed.com/archive/t183517 http://yaroslav.hopto.org/russianwiki/index.php/simplepythonvsjava

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

Tkinter

LaGUIoficial HeredadodeTcl/Tk Fcildeusar Altamente customizable Pocoswidgets

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

WxPython

Grannmerode widgets Multiplataforma OrientadaaObjetos Grannmerode extensiones

VariosEditoresde interfaces http://www.wxpython.org

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

BoaConstructor

RAD Basadoen wxpython Multiplataforma

http://boaconstructor.sourceforge.net/
JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

pyunit

Frameworkparatestearunaaplicacin. Permiteprobarmasivamenteaplicaciones basadasentextooengui. Hacepartedelpythonstandardlibrary. BasadoenelJunit. http://pyunit.sourceforge.net

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

Juegos

pygame

Unconjuntodemdulosdiseadosparaescribir juegos. Basadoensdl http://www.pygame.org Unmotor3ddemuyaltonivelparapython http://home.gna.org/oomadness/en/soya/


PULPAGrupodeUsuariosGNULinuxdePereira

soya

JohnAlexisGuerraGmez

jython

Unaimplementacindepythonescrita completamenteenJava Puedescorrerpythonencualquier plataformaquecorrajava http://www.jython.org/

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

Servidoresweb

zope

Esunservidordeaplicacionesopensource, muyrobusto. Utilizaunmotordedborientadoaobjetos http://www.zope.org http://www.plone.org http://webware.sourceforge.net/


PULPAGrupodeUsuariosGNULinuxdePereira

webaware

JohnAlexisGuerraGmez

DBAPIv2.0

APIestandarizadadeaccesoabasesde datos. Permitelaportabilidaddelcdigoentre diferentesmotoresdebasesdedatos. MdulosparaIBMDB2,Informix,Interbase, Ingres,OpenIngres,JDBC,MySQL,ODBC, Oracle,PostgresSQL,SQLite,SAP,Sybase, ThinkSQL,...


PULPAGrupodeUsuariosGNULinuxdePereira

JohnAlexisGuerraGmez

Msaplicaciones

http://www.python.org http://www.vex.net/parnassus/ http://www.google.com=)

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

CmoaprenderPython?

http://docs.python.org/tut/tut.html http://diveintopython.org/

http://www.python.org/doc/NonEnglish.html#spani

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

Unejemplito
defqsort(L): ifL==[]:return[] returnqsort([xforxinL[1:]ifx<L[0]])+L[0:1]+\ qsort([xforxinL[1:]ifx>=L[0]])

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

Tutorial
#Comentario a=10033406;#Unentero a=John;#Ahoraunacadena a=1.1;#Ounpuntoflotante a=(10033406,John);#Ounatupla a=[10033406,John];#Ounalista a={10033406:john};#Oundiccionario a=3+2.5j;#Ounimaginario

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

Tutorial(II)
di_hola='si' ifdi_hola==si: print'''Holamundo'''

foriinrange(10): printholanmero,i i=0 while1: printundowhile ifi==0: break


JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

Tutorial(III)
lista=[uno,'dos',tres] foriinlista: printi,len(i)

#Uncicloinfinito while1: pass

deffib(n):#writeFibonacciseriesupton """PrintaFibonacciseriesupton.""" a,b=0,1 whileb<n: printb, a,b=b,a+b

JohnAlexisGuerraGmez

PULPAGrupodeUsuariosGNULinuxdePereira

# #AverysimplewxPythonexample.JustawxFrame,wxPanel, #wxStaticText,wxButton,andawxBoxSizer,butitshowsthebasic #structureofanywxPythonapplication. # importwx#Thismoduleusesthenewwxnamespace classMyFrame(wx.Frame): """ ThisisMyFrame.ItjustshowsafewcontrolsonawxPanel, andhasasimplemenu. """ def__init__(self,parent,title): wx.Frame.__init__(self,parent,1,title,size=(350,200)) menuBar=wx.MenuBar() menu=wx.Menu() menu.Append(101,"E&xit\tAltX","Exitdemo") wx.EVT_MENU(self,101,self.OnButton) menuBar.Append(menu,"&File") self.SetMenuBar(menuBar) panel=wx.Panel(self,1) text=wx.StaticText(panel,1,"HelloWorld!") text.SetFont(wx.Font(12,wx.SWISS,wx.NORMAL,wx.BOLD)) text.SetSize(text.GetBestSize()) btn=wx.Button(panel,1,"Close") btn.SetDefault() sizer=wx.BoxSizer(wx.VERTICAL) sizer.Add(text,0,wx.ALL,10) sizer.Add(btn,0,wx.ALL,10) panel.SetSizer(sizer) panel.Layout()
JohnAlexisGuerraGmez

wx.EVT_BUTTON(self,btn.GetId(),self.OnButton) defOnButton(self,evt): """Eventhandlerforthebuttonclick.""" print"OnButton" self.Close() app=wx.PySimpleApp() frame=MyFrame(None,"SimplewxPythonApp") frame.Show() app.MainLoop()

PULPAGrupodeUsuariosGNULinuxdePereira

You might also like