 In fact, it's just a joke. It's not about Python, just Java, okay? Now just I'm a little bit stressed and I like to play with the jokes. In French that's better. In English that will be harder. Okay, we are here just about a new feature about Python 3.7, okay? Just that. Not about 2.7 and not about 2.8, okay? We are sure that we will use the last version of Python. What can you say? Oh, an empty side. Sorry. About me. I'm just Stefan. I'm a small contributor of Python of the Python ecosystem. I am a small contributor of EuroPython because I have the badge with organizer. Thank you to be here. And I'm a fellow member of the PSF member of EuroPython society and you can see there's a blah, blah, blah, blah. If you know a movie with Dracula, that's fine. So with Python 3.7, we have some pep to respect, of course, because it's a contract with the new version of Python. The first one is just the awesome break point. I'm going to explain that because sometimes when you give a technical training to some newbies, they want to know how to debug with Python. With PyCharm or maybe with Atom or whatever. In this case, we have a new built-in function for that. I'm going to explain about the data classes. I don't want to go into details about this project, but I'm going to give you an overview. Mainly how to define the get out here and the tier method for a new module and we will see some other stuff. And the most important is maybe the break point for the first point. So the break point, when you want to start to debug your software, usually you have this kind of code. I know that the code will give this kind of error. Just divide by zero is just forbidden. If I would like to debug it, I have two solutions. Firstly I'm going to use the print function. Yeah, why not? Yes. Now we could use the debugger keyword from JavaScript. No? No. No. No. No. I'm not with JavaScript. Just with Python. And with Python, we can have a lot of debuggers. Okay? We have PDB. I'm going to start with the first one. PDB. PUDB. IPDB. PDBPP. Etadadadadada. Okay? Do you understand? When you start to learn Python, there is a problem. Which debugger can I use? In this case, that's very difficult. For that, there is a new key, a new built-in function. Just, no, not PDB, it's a trace, but this one. Or not this one. Just break point. Okay? So when you will start to use the debugger, when you start Python for the kids, you have this one. PDB. Okay? PDB is really ugly, but functional. We don't have any problem with this one. We can find a bug really easily with this one. Okay? But if you like to have an uncured interface, you can use PUDB. Okay? With the new keyword, new function, break point, you can define your debugger on the command line. Just after. Firstly, with the break point, you have some, you have an environment variable, sorry, from English, but where you can specify your debugger on the command line. The first one, if you don't specify something, it's just PDB. Okay? We have an example just here. Okay? If you want to specify PUDB, you could use this command line. Okay? And if you want to use Ipyton with your project, because you like Ipyton and the magic stuff of Ipyton, you can use that. Okay? So, there is an interesting thing with the break point, with this new function. If you don't specify the break point on the command line, just with break point is equal to zero, we will disable everything, all the debugging session. Okay? In this case, you could execute your script without the debugger. Yes? I'm not sure. Okay. So, and of course, sometimes you can use the print function if you prefer, because we like the print function. Okay? So, it's just the first new feature of Python 3.7. Not really funny, but I like to use it just with the newbies, because sometimes... I'm sorry, sir, but which debugger can we use? This one. Okay? Next point. About the data classes. Who knows the data classes? Great. Yes, you are a co-developer, of course. So, the data classes. What is a data classes? A data class. Who wants to represent a user or just a person or an account? Usually, we can use the name tuple. We could use the tuple or just a dictionary or maybe just a class. Okay? But sometimes that's really difficult to explain to a new person why I need to have a very big class. For example, I'm going to explain. I'm going to give this example just with a tuple. I'm going to represent a person with this tuple. Welcome. It's my first name and last name and my age. Sorry. I'm not younger. And the problem with a tuple, we don't know if this index is the first name, the last name, or the age. Okay? We could use the dict. Okay. We changed just the form. We used the dict, first name, last name and age. We can use for that the attribute, not the attribute but the name with the dictionary. But for me, I prefer to use just the dot notation, person dot first name. Okay? We could use the collection name tuple. That's the same thing. We can use it with a tuple. We can define the parameter and we have the dot notation. Okay? I have a mix between the tuple and maybe a class. But it's not very perfect. Because in this case, we don't specify the tip of the variable. We cannot override it. There is no default values for this one. So in this case, maybe we could use a simple class. Okay? There is a Java developer here. Yes. Just one. I'm sorry for you. Two. Okay. Now, when you want to develop one class for an object, just you have to define the properties and the method, etc. And the rest. Okay? And we can have this kind of code. That's very boring and really verbose. And for that, Python can be a better choice for that. Okay? So in this case, we have the person with the constructor. I'm going to give some parameters. I'm going to give this parameter to the instance. I'll have a representation with a string. Just a method for the quality where I'm going to test the first name, last name, and the edge. And maybe if I would like to make a comparison, the LT. Okay? So, but I would like to replace that with another thing. Just the data classes. This case. Before. After. Before. After. For the next Java developer, you can come. We have a lot of jobs for you. That's really easy with Python. Because in fact, we don't need to improve the interpreter. It's just a new class, a new function in the standard library. And from that, we will create a new function for this class. Okay? So, with this code, I have the same result. But I can define the kind, the tip of the name, our latitude, our longitude, the default value with the name tuple, with a tuple, with a dict. I cannot do that. Here, in five lines, I have the result. Okay? So, of course, with the data classes, I could define a new method, or just a new property. In this case, I'm going to define the full name, my full name, with a representation. And I can use it like a normal class. Okay? Of course, with the data classes, we can define some, we have some properties, options. And when we use the decorator, for example, we have init, just here. This one will create the init function, the constructor of the class. If this one does not exist. That will be the same for rep, equal, order, and frozen. If you know the frozen set, you will have the same result. And in fact, the frozen is just for the name tuple, because the name tuple is just in read-only mode. So, for example, where I'm going to specify keyword, parameter, just here. And I'm going to have an exception when I try to assign a new value to my edge. Okay? And of course, with the data classes, I can try to work with the inheritance. I can create a person. And I can iterate from this person and create a new user class. Can we do that with the name tuple? No. With the tuple? No. With the dictionary? No. Welcome to this new feature. It's just the data classes. Okay? The next point is just, for example, you are developing a new feature, or a new function. And in your source code, you have some deprecated functions. Okay? With this kind of code, I'm going to check if I have a function in the deprecated list, this one, alt function. And if my function is deprecated, I'm going to execute a warning at the execution at the right time. Just with that. The system, when we will load the library and try to import this function, we will get just a warning, a deprecation warning. Okay? It's a good reason if you want to clear your code, a good tool for that. Okay? So, for the rest, we have the dear function. This one can just change the list of the attributes of a model. It's just a sympathetic for the developer. Okay? And it's just an example. Okay. Another thing, sorry. When you are stressed, you have to drink a lot of water. Who is using the annotation for the type itings? Okay. With the current version of Python, this example is correct or not? No, in French. No. No, signore. In fact, no. It's not the case. Because we will have a problem. Here, we try to define the node class. And this node class will be used just here when we define the type of left and right. And we have a problem because the interpreter has not finished to read the description of the node class. For that, if we try to execute the code, we will get an exception. Just the node is not defined. Yes. Okay. But how can I use my node? Because type itings is really useful. We can use mypy. And I can detect a lot of bugs with the static analyzer. There is a pep for that. Oh. Sorry. But if you want to solve the problem, just use the string annotation. Okay. There is a pep. This pep is the annotation. You can import it from future. And with this import, we can define left as a node, right as a node. In this case, we don't have to define a forward reference. Okay. Because this notation with the string is a forward reference. There is this kind of stuff with C++ and the forward declaration. Okay. So. And if we mix the annotation and the data classes, we can have this result. Just that. Okay. We have an optional node. The default value is just none. And does the same for the right. Right attribute. Okay. Another point. Who likes or loves to make some benchmarks with Python? There is a scientist here. Yeah. No, no. Yes. Of course. I'm going to present you the master of the performance of Python. It's just here. Victor. And in fact, it has found a problem with Python. With the current implementation of the time module, we have a problem. Because the current time module used the float system, the float type just for the representation of the number when we need some seconds or milliseconds. And because we used the float, we have a limitation. This limitation is just for 104 days. After that, you will have a problem with the precision. Okay. In this example, the first example came from Victor. It's just about the benchmark of Python. When you call a function, sometimes this call can take less than 100 nanoseconds. And for that, I started to write this new PEP and introduce new function where you can work at the nanosecond level. Okay. This example is just with the normal monotonic function where we can see the float. And with the nanosecond resolution, we have a Python integer and you have all the information about that. Okay. So the next point is just about the deprecation warning. Just before, when we have an exception, we can raise a deprecation warning. There was a problem since the last version, but since the version 3.2. In fact, by default, deprecation warning was hidden by default. With the new version of Python, 3.7, we will show the deprecation warning in the main namespace. Just that. And for the rest, for the future warning and the pending deprecation warning, we will show them in the test. Okay. Just that. So the next point. Sorry. There is a lot of next point. That's very difficult. The pep is very long. And I have to read a lot of peps and try to make a small synthesis of that is very difficult. For example, the context variable is really useful for us, for the developer using the asynchronous development. Because, for example, when we use a website, when we try to develop a website with Django or Flask or another framework, we will use a thread. And this thread will receive the request. Okay. But there is a problem with the asynchronous environment, because we use only one thread and we have a lot of asynchronous tasks at the same time. For that, we have a new module, the context var. This context var will provide the context object and the context var object. The context will be associated to the OS thread and the context var will contain the value of the context, for the context, for the current context. In this example, I create just a context var with a default value. I'm going to set the value and just read before. And I'm going to execute the main function with a new context. Okay. And if I see the result, the first print will be 42. The second one will be inside spam. Just here. We can see that we have the original value. We can change it with set arm. Just here. And when we go outside of the context of the function, we will get the first version of the value. So, when... Okay. Thank you. When can we use that? Maybe when you want to develop an asynchronous web service. Okay? For example. Because with the asynchronous web service, we don't use... We have a lot... We only have one thread and not a lot of thread. And in this case, we will define a new context var, set just a default value, and we can use it just with the reference, current user in this case. Okay? So, with the context variable, you can start to develop an asynchronous software without any problem. Because you don't have the problem with the TLS. For the next thing, it's just about the documentation. With Python 3.7, we have, of course, the documentation in English. Maybe in French, in Japan, and in Korean. With Spanish or Italian, if you want to contribute Chinese, okay, you can become the new contributor of Chinese for the Chinese. Yeah, just that. But, in fact, if we follow the pep of Python 3.7, it's a very funny story for you. Sometimes, we develop some new feature without a pep. It's the case with the dictionary. For example, the new dict in Python 3.7, we guarantee the insertion order. Just that. And it's the lead motif of Guido. Big-keep insertion order. Yeah, good. I think, in a way, our keywords, that was not the case before. There was a deprecation warning. No, it's a keyword. If you want to migrate your code to Python 3.7, don't forget to change the name of your variable or function. Just that. Okay, stop. You cannot do that. Sorry for you. If you have one million on the line of code, that's for you, not for me. Sorry. No, I am in the same case. And we cannot do that. Therefore, wait. Sorry. So, yes. With Python 3.7, we have some improvements about Async.io. Who likes to use Async.io? One, two, three, four. Yes, 10. Yes, good. We see that we can continue to work on Async.io. Okay. When you want to use Async.io, you have to define an event loop. Okay? With this event loop, you will run until the creating is just finished. And after that, you will close the loop. Since the new version of Python 3.7, instead of that, just done. Async.io run. Sorry. Two years for dysfunction. It's two years. Yeah. If Async.io, we have some new function, create task, how to create a task, it's just a shortcut to the create task of the loop. We can start a TLS connection. For example, you are with an insecure connection. You can start a TLS connection. You can get the current task. You can have all the tasks from the loop. And if you want, if you like to send some mail or some files from the web server to your customer, you can use the SockSend file. This function will use the kernel. Linux in this case. About the performance. We can see that the get-up and loop has been completely rewritten in C, just for the performance. More or less 15 times faster. There's a case for the get-er function, the sleep function and the feature because feature has been improved. We have some new function on the command line. For example, if you want to know if your import is just slow and wide, you can use X import time. You will have a profiling of your import. Yeah. This new parameter is just if you want to use Python in UTF-8 because in some case, on Windows, Linux, Python will use the local of the current system. And sometimes we can have some problem. With this parameter on the command line, we will force Python to use UTF-8. Okay? Another thing, if you are a developer of Python and if you want to have a very big dump of your stack trace, thank you, you can use Python X and Dev. This one will enable the debug model of a sync.io. We'll use the FortanLir module just for the dump because we like to have a very big dump of a crash and install some debug hooks for the memory allocation. So, for the rest, and after that I'm going to finish in five minutes, maybe. Do you like to load your data from your packages with a package resource? Just one. Yes, good. Okay, there is a new function, a new module, resources. Resources is just the same behavior as the previous, but with the performance and without the bullshit. Okay? In fact, just, I would like to be clean, but package resource like to do a lot of useless stuff. Okay? With resources, in fact, there is a very big improvement about the performances and now we can read a file from the file system, a zip file from the network or whatever. Okay? A small example, I have my package. I would like to read this file, message.em. With the standard library, I could do that. Try to find the directory of the project and the directory of the data. Try to make the path for the message and read the file. Okay? Or with the path, we can do that. With import-lib resources, in two lines, just one line, the second one is just for the import, but with one line, you can load the binary file from your package or from your zip file or whatever. You can do that with a context manager if you want to play with the reference to the file. And if you don't like this form with the string, you can use just your module. Import your module and you want to get a file from your module. You can do it. So, of course, we have many improvements and bugfaces in Python, 2.7, and Python is faster than the last version, of course. Conclusion. I think that Python 3.7 is a great vintage. And, yeah, just that. Thank you. Do you have any question? No. Yeah, is there any question? Please stand out and come here. No. What about Python? Sir, please come up. Victor, are you ready? Hi, thanks for your presentation. A question. When is the case to use an image tuple or a data class? For example, are the performance the same if you're in the case of read-only? Yeah, I understand your question. In the case of read-only, thanks. OK. In fact, we don't use, usually, we don't like to use a class and we prefer to use just a tuple because a tuple is just more efficient. OK. But then there is a problem. You don't have the notation, the dot notation. You cannot know in the tuple the position correspond which element. You don't know that. But with the data classes, you have this result. And now, if you have a problem about the performance, you can use a slot with the data classes. Just specify underscore underscore slot and you give your fields. Just that. No more, no less. And you will get the same result. Maybe it will be slower, but it's not significant. OK. Welcome. No other question about Python 3 or 4.0? No? No? Or Java? No? OK. Yeah. I confirm it's just a Python, not Euro or Java. OK. Thank you. Thank you again.