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

Python Descriptors for Better Data Structures

00:00

Formal Metadata

Title
Python Descriptors for Better Data Structures
Title of Series
Part Number
112
Number of Parts
169
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Adrian Dziubek - Python Descriptors for Better Data Structures Have you ever wondered how Django models work? I'll present a story of data structure transformation. I will talk about ideas from Django models that I used and how I rediscovered descriptor API. I will talk about printing, serializing, comparing data structures and some other examples, where descriptors excel at making declarative code easier to write. ----- I worked as a developer of a testing framework for a C++ server. The framework tested binary protocol implemented by the server. Most of the work involved testers preparing test cases. The data format was primitive structures -- hard to read and easy to break. Field order and all the data had to be entered manually. At the time, I have already seen the better world -- the models from Django. Have you ever wondered how those work? Step by step, I used the ideas from there to make the structures more friendly and on my way I rediscovered descriptors. I'll show in incremental steps, how: - used keyword arguments to lower signal to noise ratio, - order of definition for sorting the fields, - realized that `__call__` is used instead of assignment, - used `__setattribute__` as first step to extend primitive fields, - discovered that I'm actually reimplementing descriptors, and how it lead me to: - implement printing in a way that is friendly to regression testing, - use diff library for less code and better results, - implement more readable validation. I want to show how descriptors work in Python and how they enable declarative style of programming. By the end of the talk I want you to understand what is at the core of the magic behind field types used by object relational mappers like Django.
CodeData structureNetwork topologyBuildingWorkstation <Musikinstrument>Level (video gaming)Position operatoroutputSatelliteData storage deviceFunction (mathematics)Physical systemCellular automatonStatistical hypothesis testingStatistical hypothesis testingBinary codeDatabaseDependent and independent variablesSocial classRevision controlData typeCommunications protocolRegulärer Ausdruck <Textverarbeitung>Condition numberAddressing modeFreewareSicValue-added networkChainAttribute grammarElement (mathematics)Price indexPattern languageBitTraffic reportingConfiguration spaceServer (computing)Programming languageGame theoryComputer programmingObservational studyProjective planeSummierbarkeitAreaField (agriculture)Algebraic structureNetwork topologyVariable (mathematics)Special functionsBinary codeElectric fieldLevel (video gaming)Statistical hypothesis testingVideo gameForm (programming)Social classAttribute grammarContext awarenessRevision controlServer (computing)Cellular automatonData structureSoftwareCartesian coordinate systemFormal languageProgrammer (hardware)Functional (mathematics)MereologyLine (geometry)Dependent and independent variablesDefault (computer science)Workstation <Musikinstrument>Element (mathematics)Polar coordinate systemWordConfiguration spaceObject (grammar)Process (computing)SatelliteParameter (computer programming)Inheritance (object-oriented programming)Module (mathematics)Student's t-testFilm editingSystem callTraffic reportingLetterpress printingPositional notationVolume (thermodynamics)NamespaceFitness functionPresentation of a groupMortality rateStatistical hypothesis testingCodeDatabaseBitDifferent (Kate Ryan album)Serial portExtension (kinesiology)WeightRight angleComputer animation
Data typeSocial classLibrary (computing)ClefRevision controlInterior (topology)Element (mathematics)Function (mathematics)Field (agriculture)Algebraic structureInstance (computer science)Element (mathematics)Social classDifferenz <Mathematik>Electric fieldTraffic reportingAttribute grammarSet (mathematics)ManifoldFitness functionGenderLibrary (computing)MaizeSystem callPhysical lawData structureField (agriculture)Potenz <Mathematik>Parameter (computer programming)Theory of relativityDefault (computer science)Letterpress printingData recoveryWordPresentation of a groupDifferent (Kate Ryan album)MereologyNetwork topologyCommunications protocolStatistical hypothesis testingInheritance (object-oriented programming)Projective planeMortality rateExecution unitMultiplication signInstance (computer science)Field extensionLecture/Conference
Social classInstance (computer science)UsabilityClefTransformation (genetics)Set (mathematics)Mechanism designAttribute grammarFunctional (mathematics)SequenceLine (geometry)Sign (mathematics)Reduction of orderMathematicsComputer animation
Inheritance (object-oriented programming)Social classDefault (computer science)Instance (computer science)Value-added networkReading (process)Attribute grammarRevision controlData typeCASE <Informatik>Field (agriculture)MereologyData dictionaryAlgebraic structureError messageCASE <Informatik>ChainingElectric fieldNumberElement (mathematics)State of matterGodPerformance appraisalArithmetic meanInstance (computer science)Field (agriculture)Inheritance (object-oriented programming)Attribute grammarPhysical lawSet (mathematics)1 (number)Social classDefault (computer science)Range (statistics)Revision controlFunctional (mathematics)LogicSystem callInterior (topology)Maxima and minimaHeegaard splittingValidity (statistics)Type theoryComputer animation
PressureFunction (mathematics)Element (mathematics)Letterpress printingReading (process)Statistical hypothesis testingRight angleLinear regressionMatching (graph theory)TouchscreenProjective planeAlgebraic structureDifferent (Kate Ryan album)Category of beingData structureField (agriculture)Statistical hypothesis testingStatistical hypothesis testingLetterpress printingAttribute grammarComputer animation
Proof theoryPareto distributionCASE <Informatik>Statistical hypothesis testingBitTraffic reportingServer (computing)Configuration spaceCommunications protocolSCSIScalar fieldClefSocial classAttribute grammarReading (process)Revision controlIntercept theoremField (agriculture)Data typeAlgebraic structureMultiplication signDemosceneSet (mathematics)Proof theoryGroup actionRight angleParameter (computer programming)Field (agriculture)Volume (thermodynamics)Moment (mathematics)Data structureForestSystem callMereologyGraph (mathematics)Statistical hypothesis testingTemplate (C++)Computer animation
Inheritance (object-oriented programming)Instance (computer science)Social classClefNetwork topologyDimensional analysisInsertion lossNoise (electronics)MereologyAlgebraic structureWind tunnelSocial classElectronic mailing listElectric fieldNumberDefault (computer science)SpacetimeData structureIntegerMixed realityAttribute grammarHierarchyField extensionLecture/Conference
Element (mathematics)Letterpress printingReading (process)Statistical hypothesis testingInheritance (object-oriented programming)Social classInstance (computer science)ClefData typeLibrary (computing)Software development kitField (agriculture)Finite element methodRevision controlInterior (topology)Point (geometry)Different (Kate Ryan album)TouchscreenNetwork topologyWeb-DesignerProcess (computing)Line (geometry)Arithmetic meanState of matterPairwise comparisonData structureCodeConfiguration spaceDifferenz <Mathematik>BitComputer animation
Transcript: English(auto-generated)