Namespaces in Python: Built-in, Global, Enclosing, and Local

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ม.ค. 2025

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

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

    Why Did not covered
    what is namespaces ???
    you started from type of namespaces...

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

    Really helpful. Thanks a lot for your effort. The best example for a good teaching style.

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

    Thank you very much for this video! It is very educational :)

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

    Amazing video, very useful! Unrelated: are you dutch? :D

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

    I have a little question why is the print function not copied to the local namespace ?

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

    Great info! Thanks this makes it very clear and is super helpful.

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

    ????????????????????????? so what is a namespace, it looks like a JSON string to me, do we need to use it when programming python ?????

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

      The namespace is a Python dictionary, which contains key-value pairs, which are variable identifiers as keys and their values.
      That it looks like JSON is just because it's logically the same structure, and the print function in Python is apparently overloaded to display dicts like this.

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

    Excellent video thanks !

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

    Where is the next episode? I need it...

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

    Since you are working with an interactive version of python,
    you fail to mention which namespace is being referenced when
    executing globals().
    In a multi module application (most applications) merely executing
    globals() at the interactive prompt gives different results depending
    on where it is executed. The truth is that globals() is accessing
    the "current" namespace or "current" module.
    Python took a perfectly good word - "globals" - and is using that word
    to really mean "module" scope.
    Python, does not truly have anything resembling "global" variables
    or "global" functions as defined in other programming languages.
    This difference is an ongoing source of confusion and quirky programming
    errors. I suggest you consder multi module applications when you speak of "globals"...

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

      Hi, may I ask what other languages you were referring to when you said "python doesn't truly have anything resembling global variables as defined in other programming languages".

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

      @@v4n5h4j I think C++ and JS can be taken as example for that.

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

    i like how u call underscores as dunders or w/e lol so funny

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

    1.5x speed ^.^