Mostra la pàginaRevisions anteriorsQuè hi enllaçaExporta a PDFTorna dalt Aquesta pàgina és només de lectura. Podeu veure'n el codi font, però no podeu canviar-la. Consulteu el vostre administrador si penseu que això és degut a algun error. = Curso python (PCPP1) PUE 2023 {{tag>python}} * Jordi Ariño * jordi.arino@pue.es * jordiAS2K@gmail.com * Plataforma: EDUBE * Recursos * Referencia:[[https://docs.python.org/3/reference/index.html]] * Librerías: [[https://docs.python.org/3/library/index.html]] * funciones built-in: [[https://docs.python.org/3/library/functions.html]] * PEP8: [[https://peps.python.org/pep-0008/]] * Paquetes: [[https://pypi.org/]] == PCPP1 / M1 | Advanced Perspective of Classes and Object-Oriented Programming in Python * Classes, instances, attributes, methods, as well as working with class and instance data; * shallow and deep operations; * abstract classes, method overriding, static and class methods, special methods; * inheritance, polymorphism, subclasses, and encapsulation; * advanced exception handling techniques; * the pickle and shelve modules; * metaclasses. === 1 OOP FOUNDATIONS * [[info:cursos:pue:python-pcpp1:m1:1.1]] * [[info:cursos:pue:python-pcpp1:m1:1.2]] === 2 OOP ADVANCED * [[info:cursos:pue:python-pcpp1:m1:2.1]] * [[info:cursos:pue:python-pcpp1:m1:2.2]] * [[info:cursos:pue:python-pcpp1:m1:2.3]] * [[info:cursos:pue:python-pcpp1:m1:2.4]] * [[info:cursos:pue:python-pcpp1:m1:2.5]] <- resumen * [[info:cursos:pue:python-pcpp1:m1:2.6]] * [[info:cursos:pue:python-pcpp1:m1:2.7]] * [[info:cursos:pue:python-pcpp1:m1:2.8]] * [[info:cursos:pue:python-pcpp1:m1:2.9]] === 3 ADVANCED TECHNIQUES OF CREATING AND SERVING EXCEPTIONS * [[info:cursos:pue:python-pcpp1:m1:3.1]] === 4 OBJECT PERSISTENCE * [[info:cursos:pue:python-pcpp1:m1:4.1]] * [[info:cursos:pue:python-pcpp1:m1:4.2]] * [[info:cursos:pue:python-pcpp1:m1:4.3]] === 5 METAPROGRAMMING * [[info:cursos:pue:python-pcpp1:m1:5.1]] == PCPP1 / M2 | Best Practices and Standardization (Python Enhancement Proposals) * PEP 20 (The Zen of Python) * PEP 8 (Style Guide for Python Code) * PEP 257 (Docstring conventions) * how to avoid common errors and mistakes when writing code; * how to write elegant and effective code. === 1 INTRODUCTION TO PEPS * [[info:cursos:pue:python-pcpp1:m2:1.1]] * [[info:cursos:pue:python-pcpp1:m2:2.1]] * [[info:cursos:pue:python-pcpp1:m2:3.1]] * [[info:cursos:pue:python-pcpp1:m2:4.1]] == PCPP1 / M3 | Introduction to GUI Programming in Python: TkInter (Python Enhancement Proposals) * what GUI is and where it came from; * how to construct a GUI using basic blocks and conventions; * how event-driven programming works; * some popular and commonly used GUI environments and toolkits; * what tkinter is and how to build a GUI with its help; * how to use widgets, windows, and events, and how to create basic applications based on tkinter's application life cycle. === 1 GUI PROGRAMMING * [[info:cursos:pue:python-pcpp1:m3:1.1]] * [[info:cursos:pue:python-pcpp1:m3:1.2]] * [[info:cursos:pue:python-pcpp1:m3:1.3]] * [[info:cursos:pue:python-pcpp1:m3:1.4]] * [[info:cursos:pue:python-pcpp1:m3:1.5]] * [[info:cursos:pue:python-pcpp1:m3:1.6]] * [[info:cursos:pue:python-pcpp1:m3:1.7]] * [[info:cursos:pue:python-pcpp1:m3:1.8]] * [[info:cursos:pue:python-pcpp1:m3:1.9]] * [[info:cursos:pue:python-pcpp1:m3:2.1]] * [[info:cursos:pue:python-pcpp1:m3:2.2]] * [[info:cursos:pue:python-pcpp1:m3:2.3]] * [[info:cursos:pue:python-pcpp1:m3:2.4]] * [[info:cursos:pue:python-pcpp1:m3:2.5]] == PCPP1 / M4 | Working with RESTful APIs * the basic concepts of network programming, REST, network sockets, and client-server communication; * how to use and create sockets in Python, and how to establish and close the connection with a server; * what JSON and XML files are, and how they can be used in network communication; * what HTTP methods are, and how to say anything in HTTP; * how to build a sample testing environment; * what CRUD is; * how to build a simple REST client, and how to fetch and remove data from server, add new data to it, and update the already-existing data. === 1 * [[info:cursos:pue:python-pcpp1:m4:1.1]] * [[info:cursos:pue:python-pcpp1:m4:1.2]] * [[info:cursos:pue:python-pcpp1:m4:1.3]] * [[info:cursos:pue:python-pcpp1:m4:1.4]] * [[info:cursos:pue:python-pcpp1:m4:1.5]] * [[info:cursos:pue:python-pcpp1:m4:1.6]] * [[info:cursos:pue:python-pcpp1:m4:1.7]] === 2 * [[info:cursos:pue:python-pcpp1:m4:2.1]] == PCPP1 / M5 | File Processing * [[info:cursos:pue:python-pcpp1:m5:1.1]] * [[info:cursos:pue:python-pcpp1:m5:2.1]] * [[info:cursos:pue:python-pcpp1:m5:3.1]] * [[info:cursos:pue:python-pcpp1:m5:4.1]] * [[info:cursos:pue:python-pcpp1:m5:5.1]] == summary * class, instance, object, attribute, method, type (%%__class__%%) * instance variables: ''<object>.%%__dict__%%'' * class variables: * ''<class>.%%__dict__%%'' * ''<class>.class_var = 1'' * superclass methods: * %%__init__%% * special methods: * %%__name__%% * %%__getattribute__%% * magic methods * [[https://docs.python.org/3/reference/datamodel.html#special-method-names]] * ''dir()'' * ''help()'' * Inheritance * MRO ≡ Method Resolution Order * Polymorphism * arguments * ''*args'': tuple (a,b,c) * ''%%**%%kwargs'': dictionary {} * decorators * ''@simple_decorator()'' * <code python> class Classe: class_var = 0 def __init__(self): self.instance_var = 0 Classe.class_var += 1 class SubClasse(Classe): pass </code> <code python> def simple_decorator(own_funct): def internal_wrapper(*args,**kwargs) print("pre-execution") own_function(*args,**kwargs) # original method executed return internal_wrapper @simple_decorator def decorators(*args,**kargs): pass def simple_decorator_attributes(attribute): def wrapper(our_funct): def internal_wrapper(*args): pass return internal_wrapper return wrapper @simple_decorator_attributes('argument') def decorators_with_attribute(*args): pass @simple_decorator @simple_decorator_attributes('other_argument') # simple_decorator( simple_decorator_attributes( funcion() ) ) class SimpleDecoratorClass: def __init__(self, own_funct): self.func = own_funct def __call__(self,*args,**kwargs): print(self.func.__name__) self.func(*args,**kwargs) class SimpleDecoratorClassWithArguments: def __init__(self,argument): pass def __call__(self,own_funct) @SimpleDecoratorClass def simple_function(*args,**kwargs): pass def object_counter(class_): class_.__getattr__orig = class_.__getattribute__ def new_getattr(self, name): if name == 'mileage': print('We noticed that the mileage attribute was read') return class_.__getattr__orig(self, name) class_.__getattribute__ = new_getattr return class_ @object_counter class Car: def __init__(self, VIN): self.mileage = 0 self.VIN = VIN </code> === otros conocimientos * [[https://alvarohurtado.es/2020/06/08/que-hace-yield-en-python/|yield]] * [[https://alvarohurtado.es/2013/08/31/generadores-en-python/|generadores]] * logs: [[https://atareao.es/pyldora/tus-logs-en-python-de-forma-eficiente/]] ==== guia estilo * [[https://elpythonista.com/zen-de-python|PEP20]] * <code bash>pip install pycodestyle</code> ==== utilidades * [[https://sqlitestudio.pl/]] * multiplataforma? BeeWare: [[https://docs.beeware.org/en/latest/index.html]] info/cursos/pue/python-pcpp1.txt Darrera modificació: 04/03/2024 02:52per mate