Merken

Static type-checking is dead, long live static type-checking in Python!

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Beta
Erkannte Entitäten
Sprachtranskript
if it I've had everyone and thanks for having me this is the last structure of rural by and my name is that is
often a key seems to can reach me on Twitter and a decrease in I
work at to fire in Montreal a French Canadian I'm also an
organizer of diametral quite end user groups as we do monthly meetups with little conferences and so and but it was also so if you're ever in Montreal of your website civilian thing on would be glad to see that and today I am here to talk to you about it's and syntactic invited before we go and that I want to bring
some and theory in it so the 1st thing I want to talk to you about is but systems
and this is boring but it's it's not just happen surface going check is
and what is a type
system cost deal which physical the Wikipedia definition is quite hands on it so it's a it's a set of programming languages a type system is a collection of rules a set of rules and that a certain property called tied to various constructs composing the conture program such as variables expressions functions are models this basically just a set of rules and some but also it has it has lots of purposes and of course the first one is we have type systems in place to help
us reduce and identify politicians potential models we have in our programs and it also on also is going to give us the meanings to a sequence of bits and because if I just give you dis 8 bits and we have no idea what it is so it could be either 72 if it's an integral could be the letter H if it's a nasty character set a goal see meaning that could also mean that it's a true born in a value in for sequence and because this and call to so that the dig
quickly to some fundamentals and so With the type systems has in the city by type theory is it's a lot of math itself decides also and also so program programming language is going to need a and type checking in place and the biking was just going to be meaning that it's assigning a tie to value and type checks could be done either at runtime and could be done at compile time it could
also be and manually annotated in the source code to declared the type before a variable or DM language that x assigning should also automatically inferred so without having to declare what the type of a variable it is and the Texas and can deduce what it is kind of like adjusted taking will give meaning to the success of its and so if systems we're going to have of course and type checking and checking
WordTech city it's the process of verifying and enforcing the constraint of the tax system so it's just taking and making certain that the parts had been collected in a meaningful and constant weights so for instance we cannot add a string to a list its the type of their in some of the work with type by checking so
it's going to prevent illegal operations and markets and adding it is within a different sense and it provides also a memory uh city measures so good type checking for a good
type system is going to reduce and evil fourfolds already out of my rights and then you can do which would lead to corrupting the running executable or memory in place it also helps for logic errors so to does allow you working with different semantics so with types checking is that we don't have safety like I said that type safety is basically just enforcing the types in a programming language it's a requirement for any brimming language and it's also closely linked to the Mary 60 of furor some of your resectable and people are often going to compare to strong typing verses weak typing and so it's only going to be wondering if it's what is the type 16 if it's memory-safe um is it 60 type that is static type-checking or is it going to be binary practically however the problem is that for many languages and many which is are to be for for having human-generated types into groups and so they would require thousands of cases Harvard or some languages and don't have rigorous
defines command 6 some friends and some and all these languages and they haven't and have been proven to meet certain definition of type safety task and also is under the name was that if you do not use of unsafe and methods that are almost the I O operation you can you can provide a good level of activity um I'm also just wanna talk quickly about the cup
which is a programming language was mostly in its in its relative to ramp over which was written in that will come and it's over 26 years old it's a dependence is tight for 2 language and and so and there's a there's a browser that was written in
this programming language called quot and the web browser has a kernel that has been formally verified by so it's
set so it means that it it should be almost and but proof or as secure as a no buffer reveals a new what's really to the type system and so we have the type 60 projects but to have
type checks there's 2 ways of doing it of course and we're gonna have the that the static type-checking which is going to be done of course outcome of In a static type checking every variable is is going to be bound to a type during compelled that combined effects and it provides us
with a good some good things 1st
so it operates on the program source code it is enough to run DOS detectable synsets runs on DOS and source it helps you to catch bugs per year in Europe development cycle and it's also going to give you a higher level of confidence in my opinion uh and it could be all depending on which type system uses it could be also limited form of formal revision as to whether you're program does what it's supposed to do and some quick
static type checking with we have is of course C C + + and Java go and like I said last year will come on or
or some of them and there is and that other parts of the languages that are attempting thank you gender
gender type checking we have is the cost of dynamic so instead of doing taking average at compile time we're going to have it at runtime so Waldsee uh programs exist that 1 it's 1 so this iterative process everything that 60 during runtime compared to static type-checking here every viable is going be bound to an object and not necessary to time because the time has to be has to be infer during the execution and this gives you
a usually it will all providers to run more quickly because if we knew that it remains a phase from the compiler which is type checking it although it allows also integrated chew and to integrate dynamically new code so princeton by the we have evolved uh it also allows duck typing and easier programming and at last 2 are and this all need for dynamic tactic language because for instance with firm C + + we have templates with and with people someplace um type checking is done at 1 time another
example of the 980 type chicken was of course will biotin would be as as if it's the that will of
course the analysts uh which are a also compiled by Willis which is a compiled language isn't only a dynamic which means a dynamic type and check language there is also a combination of both and like I said 1st was templates is there is there for Java and C when you and scale um but variable and and type checking is indeed on at 1 time and for c you can also just don't get something to avoid and the circumbinary another complete so that was type systems but since by is a dynamically typed language but given that it but Help us as I
said it does help us reduce the number of blogs and by reducing number of bonds it will help us to identify more quickly but during our development process and with a
static type language people will often say that since my languages like the statically typed I do not need
to run and that's because my test are handled by Mike that system which is I don't think it's too but also people organize say that the body is merely a poorie tight uh 40
this brings also the number
hobbies this was over a year ago and when it happens that people complain that if open is essential had been written in a language with a better on type system the body that part the the the book caused by a hobby would have never happened it's up to discussion maybe yes maybe no we'll see alright so let's
get back to some Python let's say I have this and method of Fibonacci method and if I want to run against the pressure for it used going to media this the 42nd uh through a large number if I wanted to test and method 1 quick way of doing that would be to us a different sense you will achieve 0 0
1 2 and maybe another bigger number just make sure that the method does what it's supposed to do and so by only testing those 5 1 5 numbers let's let's let's see what else I can do so let's say I have
my entire set of possibilities of various types models and the object can have and I have my set of integers which are here and indeed tessellate have only tested Didier fighting together so it's like almost nothing in the entire set of possibilities I could that I have which means that if I have
a filtering Cincinnati 0 . 0 0 or 1 . 5 In the case of my method it works but it doesn't really this did was it doesn't really give me what I want and if I do have Fibonacci 14 that 3 to it's it's been explored right there and this means that
with my entire set of possibilities and by using static I would have been able to here I have my set of notes but I would being able to just remove them from my set of possibilities since fields are a if you want you can be calculated with floats and the same thing with a string with strings yeah with list I don't need those so this
give this reduces the acid of facility that I have to test again and what is the current state of and
static text vitamins so vitamins a dynamic language but you have some that static
type-checker happening and 1 of those that I looked upon is
just brings by so the idea idea they have been there so the added some type hints and particular over 5 for 5 years yep and the way it works is the EU's docstrings for fighting 2 and for quite entreaty used to function additional document after and this provides the ID with information on what types the leader methods of verbal or supposed to be so it's it gives the DID user some completion and so as I said it works with a D parameter passed to a function return values also and local variables some example that I to
directory from questions documentation let's say I have this method and for a question to do some and some of the painting I would I
could do it I could add strings with their specific syntax so here for example and ABC would be in integer and this will help I challenge you have to give me to completion based on those choices are to warning if I give a string for instance
and by trends 1 from a simple class a simple class types to a really more complete type-checker with let you see the both types of direct pipes function types and I must say that they did a pretty good job with the communities the banks so the just gathered feedback from the users experience to help you have a better system and then another 1 we have that
is by means by Lin is a source code analyzer and so it's a command
line tool which looks for programming errors and that helps you enforced a better coding standards so the static text that is going to do is and did you going to do basic can bite and trip at that sorry sidelined and it do some various error detection so for instance they're going to do and they're gonna tell you when you have variable letter undeclared uh if you have models that are an important if you have and use variable and they can also tell you if you have a return statement in the have after and it's going to say that the Council full will never reach seat on disco and it's fully customizable its extendable it's it's it's a good piece of the library in my opinion and estimate sigma over 180 different ever codes it can produce an even the correct coronary given amazing popular Wednesday um which was really nice it integrates nicely with ideas so the amino accidents by spectrum anymore everything is on the website it's nice to different and another 1 that I want to bring upon is by fixed so just as a fight and it's a command line tool that will and secure apart and source code and it says that compared to pioneer and it's going to be
faster and because it only passes G and G syntax tree of the files and it will never complain about your coding style uh and also try very hard to and never entered false positives so if there's a warning uh it wants to have a real need for warning to you and that may be a the problem with the and so this spike fixed
and as I said earlier and there
is a function addition this is that 3 1 0 7 and so this is a syntax that was added to the uh to heighten just just in time for quite entry but in 2006 and what it does is it allows you to have an arbitrary metadata to your method and signatures like you can see here
and with deals with tools arguments are going be able to get them from Jonas wonders for connotations super method so if you are so and this means that the other libraries like think by him and by the Rb were able to use those uh syntax augmentation to to help and the
next 1 is from my prime it's an experimental optional static type-checker that has been around there a 2012 it's a it was his heavily inspired by the plight by a Python-based quite inspired language which included an optional static type system so as I said it's
an optional subject that took a it's a it's a command line tool that you can use to run against your files and it will it will use that 1st of all the bet for it for an entire paintings it's can it has a powerful type system and compile type checking and the thing is that the offer once you choose to use the tool after writing a program so sir by writing yeah growth and then adds the US and Europe tiepins in Europe right after and then run my like to be able to maybe catch bugs virtue enforce certain thank checks on those
and so 1 wants more and it uses the devotion additions and it's gonna use also idea but for all the 44 icons in in that case my Fibonacci method since it states and in Figure if I pass a string might buy will produce an error so but it is also
bad for a form which is
uh of course optional hints and it was it appears since when that in addition started over in 2006
and a lot of third-party um libraries petition start using those but it's prong lots of different ways of using it so that this this that wants to be just a start of must bring a standard way of doing typing and I believe it's going to be compared to what was the introduced with for marks of having a standard way and a baseline for tools to work with and of course as the
offers states and by the remains of a dynamically typed language and your D. alters the haven't desire of of making type into interior and I won't go too much and those because
even we do have a direct doctors was a 2nd talk about him
so I'm gonna just tell them that
this Bekenstein if as static tactics let's said let's
go back to over an hour a circle of possibilities we have so if we include states in fact that checking in our program this means that the the set of possibilities that we have to test against a really but we still have this huge integer says that we are not sure what we should do with that we could introduce some formal proof with farming and but I think this goes against the principle of what we so
1 way of doing it is using a library called hypothesis and once again a lot of people
but about but this this week so I'm just going to go quickly unwanted so hypothesis
is a property based at this thing library it's said based on how skills which recovery which itself is a combinator library which was written by can 99 there it's designed to assist you in and testing of software so high so it's going to data uh random that and it's going to try to false euro to falsify your assertions of
your unit tests and once it finds a what's it gonna find a figure it will try to give you the simplest but to simplify at most 2 year the freighter so on another unit
that's what you're going to have is that you get a set of some static that that and you're going to perform some operations and you which is the method for instance among at best and you're can assert that the result that you get by just that by just so permission is what you think it is and is what you expect it to be the difference of property basis thing is instead of sitting static that power is in try to test that that that is only matching its decision you're going to giving it and also you quickly at the way it does so
hypothesis will generate random that matching disposition if it's fine if it if it finds a figure like I said it would try to give you the the this the simplest to simplify and the underfitting that that's a let's say that you have a big a big list of integers that fills your test is going to try to reduce it to maybe having if it's having an insidious that fails or if it's having a negative integers of meet your destiny is going to try to reduce it and completely and of course that that that is going to be saved locally for faster you for fast at test after since generates random that and it does a lot of which um right
I had this huge and method that we don't really want to care about it said a LZW data-compression took this history from the year will the DB website so I have a compressed method and I have haven't decompressed if I wanted to test it and regularly with the unit test this is what I would do
so I would try to compress my text and then decompress and I would try to make sure that it stays the same since it's a lossless compression algorithm and but with hypothesis what I
would do is I would give it a specification which is with the given the character and I will tell you that it's text and with this it's going to try to generate random dot them that are gonna be text-based and try to make this distortion
fail and if I run and it's going to give me 1 figure that the
method has it's of course that if I haven't string and it fails and if we go back to the best gents
string will fail some I think I forgot to put the so this is
would be a so having having have thesis on top of some static analysis that would help
us to literally testing terms of facilities we have so In diffusion but indeed 20 as we have at Texas sense
or inherently complicated and but and even though the computers and it's it's it's interesting to know I Holly work at both dynamic and static type checking have the columns in the pros but I think that having both of them living in your in the type system could really help them on that for 8 4 is gonna unified by printing and it's going to give more power to devote more time and checkers in Python and lastly health-cost hypothesis and other imposing library that can help you to reduce and find bugs early neural development cycle soon
this is due in few
or if you have any questions feel free
and we have some time just catch me so you were saying the pilot
and also the static type checking and to some degree and what I would say is fine and
wants to use that for it for Q ads uh type hints in this text because it wants to it wants to use the I'm referring the words in a dictionary but it wants to to try to use the AC tree of the code you have to have give you some hints of you could have so it's from what I heard is something work in it will be done later something of an thanks I think of this but I I think
you text
Physikalischer Effekt
Roboter
Typprüfung
Twitter <Softwareplattform>
Statistische Analyse
Red Hat
Vorlesung/Konferenz
Softwareentwickler
Gruppenkeim
Physikalisches System
Baum <Mathematik>
Physikalische Theorie
Computeranimation
Programmiersprache
Lineares Funktional
Konstruktor <Informatik>
Datentyp
Kategorie <Mathematik>
Regulärer Ausdruck
Computer
Schlussregel
Physikalisches System
Variable
Computeranimation
Metropolitan area network
Systemprogrammierung
Variable
Arithmetischer Ausdruck
Modul <Datentyp>
Menge
Geschlossenes System
Flächentheorie
Eigentliche Abbildung
Datentyp
Modelltheorie
Optimierung
Typsystem
Programmiersprache
Fundamentalsatz der Algebra
Bit
Folge <Mathematik>
Vektorpotenzial
Typentheorie
Datentyp
Mathematisierung
Rechenzeit
Oval
Vektorpotenzial
Physikalisches System
Computeranimation
Arithmetisches Mittel
Systemprogrammierung
Fundamentalsatz der Algebra
Typprüfung
Bit
Datentyp
Vorlesung/Konferenz
Identifizierbarkeit
Modelltheorie
Optimierung
Nebenbedingung
Prozess <Physik>
Gewicht <Mathematik>
Formale Sprache
Mailing-Liste
Quellcode
Physikalisches System
Computeranimation
Arithmetisches Mittel
Geschlossenes System
Datentyp
Mereologie
Instantiierung
Zeichenkette
Programmiersprache
Nichtlinearer Operator
Datentyp
Typprüfung
Singularität <Mathematik>
Formale Sprache
Gruppenkeim
ROM <Informatik>
Hecke-Operator
Mathematische Logik
Computeranimation
Formale Semantik
Service provider
Geschlossenes System
Softwareschwachstelle
Rechter Winkel
Festspeicher
Datentyp
Vorlesung/Konferenz
Einflussgröße
Fehlermeldung
Programmiersprache
Task
Nichtlinearer Operator
Typprüfung
Verbandstheorie
Browser
Güte der Anpassung
Formale Sprache
Computeranimation
Übergang
Quarkmodell
Programmiersprache
Puffer <Netzplantechnik>
Geschlossenes System
Computersicherheit
Browser
Datentyp
Projektive Ebene
Computeranimation
Kernel <Informatik>
Soundverarbeitung
Magnetbandlaufwerk
Formale Grammatik
Caching
Typprüfung
Datentyp
Sechsecknetz
Übergang
Computeranimation
Variable
Bildschirmmaske
Code
Datentyp
Vorlesung/Konferenz
Caching
Formale Grammatik
Magnetbandlaufwerk
Datentyp
Applet
Versionsverwaltung
Formale Grammatik
Applet
Übergang
Quellcode
Computeranimation
Programmfehler
Bildschirmmaske
Bildschirmmaske
Bereichsschätzung
Geschlossenes System
Code
Datentyp
Dreiecksfreier Graph
Optimierung
Softwareentwickler
Magnetbandlaufwerk
Datentyp
Typprüfung
Prozess <Physik>
Inferenz <Künstliche Intelligenz>
Formale Sprache
Rechenzeit
Iteration
Applet
Objekt <Kategorie>
Geschlecht <Mathematik>
Mereologie
Datentyp
Vorlesung/Konferenz
Optimierung
Datentyp
Algebraisch abgeschlossener Körper
Diskretes System
Compiler
Template
Formale Sprache
Interpretierer
Code
Service provider
Computeranimation
Last
Typprüfung
Code
Datentyp
Compiler
Phasenumwandlung
Instantiierung
Zentrische Streckung
Datentyp
Prozess <Physik>
Web log
Algebraisch abgeschlossener Körper
Diskretes System
Template
Schaltnetz
sinc-Funktion
Formale Sprache
Applet
Zahlenbereich
Oval
Physikalisches System
Computeranimation
Portscanner
Variable
Datentyp
Softwareentwickler
Softwaretest
Hydrostatik
Typprüfung
Geschlossenes System
Formale Sprache
Datentyp
Baum <Mathematik>
Computeranimation
Internetworking
Datentyp
Geschlossenes System
Formale Sprache
Datentyp
Mereologie
Zahlenbereich
Computeranimation
Softwaretest
Druckverlauf
Hypermedia
Zahlenbereich
Computeranimation
Objekt <Kategorie>
Ganze Zahl
Menge
Ganze Zahl
Datentyp
Modelltheorie
Ganze Funktion
Menge
Computeranimation
Ganze Zahl
Datenfeld
Menge
Atomarität <Informatik>
sinc-Funktion
Mailing-Liste
Ganze Funktion
Menge
Computeranimation
Zeichenkette
Parametersystem
Lineares Funktional
Datentyp
Typprüfung
Vervollständigung <Mathematik>
Formale Sprache
Aggregatzustand
Variable
Computeranimation
Hydrostatik
Variable
Funktion <Mathematik>
Code
Parametersystem
Datentyp
Information
Vervollständigung <Mathematik>
Ganze Zahl
Prozessfähigkeit <Qualitätsmanagement>
Objektklasse
Verzeichnisdienst
Personal Area Network
Auswahlaxiom
Computeranimation
Zeichenkette
Instantiierung
Lineares Funktional
Rückkopplung
Datentyp
Klasse <Mathematik>
Quellcode
Objektklasse
Computeranimation
Richtung
Arithmetisches Mittel
Mailing-Liste
Twitter <Softwareplattform>
Geschlossenes System
Prozess <Informatik>
Datentyp
Restklasse
Schätzwert
Fehlererkennungscode
Befehl <Informatik>
Ortsoperator
Elektronischer Programmführer
Desintegration <Mathematik>
NP-hartes Problem
Quellcode
Elektronische Publikation
Punktspektrum
Sigma-Algebra
Ellipse
Variable
Computeranimation
Netzwerktopologie
Code
ATM
Programmbibliothek
Codierung
Modelltheorie
Gerade
Modul
Standardabweichung
Instantiierung
Addition
Metadaten
Lineares Funktional
Datentyp
Funktion <Mathematik>
Pauli-Prinzip
Elektronische Unterschrift
Computeranimation
Parametersystem
Typprüfung
Datentyp
Formale Sprache
Computeranimation
Konfiguration <Informatik>
Hydrostatik
Erweiterte Realität <Informatik>
Geschlossenes System
Zustandsdichte
Datentyp
Programmbibliothek
Vererbungshierarchie
Gammafunktion
Addition
Datentyp
Pauli-Prinzip
Compiler
Elektronische Publikation
Gerade
Computeranimation
Programmfehler
Iteration
Geschlossenes System
Parametersystem
Datentyp
Optimierung
Typsystem
Ganze Funktion
Figurierte Zahl
Leistung <Physik>
Zeichenkette
Fehlermeldung
Addition
Subtraktion
Bildschirmmaske
Datentyp
Pauli-Prinzip
Datentyp
Programmbibliothek
Vorlesung/Konferenz
Baum <Mathematik>
Computeranimation
Konfiguration <Informatik>
Adressierung
Datentyp
Pauli-Prinzip
Formale Sprache
Automorphismus
Baum <Mathematik>
Innerer Punkt
Computeranimation
Aggregatzustand
Magnetbandlaufwerk
Kreisfläche
Datentyp
Pauli-Prinzip
Menge
Computeranimation
Hydrostatik
Ganze Zahl
Menge
Ganze Zahl
Beweistheorie
Optimierung
Aggregatzustand
Softwaretest
Software
Kategorie <Mathematik>
Total <Mathematik>
Schaltnetz
Programmbibliothek
Wiederherstellung <Informatik>
Gruppoid
Statistische Hypothese
Computeranimation
Resultante
Nichtlinearer Operator
Subtraktion
Komponententest
Kategorie <Mathematik>
Menge
Computeranimation
Entscheidungstheorie
Softwaretest
Uniforme Struktur
Einheit <Mathematik>
Menge
Eigentliche Abbildung
Basisvektor
Figurierte Zahl
Instantiierung
Leistung <Physik>
Zeichenkette
Softwaretest
Web Site
Komponententest
Ganze Zahl
Rechter Winkel
Mailing-Liste
Figurierte Zahl
Chi-Quadrat-Verteilung
Statistische Hypothese
Computeranimation
Informationssystem
Umwandlungsenthalpie
Verzerrungstensor
Quellencodierung
Statistische Hypothese
Computeranimation
Softwaretest
Figurierte Zahl
Statistische Hypothese
Computeranimation
Haar-Integral
Analysis
Zeichenkette
Datentyp
Pauli-Prinzip
Hochdruck
Computerunterstütztes Verfahren
Term
Statistische Hypothese
Computeranimation
Programmfehler
Portscanner
Hydrostatik
Systemprogrammierung
Zustandsdichte
Geschlossenes System
Datentyp
Dreiecksfreier Graph
Programmbibliothek
Leistung <Physik>
Softwareentwickler
Leistung <Physik>
Vorlesung/Konferenz
Baum <Mathematik>
Computeranimation
Netzwerktopologie
Hydrostatik
Minimalgrad
Datentyp
Wort <Informatik>
Automatische Differentiation
Baum <Mathematik>
Code
Computeranimation
Computeranimation

