Some New Features in Python 3.9

In this video I go over four new features in Python 3.9: new syntax for merging/updating dicts, native timezone support, the use of collection classes as opposed to the typing model for type support, and removeprefix and removesuffix method for strings.
Need one-on-one help with your project? I can help through my coaching program. Learn more here: prettyprinted.com/coaching
docs.python.org/release/3.9.0...
Get the code here: prettyprinted.com/l/wOS
00:00 - Intro
00:22 - Dict Merge/Update
03:33 - Native Timezones
06:22 - Collection Type Hints
08:48 - str.removeprefix
Twitter: / pretty_printed
Github: github.com/prettyprinted

Пікірлер: 217

  • @Raserei408
    @Raserei4083 жыл бұрын

    EDIT: I am wrong. "b = b | a" is different from "b |= a" and "b |= a" is effectively identical to b.update(a) except that it returns b rather than None. ~Worth a mention that "b |= a" does *not* do the same thing as "b.update(a)". update modifies b, whereas |= creates a new dict and assigns b to it. If you had another variable c referencing the same dict as b, update would cause c to change but |= wouldn't.~

  • @rjhornsby

    @rjhornsby

    3 жыл бұрын

    yeah ... when he was walking through the examples, I kept wondering what was happening w/r/t returning a new object vs modifying the existing object in place vs, as you point out - creating a new object and assigning it to one of the existing vars. I can see the usefulness, but the language syntax is making it tough to quickly assess if the result is what one intends - creating new, clobbering old etc.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    Uhh, no. Have you actually tried it? |= uses __ior__(), or "in-place or". It is NOT a syntactic sugar for b = b | a.

  • @Raserei408

    @Raserei408

    3 жыл бұрын

    @@PanduPoluan Woah. Wild. I read the PEP to confirm, and I got misdirected by the motivation for the non in-place union.

  • @Dani0x1B

    @Dani0x1B

    3 жыл бұрын

    @@Raserei408 Yeah, python likes to break the "(a $= b) ≡ (a = a $ b)" for some reason. it's the same with += in lists, it does a concat _and modifies the original_.

  • @TheVoitel

    @TheVoitel

    3 жыл бұрын

    No! op= asignments work in place (as longs as it’s possible), because that is the actual meaning of these assignments!

  • @koktszfung
    @koktszfung3 жыл бұрын

    this is the first time I hear someone pronounce "str" as "stir" instead of "string"

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I say 'stir' when talking about the str class and string when talking about what str classes represent. Can be confusing

  • @pvic6959

    @pvic6959

    3 жыл бұрын

    @@prettyprinted to be fair I say "stir" in my mind lol. but then again my professor pronounced char as "chir" lol

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    @@prettyprinted I do it the same time, actually. Also, I pronounce "JSON" as "J'sown" not "Jason", because JSON is clearly a Klingon name not a US/UK name...

  • @TheSpacecraftX
    @TheSpacecraftX3 жыл бұрын

    Timezones natively without libraries is a biggie.

  • @THEAAKASH07

    @THEAAKASH07

    3 жыл бұрын

    @O. R.C it's from dateutil.tz import tz

  • @Codethier
    @Codethier3 жыл бұрын

    I'm so glad i found your youtube channel i watched your ultimate flask tutorial on packt and it was amazing!

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Glad you liked it!

  • @sim4n6
    @sim4n63 жыл бұрын

    Please keep up such a great work for each new version.

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Thanks for watching!

  • @pele512
    @pele5123 жыл бұрын

    The dict update is a nice and consistent syntactic sugar matching what set() was able to do in 3.7 already, neat!

  • @sundarrajan2575
    @sundarrajan25753 жыл бұрын

    removeprefix gonna be really useful. Thanks for the quick review 😊

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    You're welcome! Thanks for watching.

  • @ekmin2469
    @ekmin24693 жыл бұрын

    This is really good and easy to understand. Nice video

  • @vladislavyurkov9221
    @vladislavyurkov92213 жыл бұрын

    Respect for using Star Trek doctors in doctor's list!😄

  • @SurajTiwari020

    @SurajTiwari020

    3 жыл бұрын

    Could be the doctor from Doctor Who too

  • @vladislavyurkov9221

    @vladislavyurkov9221

    3 жыл бұрын

    @@SurajTiwari020 I think it's The Doctor from Star Trek Voyager. They named this character the same way😅

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    All Star Trek doctors :)

  • @SurajTiwari020

    @SurajTiwari020

    3 жыл бұрын

    Well I've figure it out... that's me... I'm The Doctor.... 😂 😂 😂

  • @emilianovillarreal1744

    @emilianovillarreal1744

    3 жыл бұрын

    has

  • @Dht1kna
    @Dht1kna3 жыл бұрын

    Lot of times when I wished there was a standard library function str.removeprefix/sufix

  • @nastygambler2522
    @nastygambler25223 жыл бұрын

    You helped me a lot. Thank you

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    You're welcome!

  • @snoopyjc
    @snoopyjc3 жыл бұрын

    Yes it’s long overdue having to use a separate pytz module, though you would think they would just fix or extend datetime.timezone!

  • @el_munoz
    @el_munoz3 жыл бұрын

    str.removepreffix sounds usefull to remove file extensions in a list comprehension to rename a bunch of files. And dict union share the same sintax as sets keeping the language logic.

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I didn't think about file extensions. removesuffix does sound great for that. Thanks for watching!

  • @josemariasosaresendiz8286

    @josemariasosaresendiz8286

    3 жыл бұрын

    @@prettyprinted Why adding redundant methods if you can already use .strip(), rstrip() and lstrip() ??

  • @beron_the_colossus

    @beron_the_colossus

    3 жыл бұрын

    @@josemariasosaresendiz8286 >>> drs = ["Dr. Coomer", "Drake", "The Doctor"] >>> names = [dr.lstrip("Dr. ") for dr in drs] >>> names ['Coomer', 'ake', 'The Doctor']

  • @sadhlife

    @sadhlife

    3 жыл бұрын

    @@josemariasosaresendiz8286 lstrip actually removes a set of characters, not a string prefix, and if you confuse what it does you can get some nasty bugs

  • @raphael7308

    @raphael7308

    3 жыл бұрын

    @@beron_the_colossus This confused me too. This explains it: www.python.org/dev/peps/pep-0616/#id16

  • @user-to1lb6dj6g
    @user-to1lb6dj6g3 жыл бұрын

    PEP8: Method Names and Instance Variables Use the function naming rules: lowercase with words separated by underscores as necessary to improve readability. Python 3.9: str.removeprefix BOOOOOM!

  • @islandcave8738
    @islandcave87383 жыл бұрын

    I have long used `a.split(b, 1)[-1]` to remove the prefix b from a in 1 line and `a.rsplit(b, 1)[0]` to remove the postfix b from a in 1 line. But remove prefix and remove postfix seems cleaner.

  • @EvanOfTheDarkness
    @EvanOfTheDarkness3 жыл бұрын

    Nice. I can finally stop re-implementing the removeprefix, and removesuffix functions in every python program! Now if they would just fix the input and output streams, so you don't need to reopen them with errors="replace" every time, that would really make my day!

  • @julienpiccini440
    @julienpiccini4403 жыл бұрын

    Thanks for the quick overview. Removing typing import is moving python as typed language more and more. Maybe we will be able to see performance improvement from that. What do you think ? The dictionary is not that great from my point of view as something already existed for this and using update is more pythonic.

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I don't think the typing stuff will have any effect on performance since it's not evaluated. Thanks for watching!

  • @anirangoncalvesbr
    @anirangoncalvesbr3 жыл бұрын

    I just can't see what's the point bringing these new operators for functions already well established... Now we have two ways to perform the same functionality. Python used to be simple. There should be one-- and preferably only one --obvious way to do it Edit: Just to be clear the other changes are fine, I see myself making use of new String methods and maybe the new "timezone" lib.

  • @StanislavSchmidt1

    @StanislavSchmidt1

    3 жыл бұрын

    These logical operators already existed for sets. If one thinks of dictionaries as sets of keys then it seems silly that python didn't have these operators for dictionaries in the first place.

  • @MrCreeper20k

    @MrCreeper20k

    3 жыл бұрын

    It's also possible they may be planning to phase out, older, less intuitive, and less pythonic notation. I can't know for sure, but I think the best way to go about that is to release cleaner notation that everyone switches over to, and then later down the line announce the plan to deprecate old notation.

  • @justins.2138
    @justins.21383 жыл бұрын

    Thanks!

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    You're welcome!

  • @akashdarji7131
    @akashdarji71313 жыл бұрын

    removePreFix() - on video time 11:20, you can also remove 2nd lines (names = []) lists

  • @toequantumspace
    @toequantumspace3 жыл бұрын

    Thanks good job! Do you plan to cover new decorators?

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I didn't look into them much because I couldn't think of a use case. I'll take a second look eventually though.

  • @ashtongrist
    @ashtongrist3 жыл бұрын

    are you asking us questions or did you learn that inflection at youtube presenting school?

  • @ueyehdvdhoqlkdnbdggd
    @ueyehdvdhoqlkdnbdggd3 жыл бұрын

    Great vid. I just don’t see myself merging dictionaries, but it looks easier than previous versions

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I agree. Thanks for watching!

  • @seidenada526

    @seidenada526

    3 жыл бұрын

    I feel the need to merge dictionaries came from the javascript community 👀

  • @mattmess1221
    @mattmess12213 жыл бұрын

    With the union operator (|), I'm hoping they end up allowing that for the Type classes. That way I can do str | int instead of Union[str, int]

  • @ewenlbh

    @ewenlbh

    3 жыл бұрын

    This is planned for the next version (1.10): www.python.org/dev/peps/pep-0604/, and has already been successfully implemented and merged for cpython on github, see pull #21515: github.com/python/cpython/pull/21515

  • @nel_tu_

    @nel_tu_

    3 жыл бұрын

    @@ewenlbh did you mean 3.10 or am i missing sth?

  • @TommiSvaerd
    @TommiSvaerd3 жыл бұрын

    Great summary! I'm excited about typing, though i like that python is dynamically typed it's always a relief to have the option of types, its the same reason i prefer typescript over vanilla js. Will this make linting be available in VSCode?

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I don't use linting in VS Code, but I'm sure there's some kind of type linter out there somewhere.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    It's already in VSCode for some time. Install both Microsoft's "Python" extension (ms-python.python) and Microsoft's "Pylance" extension (ms-python.vscode-pylance)

  • @lawrencedoliveiro9104
    @lawrencedoliveiro91043 жыл бұрын

    Which is your favourite new feature? I was taken by the fact that the http module now includes the “418 IM_A_TEAPOT” status code. ;) docs.python.org/3/whatsnew/3.9.html

  • @dexboi
    @dexboi3 жыл бұрын

    dude can i get tensorflow for python 3.9 (link)

  • @thorvaldresearch1093
    @thorvaldresearch10933 жыл бұрын

    Id say the timezone stuff is the one thats good and long awaited. The rest i probably wont use that much.

  • @semihaksoy8182
    @semihaksoy81823 жыл бұрын

    Is it better to download older versions such as 3.7 or 3.8? Because I think some of the modules and frameworks will not be valid for 3.9 version? Please answer...

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    The new versions only add features to the language, so they shouldn't break anything. But if you're working on an existing project, it might make sense to not upgrade unless you have to.

  • @9SMTM6

    @9SMTM6

    3 жыл бұрын

    Typically the versioning is supposed to give you indications what you can update and what not. The rule ("semantic versioning") is that a version is written like this x.y.z with the names major.minor.patch A patch is supposed to introduce only fixes. A minor update will bring new features but will work with older versions just fine. Only a major update will bring potentially "breaking" changes (=changes that will stop code from working as intended). Which means if any software packet or language follows these rules you can always upgrade from 3.x to 3.y if y>=x.

  • @user-hk3ej4hk7m
    @user-hk3ej4hk7m3 жыл бұрын

    I would like to point out that the dict unpacking method, like the pipe operator, does not modify any of the dictionaries, instead you get a new dict with the merged contents. The update method modifies one of the dictionaries, this might not be what you want.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    Well, there's a reason why "augmented assignments" are also called "in-place operations"...

  • @armandgamingchannel7783
    @armandgamingchannel77833 жыл бұрын

    no longer need stack over flow?

  • @rasmusnordstrom9947
    @rasmusnordstrom99473 жыл бұрын

    What's the difference between str.removeprefix and str.lstrip? names = [doctor.lstrip("Dr. ") for doctor in doctors] will give you the same result. Also why doesn't str.removeprefix follow PEP8? Shouldn't it be str.remove_prefix ?

  • @sexwax4191

    @sexwax4191

    3 жыл бұрын

    lstrip removes a set of character not a fixed string. Look at the comments to Luis Munozs comment for an example.

  • @hossamashraf4885
    @hossamashraf48853 жыл бұрын

    Thx

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Thanks for watching!

  • @Alche_mist
    @Alche_mist3 жыл бұрын

    As I'm on Anaconda with its latency behind Python versions (i.e. I'm still working with Python 3.7), I'll probably build 'removepreffix' and 'removesuffix' into my collection of personal helper functions. Those seem too valuable not to have there.

  • @davidjohnston4240
    @davidjohnston42403 жыл бұрын

    The str changes and dictionary merging will be nice. I do a lot of that and it's always fiddly code. Timezones are not so relevant to me but I'm sure others will find it useful. I saw there was greater flexibility with decorators too.

  • @SuperMarkusparkus

    @SuperMarkusparkus

    3 жыл бұрын

    "Timezones are not so relevant to me but I'm sure others will find it useful" Yes it can be useful from time to time.

  • @rangabharath4253
    @rangabharath42533 жыл бұрын

    awesome

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Thanks for watching!

  • @x0rn312
    @x0rn3123 жыл бұрын

    I LOVE the Star Trek reference!

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I was hoping someone would notice. Thanks for watching!

  • @user-gt2th3wz9c

    @user-gt2th3wz9c

    3 жыл бұрын

    ...

  • @TheVoitel
    @TheVoitel3 жыл бұрын

    I do not really like the disjunction thing. Sets use disjuction for union, as it’s basically the same thing. But for dictionaries, well, one would expect | to be commutative. So doing a | b when needed might be useful, but instead of a |= b it still makes more sense to use a.update(b), since the latter clearly states the direction and the intent. The removeprefix stuff ... Well, it’s nice addition, but often you could just use lstrip for that.

  • @AlexanderYap
    @AlexanderYap3 жыл бұрын

    So str.removeprefix does the same thing as re.sub('^Dr ','', str) ?

  • @ImWatchinYou

    @ImWatchinYou

    3 жыл бұрын

    Yup, I hate it when they put in stupid functions already handled by better solutions

  • @Pimarko

    @Pimarko

    3 жыл бұрын

    Except you dont need to include regex and easier for the eyes. Also you cant mess it up by accidently leaving the '^' from the start of the pattern. Probably less efficient also to use regex. There are already a lot of string based functions that can be solved with regex.

  • @nowhereman5956

    @nowhereman5956

    3 жыл бұрын

    finishes it without importing re and makes the language more newbie friendly

  • @AlexanderYap

    @AlexanderYap

    3 жыл бұрын

    The example given of removing titles from names is bad... how will this be used to remove other titles like Mr, Ms in addition to Dr? Just a big chain of if str.startswith()...

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    The difference is that "str.removeprefix" accepts the prefix as-is; if you use re.sub you must escape the special characters. Easy to do if the pattern is a literal, but hellish if the pattern is dynamic. A contrived example: If the prefix to remove is "1.*", then you'll going to bork the whole string unless you take good care of escaping the "." and the "*". Again, doable if it's a literal, but if the process gets the prefix from another place (say, read from a file), then you need to put that in consideration.

  • @prathameshpatkar4172
    @prathameshpatkar41723 жыл бұрын

    Heyy , 👋👋👋 Please make video about "Flask- pjax" We are waiting bro .

  • @mikeberger1688
    @mikeberger16882 жыл бұрын

    I upgraded from 3.7 to 3.9 and have some tkinter widget placement issues. Has anyone else out there?

  • @_a_x_s_
    @_a_x_s_3 жыл бұрын

    Well, time flies... I learnt Python from 2.5. Now I am using Python 2.7 and 3.7 but the latest version has become 3.9... Python is not like what I have learnt at first. I can even see the attempt to make Python strong-typed. (Probably we can make a declaration at the beginning of the script to make it strong-typed?) However, I just want dev team to enhance the performance of Python so that I do not have to learn more and more new languages like Rust, Swift, Go, Julia, etc.

  • @anventia
    @anventia3 жыл бұрын

    Wait for str.removeprefix would that be the same as doing str.replace("Dr. ", "")? I guess this can be useful for only removing it if its a prefix/suffix, and keeping it if its in the middle of the str.

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Yeah it will ignore anything in the middle.

  • @danielschmider5069
    @danielschmider50693 жыл бұрын

    What comes after 3.9? 4.0? 3.10? 3.91?

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    3.10

  • @rosebae8171
    @rosebae81713 жыл бұрын

    I have python 3.7 and now I want to install Python 3.9 (the new one). So, should I uninstalled my last python first then I install 3.9?

  • @MrCreeper20k

    @MrCreeper20k

    3 жыл бұрын

    managing python versions is an absolute pain. My recommendation is to invest a little bit of time installing miniconda and learning a couple of its commands and how its environments work. It lets you cleanly keep and manage different python environments. That way, if you install libraries, they only install onto the environment you choose. You can also easily choose your python version through there. Unfortunately, miniconda might be a little slow to add the new 3.9 version to its available python versions, so they might not have it just yet.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    If you're using Windows, you can simply install 3.9 in a different directory, and edit your PATH. On Linux, you'll be limited to whatever package is provided by your distro's maintainer; best to use the "pyenv" tool.

  • @paborlouise319
    @paborlouise3193 жыл бұрын

    All are great, but the last one(4) would be more useful.

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I agree it would be useful in a bunch of situations. Thanks for watching!

  • @vaneakatok
    @vaneakatok3 жыл бұрын

    it would have been cool if we had a list or set as an argument for remove prefix or suffix function that goes into the direction of regex

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Yeah that would have been a good addition.

  • @novaria

    @novaria

    3 жыл бұрын

    Or a sibling function removeprefixes([])

  • @aka5

    @aka5

    3 жыл бұрын

    in all fairness, it already makes it so much easier to make your own implementation of that

  • @novaria

    @novaria

    3 жыл бұрын

    @@aka5 not the point here. Having stuff like this embedded in the language itself is what would be cool. Of course it's easy to write it yourself but do you wanna copypasta that code snippet around your projects or import it from a custom library you've built? See my point?

  • @aka5

    @aka5

    3 жыл бұрын

    @@novaria yes

  • @trustmub1
    @trustmub13 жыл бұрын

    so removeprefix is an extension function. can we create our own extension functions now in Python?

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I'm not sure what you mean by an extension function, but removeprefix is just a method on the str class.

  • @seidenada526

    @seidenada526

    3 жыл бұрын

    It is technically just another method of the string built-in. It's actually implemented by the interpreter, being faster than a python-land implementation. On another point, I don't believe extension methods will ever be accepted in Python, since it can easily confuse readers about "where this method comes from?"

  • @trustmub1

    @trustmub1

    3 жыл бұрын

    @@prettyprinted just like what Kotlin has where you can extend a class with new functionality, the class being the receiver/type and the methog being the extension.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    @@trustmub1 You cannot add new methods/properties to the `str` class. You can, however, inherit the `str` class and add your own sets of methods.

  • @danielschmider5069
    @danielschmider50693 жыл бұрын

    its kinda weird that 7:38 doesnt find an error, since mylist is still not of type list... is that normal or irrelevant here?

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Types don't get evaluated at all. The exist for external libraries to verify the code.

  • @danielschmider5069

    @danielschmider5069

    3 жыл бұрын

    @@prettyprinted yes, but the verification passes, despite mylist not being a list, but a string?

  • @yeyu8521

    @yeyu8521

    3 жыл бұрын

    @@danielschmider5069 I believe type hinting in python is only for IDE and mypy to ensure a single type for a declared variable, doing def do_print(a: int): print(a) do_print('b') # outputs: b is fine and python can still run it because like Pretty Printed said, in runtime, python don't evaluate data types

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    @@danielschmider5069 "typing" in Python serves only as hints to the user/programmer. Assigning a string to the mylist variable that has been hinted as a list won't cause an error, because Python is not statically-typed. Good IDEs will _warn_ you that "the value you assign to mylist _should_ be a list", but they won't stop you because Python itself doesn't care (the Python interpreter will 100% ignore the hints)

  • @danielschmider5069

    @danielschmider5069

    3 жыл бұрын

    I realize Python doesnt interpret typehints, I'm specifically talking about mypy ignoring it. Is it because the same variable is defined a second time (line 6), ignoring the typehint that was introduced in line 3?

  • @diggzhang
    @diggzhang3 жыл бұрын

    seems like scala?

  • @varunrajkumar2764
    @varunrajkumar27643 жыл бұрын

    First to comment! Also, you should make a tutorial on monthly subcriptions with paypal.

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    I definitely want to cover integrating Paypal again. Thanks for watching!

  • @patriotsarechokers

    @patriotsarechokers

    3 жыл бұрын

    @@prettyprinted #InDjango

  • @dionbridger5944
    @dionbridger59443 жыл бұрын

    Apologies, but I am EXTREMELY doubtful that { **a, **b } is equivalent to a.update(b) in Python 3.9 For one, this would break a lot of legacy code that relies on the existing semantics for { **a, **b } which is to construct a new dictionary and to leave a, b unchanged. The only sense in which your claim seems to be correct is that in the NEW dictionary, if both 'a' and 'b' contain a key X, the new dictionary will take the value in b in preference to the value in a. I tried scanning through "What's New In Python 3.9" and could not corroborate your claim there. I would be grateful if you could point me to the specific section in case I've missed it. - Dion

  • @nowhereman5956
    @nowhereman59563 жыл бұрын

    wow, I just noticed that I used lstrip / rstrip in a wrong way!!!

  • @HLD202
    @HLD2023 жыл бұрын

    Actually except the second one others was interesting

  • @reflacius7377
    @reflacius73773 жыл бұрын

    my python is cmd. why

  • @robertotomas
    @robertotomas3 жыл бұрын

    I already had read about the release .. I mostly thought “ugh, these bizarre new operators suck”... but seeing the first couple of minutes of this video, I am 100% sold now on | - that’s a keeper (that should happen in other languages even)

  • @zer-vl8cv
    @zer-vl8cv3 жыл бұрын

    mine looks like cmd

  • @dennisbarzanoff9025
    @dennisbarzanoff90253 жыл бұрын

    omg 14:27 why did that take so long

  • @lonewolfcoding5208
    @lonewolfcoding52083 жыл бұрын

    i want python upgrade its graphics desktop and mobile and building mobile app on windows pc pls

  • @informativecontent4778
    @informativecontent47783 жыл бұрын

    Still no i++ in python

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    i+= 1 is only one extra character :)

  • @AssemblyWizard

    @AssemblyWizard

    3 жыл бұрын

    it's actually 3 more because spacing

  • @SrIgort
    @SrIgort3 жыл бұрын

    There is a remove prefix but not a add prefix? 🤔

  • @ribosomerocker

    @ribosomerocker

    3 жыл бұрын

    Just append to the beginning of the string

  • @SrIgort

    @SrIgort

    3 жыл бұрын

    @@ribosomerocker What if the prefix already exists in the beginning of the string?

  • @ribosomerocker

    @ribosomerocker

    3 жыл бұрын

    Then don't? It's like saying removeprefix is faulty because it doesn't account for when the prefix was already removed and then it gets removed again if it exists

  • @SrIgort

    @SrIgort

    3 жыл бұрын

    @@ribosomerocker The whole point of removeprefix is to only remove if the prefix exists and the implementation could be a simple if as shown in the video, the same thing is valid for addprefix only changing the fact that it would add instead of remove...

  • @ribosomerocker

    @ribosomerocker

    3 жыл бұрын

    @@SrIgort Except something that already does that already exists... They can't just add something that is almost the same as something else (which is just adding up strings.) what you're looking for can be done in one line of code, ``prefix + string if not string.startswith(prefix)``

  • @Majnik_
    @Majnik_3 жыл бұрын

    Isn't removeprefix same as lstrip?

  • @snorribjarnason8408
    @snorribjarnason84083 жыл бұрын

    This looks completely different from mine, why is that. Mine is just the basic, standard black screen.

  • @JustLaura404

    @JustLaura404

    3 жыл бұрын

    Me too. Is there anyway to make it look like his?

  • @snorribjarnason8408

    @snorribjarnason8408

    3 жыл бұрын

    @@JustLaura404 I think I figured it out, you have to download pycharm

  • @JustLaura404

    @JustLaura404

    3 жыл бұрын

    @@snorribjarnason8408 kk Hope it works. Thanks for the feedback

  • @JustLaura404

    @JustLaura404

    3 жыл бұрын

    @@snorribjarnason8408 I finally figured it out. You don't have to download pycharm. Just go to search on your windows , look for Python IDLE not the one u opened but a different one. Open it and then that's it

  • @PanduPoluan
    @PanduPoluan3 жыл бұрын

    I like the performance improvements of 3.7 + 3.8, and the friendlier sugars in 3.9 ... but too bad I still have to target 3.6 because at this moment it's the most widely deployed version (Ubuntu 18.04 comes with 3.6)

  • @ribosomerocker

    @ribosomerocker

    3 жыл бұрын

    You shouldn't just limit your libraries or software to specific versions because they're the most deployed, use the versions that have features that you want to use. If your software that you're writing is actually good for the job and is worth it, they will bother updating Python for it.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    @@ribosomerocker Well, installing non-mission-critical 3rd party libraries in Enterprise Production is a big no-no. Most features in 3.7

  • @guiorgy
    @guiorgy3 жыл бұрын

    So you can add types to Python... Then what's the bloody point in using it?

  • @philperry6564

    @philperry6564

    3 жыл бұрын

    Most likely for readability.

  • @dmitrybelyakov
    @dmitrybelyakov3 жыл бұрын

    Beverly Crusher was hot

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Thanks for watching!

  • @dmitrybelyakov

    @dmitrybelyakov

    3 жыл бұрын

    @@prettyprinted My pleasure - I really like your channel!

  • @bfkmnemonic
    @bfkmnemonic3 жыл бұрын

    He build a time machine!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @ashtongrist
    @ashtongrist3 жыл бұрын

    so if you like just go ahead and answer it and then i'll go ahead if I just want to and so on

  • @tomasemilio
    @tomasemilio3 жыл бұрын

    very similar to [doctor.replace("Dr .", "") for doctor in doctor]

  • @nonavailable1755

    @nonavailable1755

    3 жыл бұрын

    similar but not identical, the behavior is different when there is a "Dr. " in other places in the string, other than the start.

  • @Nirex_
    @Nirex_3 жыл бұрын

    More stuff to force everything to be updated...

  • @beach2550

    @beach2550

    3 жыл бұрын

    Nothing was removed in this update though I don't think? It will probably be the case for python 4 but this update just added some functionality/alternative uses. Unless I have missed something

  • @sadhlife
    @sadhlife3 жыл бұрын

    Doctor who reference yo

  • @vladislavyurkov9221

    @vladislavyurkov9221

    3 жыл бұрын

    Not Doctor Who, just Star Trek doctors here!:)

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Star Trek

  • @philperry6564
    @philperry65643 жыл бұрын

    Using '|' is for Dict-Merging is beyond stupid. There was nothing wrong with {**dict_a, **dict_b}, especially since it was kinda unique. Including AugAssign as well, takes the Zen of Python and throws it out of the window.

  • @doc8527

    @doc8527

    3 жыл бұрын

    same feeling, I used to like python syntax sugar since it's pretty easy comparing to others. But this one is purely stupid for the sake of "simplification" because the "bitwise operator" or " | " somehow is used in so many cases across different languages besides python. This one brings a lot of confusions for me, and dilute, pollute the original purpose of the operator.

  • @xx133
    @xx1333 жыл бұрын

    Value add to confusion ratio for new dictionary merge syntax is low... if something is broken, fix it or replace it, don’t add yet another way of doing it that’s slightly different than the original.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    This allows dicts to be handled similarly to sets without having to put in an "if isinstance()" or casting.

  • @MasterSergius
    @MasterSergius3 жыл бұрын

    Using pipe with two variables - bitwise OR, why the hell they made this confusion? Is it more clear than simple update? Damn, I'd better switch to Fortran

  • @hyqhyp
    @hyqhyp3 жыл бұрын

    Tsk tsk ... what would Guido say?

  • @snoopyjc
    @snoopyjc3 жыл бұрын

    And the weirdest new feature: http status code 418 IM_A_TEAPOT

  • @johnstarfire
    @johnstarfire3 жыл бұрын

    doctor = [x.replace("Dr. ","") for x in doctorlist]

  • @surajvkothari

    @surajvkothari

    3 жыл бұрын

    It might replace Dr. or any other target from the rest of the string. string.removeprefix() only removes from the start.

  • @johnstarfire

    @johnstarfire

    3 жыл бұрын

    @@surajvkothari This is so true...

  • @shamrock1961
    @shamrock19613 жыл бұрын

    For someone who just started learning python it just confused things even.more..

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Don't worry about these features yet. The things you see in every Python tutorial are the things that matter the most.

  • @seidenada526

    @seidenada526

    3 жыл бұрын

    What got you confused, bro? Anyhow, you may not have to worry about these features just yet. Many libraries support only Python 3.6 or 3.7 (well, it depends on what field you work with).

  • @varma.
    @varma.3 жыл бұрын

    Can someone tell why someone should learn a language that is still under development of features that most people would use? Legit question.. Don't want no sissy answers please...thnx

  • @pvic6959

    @pvic6959

    3 жыл бұрын

    First, im curious to know what your reasoning is for someone NOT to learn a language that is still under development. Id like to hear your thoughts now to my perspective: most if not all, languages are actively under development until theyre old and deprecated. python 2.x is no longer under development. using your logic, youd want to use that one. but then the question is why would you want to use one thats old/deprecated/no longer being updated? also it comes down to what most people use. FORTRAN no longer gets any real updates (as far as I know) but no one uses it anymore (for the most part), so why would you use FORTRAN? these are all valid questions (also you could have stopped at "legit question", saying the rest made you come off a bit rude. not saying anything bad about you or your question but i wanted to mention it just incase you didnt catch it)

  • @shohjahonhamraqulov8439
    @shohjahonhamraqulov84393 жыл бұрын

    📢📢📢WANNA HAVE PYTHON 4.0

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Give it a few years.

  • @ldohlj1
    @ldohlj13 жыл бұрын

    This is why I hate python! You never know if for something you're stuck doing there is a simple syntax like "a | ^ b .... -b | (a) >>> a" !!!

  • @ribosomerocker

    @ribosomerocker

    3 жыл бұрын

    This is no reason to hate Python for... Ignorance is really not a reason to hate anything. It's like hating C++ for not knowing if there's a specific function already written for you to do the job but you don't know it.

  • @ldohlj1

    @ldohlj1

    3 жыл бұрын

    @@ribosomerocker Except with C++ or other languages there is an finite number of functions and syntaxes. I can bet you a C++ programmers with 5 years of experience knows almost 80% of the available syntaxes and functions while a python programmer with the same amount of experience would only know about 15% of them. Apart from that, in C++, if you wonder which class or namespace of a certain library contains TimeSeries functions, you write "TimeSeries", while in python you gotta know whatever self-made "pandas" "kerbomint" "tityfish" "retronaut" shitty name they have put over their libraries...

  • @ribosomerocker

    @ribosomerocker

    3 жыл бұрын

    @@ldohlj1 Python can not bave infinite numbers of functions and syntaxes... A C++ developer with 5 years of experience, while still only knowing 80% currently, will have less knowledge of C++ as years go by if they don't actually see what features are being added in every version of C++. Same goes with python, 5 years of experience would be enough to know basically the entirety of the standard library and syntax features, hell... I have only a year, and I am pretty sure I know more than 80% of Python, as of right now. I never heard of titty fishes in Python's standard library though.

  • @JimmyWalters1
    @JimmyWalters13 жыл бұрын

    Every update, I like python less.

  • @junaidnasirkhan
    @junaidnasirkhan3 жыл бұрын

    Bored 😲

  • @russianbotfarm3036
    @russianbotfarm30363 жыл бұрын

    Too slow. I’ll go look it up.

  • @juicyjouissance3481
    @juicyjouissance34813 жыл бұрын

    so they just hlaf-merged shitty libraries to the core and implemented a horrible idiom to update dictionaries, don't mind why Guido left this train-wreck of a language.

  • @anirangoncalvesbr

    @anirangoncalvesbr

    3 жыл бұрын

    In fact, it seems like this new behaviour was even supported by Guido himself. He supposedly stepped down from BDFL position because of core developers backslash on this release , starting from Py 3.8 Kinda sad news to me, since I do share the same concerns as the people against these new syntactic sugar.

  • @lawrencedoliveiro9104

    @lawrencedoliveiro9104

    3 жыл бұрын

    Feel free to stick to VBA.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    I like this idiom, actually. Now I can have same processing for set & dict. def do_something(o1, o2): rslt = copy.deepcopy(o1) rslt |= o2 for i in rslt: # do things I can call do_something with a pair of sets or a pair of dicts and the code stays the same. Without the "dict union" operator, I'll have to do an ugly "if isinstance()" or casting.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    @@anirangoncalvesbr Well, Guido's not getting any younger, and he's getting tired of all the too-emotional debates as Python more and more popular. Newer members of the community might be "a bit too vocal" and that kind of "less respective" behavior tends to be contagious. PEP 572 was "the last straw" in the sense that Guido took a step back, saw that he can no longer be too invested in emotional things, and decided to no longer be the dictator.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    Also, Guido did not leave Python. He just stepped down from being the BDFL. He's still part of the core Python developers, and still actively give input & advice, but now people cannot dump things into his lap and expect him to make a decision on polarizing issues.

  • @Kanglese
    @Kanglese3 жыл бұрын

    So do you start every sentence with "so"? Go back and listen to yourself. I had to stop watching after 20 "so's" before 2 minutes in, or so. So I hope you don't always talk like this, for your colleagues sake.

  • @cipherxen2
    @cipherxen23 жыл бұрын

    So, nothing new, which will require a whole new version. Python already has stupid syntax, and there're introducing more stupid operators.

  • @aka5

    @aka5

    3 жыл бұрын

    they created a whole new interpreter as well, amongst a bunch of other stuff not included in this 10 minute video about 4 new things.

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    Yeah these are the features that jumped out at me. There are more things included in the release.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    (1) You are not required to use the new "dict union" operator. It's optional. You can keep using .update() (2) Implementing the "union" operator is actually a good decision, since it allows dicts to be processed similarly to sets. No more casting and/or "if isinstance()" to implement different operations for dicts and sets.

  • @cipherxen2

    @cipherxen2

    3 жыл бұрын

    @@PanduPoluan Correct. You are not required to use python also.

  • @BrianStDenis-pj1tq
    @BrianStDenis-pj1tq3 жыл бұрын

    Python seems to be losing its way with these unnecessary additions. It was simple and beautiful, now its getting short cuts which make it ugly.

  • @PanduPoluan

    @PanduPoluan

    3 жыл бұрын

    Why is it ugly? If any, this allows dicts to be processed similarly to sets. No more casting and/or "if isinstance()" ladders to implement a similar (but not same) operation.

  • @veziop
    @veziop3 жыл бұрын

    Why am I here I don’t even know how to code

  • @prettyprinted

    @prettyprinted

    3 жыл бұрын

    You can always start learning.

  • @veziop

    @veziop

    3 жыл бұрын

    @@prettyprinted yes i keep trying its been five years