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

Easier Classes: Python Classes Without All The Cruft

Formale Metadaten

Titel
Easier Classes: Python Classes Without All The Cruft
Serientitel
Anzahl der Teile
50
Autor
Mitwirkende
Lizenz
CC-Namensnennung - 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
When bundling up data, sometimes tuples and dictionaries don’t quite cut it. Python’s classes are powerful tools for data storage and manipulation, but it can take quite a bit of boilerplate code to make a well-behaved Python class. In this talk we’re going to discuss how a well-behaved class should work and take a look at a number of helper libraries for creating well-behaved classes. We’ll first see how to make classes with proper string representations, comparability, iterability, and immutability. Then we’ll dive into helper tools built-in to the standard library and available in third-party libraries and briefly discuss which of these tools makes sense to use with Django’s classes. We’ll look at namedtuple, NamedTuple (not a typo), attrs, and the new Python 3.7 dataclasses. Most of the libraries discussed in this talk are only available in Python 3, so if you’re not using Python 3, hopefully this talk will encourage you to upgrade.