We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Dynamic Class Generation in Python

Formale Metadaten

Titel
Dynamic Class Generation in Python
Serientitel
Teil
4
Anzahl der Teile
169
Autor
Lizenz
CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
Kyle Knapp - Dynamic Class Generation in Python This talk is about dynamic class generation in python: the practice of writing code that generates classes and their functionality at runtime. It will use boto3, the AWS SDK for Python, as a basis to dive into the basics, the benefits, and the drawbacks to dynamically generating classes. ----- This talk is about the concept of dynamic class generation in python. The whole idea is writing code that generates classes and their functionality at runtime. You now may be asking yourself, “That sounds like a neat trick. Why would I ever generate my classes at runtime?” Here are a few reasons why: - It can decrease the physical size of your code. - It can improve the workflow in adding new functionality. - It can improve reliability of your code. One example where the power of this concept has really been leveraged is in boto3, the AWS SDK for Python. Dynamic class generation has allowed boto3 to become heavily data driven such that most of its classes and methods are generated based off JSON models representing aspects of an AWS service’s API. For example, to add support for a new AWS service API in boto3, just plop in a JSON file into the library with no additional Python code required. Using lessons and techniques drawn from developing boto3, this talk will dive into the following topics related to dynamic class generation: - The basics of dynamic class generation such as how to effectively dynamically generate classes. - How to overcome some of the challenges of dynamic class generation. - The tradeoffs in dynamically generating classes and discussion on when it is appropriate.