Metadaten

Formale Metadaten

Titel Static type-checking is dead, long live static type-checking in Python!
Serientitel EuroPython 2015
Teil 120
Anzahl der Teile 173
Autor Caissy, Jean-Philippe
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
DOI 10.5446/20136
Herausgeber EuroPython
Erscheinungsjahr 2015
Sprache Englisch
Produktionsort Bilbao, Euskadi, Spain

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract Jean-Philippe Caissy - Static type-checking is dead, long live static type-checking in Python! A few months ago, Guido unfolded PEP 484, which was highlighted at PyCon 2015 as a keynote presentation. This proposal would introduce type hints for Python 3.5. While the debate is still roaring and without taking a side, I believe that there is much to learn from static type-checking systems. The purpose of this talk is to introduce ways that could be used to fully take over the amazing power that comes with static types, inside a dynamic type language such as Python. The talk will go over what exactly a static type system is, and what kind of problem it tries to solve. We will also review Guido's proposal of type hinting, and what it could mean to you. Finally, I will present a few libraries that are available, such as Hypothesis or various QuickCheck-inspired library that tries to build more robust tests, how they achieve it and their limitations. Throughout the talk, a lot of examples will used to fully illustrate the ideas being explained. At the end of this talk, you should have a better understanding of the wonderful world of type systems, and what it really means to you. It should help you decide wether using type hints will be helpful to you and also if an external library trying to fuzz your tests has its place inside your project
Schlagwörter EuroPython Conference
EP 2015
EuroPython 2015

Ähnliche Filme

Loading...