What's the meaning of underscores (_ & __) in Python variable names?

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ธ.ค. 2024

ความคิดเห็น • 277

  • @LucasHartmann
    @LucasHartmann 6 ปีที่แล้ว +925

    For C++ people, foo is public, _bar is protected, and __baz is private.

    • @theonewhohonks9675
      @theonewhohonks9675 6 ปีที่แล้ว +80

      Finally it makes sense.

    • @karunesh26march
      @karunesh26march 6 ปีที่แล้ว +26

      no no Foo is public _bar is private and __baz is protected as user wants to use __baz in derived class

    • @LucasHartmann
      @LucasHartmann 6 ปีที่แล้ว +63

      @@karunesh26march __baz is name mangled, so it can only be used inside the class that defined it, not its derivatives. This is what private means in C++. _bar is not mangled, so it may be used elsewhere.

    • @barewr828
      @barewr828 5 ปีที่แล้ว

      oh thanks really much it really helped!

    • @spyrex3988
      @spyrex3988 4 ปีที่แล้ว +2

      Thanks man

  • @Chantillian
    @Chantillian 4 ปีที่แล้ว +50

    ... and if you want to impress your friends, there are also underscores in int values which arguably improve readability, but are ignored by Python. Eg: x = 1_000_000 gives us the integer-type variable x and its value 1000000. x=1_2 gives x the value of 12. x=1,000,000 creates tuple (1,0,0), btw.

    • @quads4407
      @quads4407 3 ปีที่แล้ว +4

      Yes, thank you for reminding me that

    • @JorgetePanete
      @JorgetePanete 3 ปีที่แล้ว +1

      same in java

    • @jcf20010
      @jcf20010 3 ปีที่แล้ว +4

      Another item to add to the "Why I Don't Like Python List".

    • @sv8211
      @sv8211 3 ปีที่แล้ว

      Tried it. My friend is unimpressed. 😞

    • @Chantillian
      @Chantillian 3 ปีที่แล้ว

      @@sv8211 Not much of a friend, then. ;)

  • @sepehr11235
    @sepehr11235 3 ปีที่แล้ว +175

    Python people decided to "simplify" things by not having private class members. Nicely done...

    • @maswinkels
      @maswinkels 3 ปีที่แล้ว +10

      Yes. Terrible decision. I really love Python, but it has some ugly flaws.

  • @kenchen738
    @kenchen738 6 ปีที่แล้ว +736

    You just made me realize Dunder Mifflin is just a python variable name __Mifflin.

    • @realpython
      @realpython  6 ปีที่แล้ว +62

      Haha, that's great!

    • @jeremyheminger6882
      @jeremyheminger6882 6 ปีที่แล้ว +20

      I want to put that on a t-shirt!

    • @milanbhardwaj2917
      @milanbhardwaj2917 4 ปีที่แล้ว +12

      That's what she said

    • @donaldli4755
      @donaldli4755 3 ปีที่แล้ว +2

      I got here after a Dunder Mifflin run. Great Scott.

    • @MrClaudiodonate
      @MrClaudiodonate 3 ปีที่แล้ว +1

      @@jeremyheminger6882 And if someone gets the t-shirt, INSTANT BONUS FRIEND!

  • @jamiemarshall8284
    @jamiemarshall8284 6 ปีที่แล้ว +100

    Thanks for this, its hard to find python explanations for devs that actually tell us whats under the hood. Much appreciated.

    • @realpython
      @realpython  6 ปีที่แล้ว +11

      You're welcome! I'm glad you found the explanation helpful.

  • @victorystocktv
    @victorystocktv 4 ปีที่แล้ว +12

    00:21 here is the constructor of the class (생성자)
    00:46 _ : underscore (single underscore) is to be treated as private by the programmer (private variable, so careful about changing), 파이썬은 public과 private 차이가 크지 않다. java에 비해
    __ : dunder (double underscore)
    4:13 t.Test__baz
    Thank you

    • @robinpage2730
      @robinpage2730 2 ปีที่แล้ว +1

      Hey, you're getting a rendering bug with the characters in your comment, I saw a vid on that one, never thought I'd see it myself. The engine rendering TH-cam is reading the Unicode characters as utf-16, which are 16 bit characters. The bug comes from how the browser engine reads the endianness of utf-16: little-endian or big-endian. If it can't read the big-endian characters correctly it'll frame-shift and read the chars in the wrong bit order, as little-endian, rendering Chinese characters rather than English letters. Windows had a problem with this for a while

  • @asands123
    @asands123 5 ปีที่แล้ว +72

    At first I was like "This example is exactly like the one I just read in Python Tricks" before reading who published this video haha
    Subscribed!

    • @Fahadkhan_313
      @Fahadkhan_313 4 ปีที่แล้ว +1

      Hi you are very intelligent 😉.

    • @rishabhrawat7856
      @rishabhrawat7856 3 ปีที่แล้ว

      Your youtube account is younger than my brother...

    • @SOMEONE-eq5bu
      @SOMEONE-eq5bu 3 ปีที่แล้ว

      Your acc is the oldest acc i have seen in youtube

  • @xaknitram
    @xaknitram 6 ปีที่แล้ว +14

    To elaborate on this explanation, avoiding name conflicts is the most important and missable use of the double underscore variable and function names.
    When a class is inherited from, any methods that the base class uses in its methods are searched for in the current scope (the new class). Therefore, if a method from the base class has been overwritten, the methods that call that method will call the new method instead of the old one, breaking the class. The double underscore system was implemented to fix this.
    For a crude example in python 3.6:
    class Temp:
    def get_temp()
    return "274 Kelvin"
    __get_temp = get_temp
    def display_temp(self):
    print(self.get_temp())
    def display_temp2(self):
    print(self.__get_temp())
    class Fahrenheit(Temp):
    def __init__(self):
    self.display_temp() # will display the current temperature in Fahrenheit now
    self.display_temp2() # will display the current temperature in Kelvin
    def get_temp(self):
    return "33.5 degrees Fahrenheit"
    As for making variables private, python tries to push user away from doing this. As Dan states, the underscores are mainly hints to other programmers. The @property decorator was implemented to this end.

    • @realpython
      @realpython  6 ปีที่แล้ว +2

      Thanks for sharing this!

  • @marunjimarunji8733
    @marunjimarunji8733 ปีที่แล้ว

    Thank you, the video covered everything I needed in a very convenient amount of time

  • @itzyourbwoytchybooxuur6475
    @itzyourbwoytchybooxuur6475 5 ปีที่แล้ว +5

    Thanks Dan. Simple and sweet as always. And I love your voice.

    • @realpython
      @realpython  5 ปีที่แล้ว +1

      Glad you enjoyed it!

  • @MrRijoAlex
    @MrRijoAlex 7 ปีที่แล้ว +30

    Great explanation (Y). Thanks Dan.

  • @andyanderson222
    @andyanderson222 3 ปีที่แล้ว +4

    Good explanation, only suggestion is to use t.__dict__ instead of dir(t) since it won't return many builtin methods.

  • @Hasan...
    @Hasan... 3 ปีที่แล้ว +18

    That was Dunderful !

  • @theultimatereductionist7592
    @theultimatereductionist7592 6 ปีที่แล้ว +9

    THANK you for asking this question! I have NEVER used underscores in Python.

    • @realpython
      @realpython  6 ปีที่แล้ว +1

      You're welcome!

  • @alexxx4434
    @alexxx4434 3 ปีที่แล้ว

    No real access restrictions. Geat language!

  • @KusogeMan
    @KusogeMan 3 ปีที่แล้ว +1

    single underscore usually means private variable, double (dunder) means new classes will use the name mangling correctly with variables with same name
    dir() returns attributes

    • @avisinha6566
      @avisinha6566 3 ปีที่แล้ว +1

      THANKS this help me understand.

  • @barax9462
    @barax9462 4 ปีที่แล้ว +14

    Ok, but what about the double underscore before and after a name __foo__ such as __init__? can u please explain it too.

    • @mymoomin0952
      @mymoomin0952 3 ปีที่แล้ว +6

      __thing__ is used for special built-in python functions, like init

    • @deViant14
      @deViant14 3 ปีที่แล้ว +9

      it's a way for built-ins to get out of the way of you, the programmer, and out of your namespace

  • @jeezboi5079
    @jeezboi5079 3 ปีที่แล้ว

    This is such a nice video...clear concept, beautiful

  • @easygerman3402
    @easygerman3402 3 ปีที่แล้ว

    Hi,Sir Dan.JV here again.Your video is really nice and I could understand everything,sir.I have view this video,like this video and subscribed the channel,sir.

  • @MidnightSt
    @MidnightSt 3 ปีที่แล้ว

    I have seen stringly typing, we all have, php and js used to use it, but this is probably the first time I've ever seen stringly scoping.

  • @ZacharySmith89
    @ZacharySmith89 6 ปีที่แล้ว

    For a longer explanation of the purpose of _ _: th-cam.com/video/HTLu2DFOdTg/w-d-xo.html (starting around 35:00)

  • @mystery45454
    @mystery45454 3 ปีที่แล้ว

    Thanks for making this useful video

  • @rg.reboot.jam.edupro
    @rg.reboot.jam.edupro 4 ปีที่แล้ว +2

    The explaination of dunder __baz doesnt make sense to me as a new developer ; for the same reason it could mangle the other 2 instance variables too (_bar or foo). Just the reason could be because the __ dunder has special meaning in python as its used for constructors & builtin language methods by convention it avoids the user defined names by name mangling

  • @olexandrklymenko
    @olexandrklymenko 6 ปีที่แล้ว +16

    Hey Dan. Thanks for your great job. One minor comment: technically __init__ method is not a constructor. It rather 'initilizer'

    • @realpython
      @realpython  6 ปีที่แล้ว +6

      Thanks for pointing that out! Glad you enjoyed the video.

    • @sanjeevkumar-ty8dx
      @sanjeevkumar-ty8dx 6 ปีที่แล้ว

      Which py editor u r using???

  • @kanony5188
    @kanony5188 3 ปีที่แล้ว +3

    Which editor are you using in this tutorial?

  • @kunalsoni7681
    @kunalsoni7681 3 ปีที่แล้ว

    wow new concept you explaining 😍

  • @ImranHossain-fu4hj
    @ImranHossain-fu4hj 3 ปีที่แล้ว

    Fabulous explanation as always. Thanks a lot

  • @Cracks094
    @Cracks094 3 ปีที่แล้ว +7

    why am i watching this at 2am i don't know the first thing about programming

  • @joeking5211
    @joeking5211 ปีที่แล้ว

    Super informative, thks.

  • @sylvernale
    @sylvernale 2 ปีที่แล้ว

    How do you get those sweet suggestions in your shell's python interpreter?

  • @javlontursunov6527
    @javlontursunov6527 3 ปีที่แล้ว

    Hey bro please explain how to write double merged underscores

  • @tesohh
    @tesohh 3 ปีที่แล้ว

    How do you have syntax highlighting and suggestions?

  • @tomdorr9487
    @tomdorr9487 4 ปีที่แล้ว +2

    I found this very insightful!

  • @leeritenour
    @leeritenour 6 ปีที่แล้ว +3

    Hi,
    How do you write multiple lines in python shell?
    How do you get auto-completion in python shell?
    Thanks.

    • @paschikshehu7988
      @paschikshehu7988 6 ปีที่แล้ว

      Yi-hsiu Lee Must be an IDE or text editor; python shell doesn't have text highlighting iirc

  • @ManafKAMIL
    @ManafKAMIL 3 ปีที่แล้ว +2

    It a nice explanation... but it raises another question now: what happens when inheriting from the class and defining new variables foo and _bar? wouldn't that causes naming conflicts and confusions too?

    • @KumarAbhinav2812
      @KumarAbhinav2812 3 ปีที่แล้ว +1

      Yes, and that's the intent.
      You want foo to be publicly accessible, _bar be used in derived classes, and __baz to be available exclusively to one class.

  • @gujjardachhora9862
    @gujjardachhora9862 6 ปีที่แล้ว +1

    Amazing explanation, cleared all my doubts

    • @realpython
      @realpython  6 ปีที่แล้ว

      I'm glad it was helpful!

  • @RomanDryndik
    @RomanDryndik 3 ปีที่แล้ว

    What shell do you use?

  • @vaiterius
    @vaiterius 3 ปีที่แล้ว

    Thank you sir!

  • @brpawankumariyengar4227
    @brpawankumariyengar4227 6 ปีที่แล้ว

    Excellent explanation ....Thank you very much Dan

  • @harmitalestari5592
    @harmitalestari5592 3 ปีที่แล้ว

    Hi, sir.. How to remove these underscore?

  • @climbit9555
    @climbit9555 3 ปีที่แล้ว +7

    I work a lot with dunder methods. But I need to call them in this weird way in my unittests

    • @kirasmith1147
      @kirasmith1147 3 ปีที่แล้ว

      Possibly you can just unit test the "public/protected" methods, because the inner workings of your class will be revealed to be faulty if the outer facing thing that calls them fails

  • @DmitriiPetriev
    @DmitriiPetriev 3 ปีที่แล้ว

    What interpreter you use? It’s give some tips when you type function. I have never seen that before.

  • @shuntiiops5523
    @shuntiiops5523 4 ปีที่แล้ว +1

    I have a quick question. If the given variable is 'Total Sale' when transformed into an underscore writing should it be written like this 'Total_Sale' or 'total_sale' or even 'Total_sale'? Which one's correct?

    • @noel.friedrich
      @noel.friedrich 3 ปีที่แล้ว +2

      Generally you should not capitalise normal variables, so total_sale is the most agreed on

  • @UsmanGhani-wk6hq
    @UsmanGhani-wk6hq 2 ปีที่แล้ว

    So for the encapsulation, should we use single underscore or double? Thanks.

  • @jeancarlosadrianza876
    @jeancarlosadrianza876 7 ปีที่แล้ว +2

    Hi, Dan...Congratulations for your great job... Would you like to tell us what is your opinion about the few protection of the attributes (in objects) in python in comparation with Java? Do you think that this characteristic can be considered a defect of python?

  • @jonron3805
    @jonron3805 3 ปีที่แล้ว

    Cant we use super to access the __baz?

  • @bidochon2009
    @bidochon2009 7 ปีที่แล้ว +4

    nice video.... always been confused..not anymore !

  • @gavinpereira6588
    @gavinpereira6588 3 ปีที่แล้ว

    Anybody know what console / editor this is. It looks pretty cool

  • @inteligenciaartificiuau
    @inteligenciaartificiuau 10 หลายเดือนก่อน

    Amazing!

  • @GodBurstPk
    @GodBurstPk 3 ปีที่แล้ว +1

    Thanks for this, had a dual initiation bug where my configuration class was loaded twice when only calling the class once. seems this was a name mangeling issue.

  • @famouscloud1292
    @famouscloud1292 7 ปีที่แล้ว +1

    what mic are u using ? sounds great

  • @finderlandrs7965
    @finderlandrs7965 3 ปีที่แล้ว +1

    Does it change if underscore comes after variable name (i.e. bar_, foo_)?

  • @jamcdonald120
    @jamcdonald120 3 ปีที่แล้ว

    but what if I want a variable named _Test__baz?

  • @divusiulius7539
    @divusiulius7539 7 ปีที่แล้ว +1

    is there a way to make the dunderscore(d) __names Immutable as in Scala val?
    val x: Int = 0 or val x: String = "Immutable_String"

  • @DynoosHD
    @DynoosHD 3 ปีที่แล้ว

    So how would be the correct way to access __baz ?

    • @michael_p
      @michael_p 3 ปีที่แล้ว

      You should access __baz only inside its class. Use it for internal helping methods or attributes, that are not part of the public interface, and must not be altered/overridden through inheritance.

  • @letSimoo
    @letSimoo 6 ปีที่แล้ว

    wonderful explanation bro . . .Thx a lot

  • @AndrewErwin73
    @AndrewErwin73 6 ปีที่แล้ว +1

    Clear explanation of how Python is not object oriented. Does this still apply in Python 3.6? I know a lot of things changed. Wondering if this is one of them.

    • @malding1
      @malding1 3 ปีที่แล้ว

      It could be though

  • @saunakpandya7657
    @saunakpandya7657 7 ปีที่แล้ว +1

    Good explaining.👍

  • @Chatterphone
    @Chatterphone 6 ปีที่แล้ว

    Wonderful explanation, thank you!

  • @oida10000
    @oida10000 3 ปีที่แล้ว

    Now I understand why the magic functions do have this form. Do the ddash at end do something or is this just convention?

  • @GrecianGoat
    @GrecianGoat 3 ปีที่แล้ว

    I would've loved to see what happens when you extend your Test class. Like would there be _Test__baz AND _extendedTest__baz or just the latter? I guess I'll have to go do it myself...

  • @vpylr2806
    @vpylr2806 5 ปีที่แล้ว

    Good explanation!!

  • @lost-one
    @lost-one 4 ปีที่แล้ว +3

    "Really the only reasonable way to get that done is to access them from the class itself". What about properties?

  • @Jason-uv5tm
    @Jason-uv5tm 3 ปีที่แล้ว +1

    What does __baz__ mean

  • @TinkatheRainbowFox
    @TinkatheRainbowFox 3 ปีที่แล้ว

    So tell us when do you use these and when you don't? What's the Best Practice or common conventions and the reasoning behind them?

    • @highxbye
      @highxbye 3 ปีที่แล้ว

      I've found they are best used with the @property decorator, to prevent people from setting the variable when I only want to allow getting.
      class T():
      def __init__(self):
      self._foo = 0
      @property
      def foo(self):
      return self._foo
      t = T()
      t.foo -> 0
      t.foo = 1 -> AttributeError: can't set attribute
      @property decorators can be used to do a lot more stuff but this was the basic explanation that opened the doors for me initially.

  • @logannasty3240
    @logannasty3240 3 ปีที่แล้ว

    I wish I was this clear when explaining concepts

  • @dreamscape1011
    @dreamscape1011 4 ปีที่แล้ว +1

    Thank you sir, nice and clear!! :-)

  • @michtesar
    @michtesar 7 ปีที่แล้ว +1

    Awesome. Which IDE you use for macOS? Thank you and have nice day.

    • @realpython
      @realpython  7 ปีที่แล้ว +2

      Hey Michael, I use Sublime Text with a bunch of plugins. This is my setup: SublimeTextPython.com

    • @dasgoll
      @dasgoll 6 ปีที่แล้ว +1

      Python Training by Dan Bader So you are using the console that comes with Sublime to execute those commands?

  • @MCChubbyUnicorn
    @MCChubbyUnicorn 3 ปีที่แล้ว +1

    Nice. Basically how I treat my variables in other languages

  • @JonDisnard
    @JonDisnard 3 ปีที่แล้ว

    Please correct me if wrong, but I was under the impression the __init__ is merely an initializer, where __new__ is the underlying constructor?

    • @pranavnyavanandi9710
      @pranavnyavanandi9710 3 ปีที่แล้ว

      __init__ is the constructor. __new__ creates the instance. __init__ initializes it.

  • @8koi245
    @8koi245 3 ปีที่แล้ว +7

    I don't get it, gonna come back in a few weeks!

    • @EmileAI
      @EmileAI 3 ปีที่แล้ว

      Come back

    • @eeriemyxi
      @eeriemyxi 3 ปีที่แล้ว +1

      alright, 3 weeks
      when u coming back

    • @EmileAI
      @EmileAI 3 ปีที่แล้ว

      @@eeriemyxi yeah, he/she needs to come back right fucking now!

    • @eeriemyxi
      @eeriemyxi 3 ปีที่แล้ว +1

      @@EmileAI yep!

    • @dabananasauce7610
      @dabananasauce7610 3 ปีที่แล้ว +1

      it has been 1 month, i require thy assistance

  • @abir95571
    @abir95571 3 ปีที่แล้ว

    _bar wont allow import * to itself ... not sure if it should be called protected . Even that can be bypassed by putting __all__=['_bar'] in the above code

  • @gulshankumar17
    @gulshankumar17 4 ปีที่แล้ว

    thanks for the tutorial.

  • @aalapjethwa6452
    @aalapjethwa6452 6 ปีที่แล้ว

    Nice explanation

  • @firewaterrise9412
    @firewaterrise9412 6 ปีที่แล้ว

    Informative... thanks, Man.

  • @BoxerDogs
    @BoxerDogs 6 ปีที่แล้ว +1

    Are you using an IDE such as PyCharm or are you doing this from the command prompt?

    • @realpython
      @realpython  6 ปีที่แล้ว +3

      I use Sublime Text as my main IDE.

  • @thinhzawsze7519
    @thinhzawsze7519 6 ปีที่แล้ว

    Good explanation!! I wonder which IDE you are using....

    • @realpython
      @realpython  6 ปีที่แล้ว

      I use Sublime Text 3 :)

  • @3mariusss
    @3mariusss 6 ปีที่แล้ว

    can this be classed as polymorphism?

  • @dmm10000
    @dmm10000 6 ปีที่แล้ว +2

    vague - please expand on the suggestion that collisions could occur - how ?

    • @telegraph5592
      @telegraph5592 6 ปีที่แล้ว +2

      Ya, missed that a bit too. But there are comments explaining it. For example you may have a new class enhiring from the original one and defining a method which has a name already defined in the original class. In this case the new defined method will overwrite the one with same name from the original class. This may break the functionality of the original class enhireted unintentionally. To prevent that __ results in name mangeling preventing this Inbus.

  • @ChubbaStun
    @ChubbaStun 6 ปีที่แล้ว

    what is the screen casting software you used? Cheers

    • @realpython
      @realpython  6 ปีที่แล้ว

      Here is a list of screen-casting software I use: dbader.org/resources/#screencasting

  • @Alexxx160994
    @Alexxx160994 7 ปีที่แล้ว +1

    Great voice and great microphone. Which one are you using?

    • @Alexxx160994
      @Alexxx160994 7 ปีที่แล้ว +1

      You're right :)

    • @realpython
      @realpython  7 ปีที่แล้ว +1

      Thanks! I used the ATR 2100 USB for this video: dbader.org/resources/#screencasting

  • @jackschlessinger3447
    @jackschlessinger3447 5 ปีที่แล้ว

    What kind of programs or software are made with python ????

    • @realpython
      @realpython  5 ปีที่แล้ว

      There are quite a few made with Python, I recommend giving this a read: realpython.com/world-class-companies-using-python/

  • @capsujit
    @capsujit 6 ปีที่แล้ว

    awesome explanation....

    • @realpython
      @realpython  6 ปีที่แล้ว

      Glad you liked it!

  • @richardhutchinson4663
    @richardhutchinson4663 3 ปีที่แล้ว

    You did not show how to access the dunder bazz __baz within the class.
    Do you use the class name, then dot notation to get to __baz?
    Example:
    Test.__baz
    >>> 42
    Is this how to get the 42?

  • @Schlumpfpirat
    @Schlumpfpirat 5 ปีที่แล้ว +1

    And everybody just wants to know which Sublime package you're using to show those information.

    • @ajitnayak9t99
      @ajitnayak9t99 4 ปีที่แล้ว

      Bpython repl (alternative python interpreter)

  • @lilacdoe7945
    @lilacdoe7945 3 ปีที่แล้ว

    What IDE is this?

  • @kumarvishalben
    @kumarvishalben 3 ปีที่แล้ว

    Thanks

  • @rangabharath4253
    @rangabharath4253 7 ปีที่แล้ว +1

    Hi Dan , Can u please make a video on how to extract a redirected url from a website using python other than beautiful soup☺👍

  • @pranavnyavanandi9710
    @pranavnyavanandi9710 3 ปีที่แล้ว

    How are we able to access magic methods normally then? Are they not name mangled? That is,
    "Hello".__len__()
    "Hello"._str__len__()
    The first one works fine despite being a private method. The second I never tried.

  • @parthdodiya8448
    @parthdodiya8448 6 ปีที่แล้ว +2

    Which extensions do you have in sublime text 3 for python?

  • @luism55
    @luism55 2 ปีที่แล้ว

    Someone tells me how to type this long underscore

  • @tarungarg2695
    @tarungarg2695 5 ปีที่แล้ว +3

    Nice video !! one doubt I have.. I heard in the video you said the one with a single underscore is private variable ? is that true? I believe the one with a single underscore is protected variable and the one with the double underscore is private.. please correct me if I am wrong.

  • @groku0112
    @groku0112 7 ปีที่แล้ว

    Hi Dan
    Can you please tell me if I can use IntelliJ for learning python instead of sublime editor?

    • @realpython
      @realpython  7 ปีที่แล้ว +1

      Hey, yes you can use IntelliJ! Whatever works best for you is the right choice. :)

  • @FredoCorleone
    @FredoCorleone 6 ปีที่แล้ว +1

    There's only one _ worth mentioning: const _ = require('underscore')

  • @ndukwejoe123
    @ndukwejoe123 7 ปีที่แล้ว

    thanks for the explaination

    • @realpython
      @realpython  7 ปีที่แล้ว

      You're welcome! :-)

  • @Rajat13061986
    @Rajat13061986 6 ปีที่แล้ว

    Which editor is this?

    • @realpython
      @realpython  6 ปีที่แล้ว

      I mainly use Sublime Text 3

    • @Rajat13061986
      @Rajat13061986 6 ปีที่แล้ว

      pls tell me the theme and color scheme you used in the video

  • @sarahbiebah
    @sarahbiebah 6 ปีที่แล้ว +1

    is the concept of "dunder" variables in Python similar to the concept of Polymorphism in C++ ? In other words, is it a technique to call a specific foo() function in one class if foo() exists with the same name in many other classes - therefore acting as a corresponding syntax to C++'s "virtual" keyword ?

    • @saulaxel
      @saulaxel 6 ปีที่แล้ว +1

      No, it isn't

  • @KrishnaManohar8021
    @KrishnaManohar8021 4 ปีที่แล้ว

    Object vs instance???

  • @DhirajSingh-ux8tb
    @DhirajSingh-ux8tb 6 ปีที่แล้ว

    best explanation

    • @realpython
      @realpython  6 ปีที่แล้ว

      Glad you liked it!

  • @fc6827
    @fc6827 3 ปีที่แล้ว

    I wonder if python devs are better at recognizing dunders compared to other devs