1 00:00:00,410 --> 00:00:03,010 The edition that I think I'm the most excited about 2 00:00:03,010 --> 00:00:04,990 is the new format in string literals. 3 00:00:04,990 --> 00:00:08,280 You've probably use this string method format to put some external data into 4 00:00:08,280 --> 00:00:09,098 a string, right? 5 00:00:09,098 --> 00:00:14,231 Something like this, name = "Kenneth" and then print, 6 00:00:14,231 --> 00:00:21,260 "Hello, my name is, and then a placeholder, and then format name, right? 7 00:00:21,260 --> 00:00:23,910 You've done something like this, and this works. 8 00:00:23,910 --> 00:00:30,475 And it also works for simple Python statements, so like 2 + 2 = something, 9 00:00:30,475 --> 00:00:34,855 we format that with 2 + 2, and we get 2 + 2 = 4. 10 00:00:34,855 --> 00:00:40,140 So this is such a common scenario that they've put a shortcut into the language. 11 00:00:40,140 --> 00:00:42,670 So now you can skip the entire format call. 12 00:00:42,670 --> 00:00:45,080 And you can use the new F marker for strings, 13 00:00:45,080 --> 00:00:48,640 kinda like how we use R for raw strings. 14 00:00:48,640 --> 00:00:54,321 So we would do print(f"Hello, my name is name"), 15 00:00:54,321 --> 00:00:58,280 and we get hello, my name is Kenneth. 16 00:00:58,280 --> 00:01:01,890 So it brings the name variable that's in the current scope, 17 00:01:01,890 --> 00:01:05,090 which was defined up here, and it puts it into the string. 18 00:01:05,090 --> 00:01:11,282 We can also do this with simple statements like before, so print f"2 + 2 = 2 + 2 and 19 00:01:11,282 --> 00:01:16,721 we get 2 + 2 = 4, and while we're talking about presentational things, 20 00:01:16,721 --> 00:01:19,902 if you regularly have to code large numbers, 21 00:01:19,902 --> 00:01:24,830 the addition of underscores to numbers makes them a little easier. 22 00:01:24,830 --> 00:01:26,374 So you can do like 1. 23 00:01:27,580 --> 00:01:29,474 So a 1_000_000 times 10. 24 00:01:29,474 --> 00:01:32,180 And you get the new number. 25 00:01:32,180 --> 00:01:36,000 Python will just ignore the underscores and sees this as a million times 10. 26 00:01:36,000 --> 00:01:38,110 This changes purely cosmetic, but 27 00:01:38,110 --> 00:01:41,400 it will definitely help anyone who has to type out long numbers. 28 00:01:41,400 --> 00:01:43,500 Granted, that's not something you have to do very often, but 29 00:01:43,500 --> 00:01:46,760 if you're doing scientific Python, if you're doing like stuff at NumPy or 30 00:01:46,760 --> 00:01:49,500 SciPy, you may find this more useful. 31 00:01:49,500 --> 00:01:52,420 I do believe it's actually been in those for a little while. 32 00:01:52,420 --> 00:01:55,900 If you've been using Python 3's function annotation abilities or 33 00:01:55,900 --> 00:01:57,390 Python 3.5's typing module, 34 00:01:57,390 --> 00:02:00,970 you'll be happy to know that variable annotation has come to Python. 35 00:02:00,970 --> 00:02:03,666 We swap over here to PyCharm, and we'll talk about this. 36 00:02:03,666 --> 00:02:07,359 So now, if you have a type checker set up like the one that's installed by default 37 00:02:07,359 --> 00:02:10,781 in PyCharm, you can annotate variables as being of a particular type, and 38 00:02:10,781 --> 00:02:14,640 then you get some handy user information when you want to use them later. 39 00:02:14,640 --> 00:02:17,420 So like we can say that age is an int, and 40 00:02:17,420 --> 00:02:22,840 then we can set it to a default value of like 35, and so now if I do like age., and 41 00:02:22,840 --> 00:02:27,602 I've got my normal age strings. 42 00:02:27,602 --> 00:02:31,420 Now, PyCharm can infer that from the variable that was set before but you'll 43 00:02:31,420 --> 00:02:34,630 also see things like, if you're trying to use this variable and you're trying to 44 00:02:34,630 --> 00:02:38,390 use it in a way that's not compatible with an int, you can get error messages. 45 00:02:39,390 --> 00:02:42,960 All of these changes, well, minor, definitely make working with strings and 46 00:02:42,960 --> 00:02:44,675 big numbers nicer in Python. 47 00:02:44,675 --> 00:02:47,610 And I've already found myself using the f-strings constantly, 48 00:02:47,610 --> 00:02:49,280 I'm sure you will too. 49 00:02:49,280 --> 00:02:52,960 The variable typing will definitely make a big impact on larger code bases too.