Tutorial 19- Python Iterables vs Iterators

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 47

  • @facts_region
    @facts_region 3 роки тому +7

    Hi, I understand how efficiently can memory be utilized through Iterators. But a basic doubt that I have - In the example that's taken in the tutorial, the same lst = [1, 2, 3, 4, 5, 6, 7] is used for both the Iterable and Iterator. That means the list is already loaded into the memory both in case of Iterable and Iterator and a for loop is used to retrieve the elements. A little confused about the concept here. Glad if @Krish or anyone clarifies :)

    • @mdsaquibjawed2115
      @mdsaquibjawed2115 Рік тому +4

      you can use:
      list1= iter([1,2,3,4,5,6,7])
      hence no need to save the list initially.

    • @DhavalAhir10
      @DhavalAhir10 4 місяці тому


      But this will also first time initialized whole list into memory and then create iterator object. Isn't it?

  • @shivambatra70
    @shivambatra70 4 роки тому +12

    I want to ask that let's say we have the following code:
    List1=[1,2,3,4,5,6,7,]
    List2=iter(list1)
    then List 2 is the iterator and it is memory efficient but while initializing the List 2 we need to load the List 1 into memory for that and Suppose we have a million record .How do we Approach to that problem.

    • @pbanerjee4008
      @pbanerjee4008 4 роки тому +1

      I too have the same doubt. Hope some one can explain

    • @harshmakwana8001
      @harshmakwana8001 4 роки тому +1

      I totally understand your problem. here is what i think happens, the iterator dosen't load the whole list and extract the next "i". the iterator directly loads the memory of the next "'i" and not the whole lst. Then again i am just speculating. I could be wrong what do you think?

    • @ashutoshjha4221
      @ashutoshjha4221 4 роки тому

      @@harshmakwana8001 I think that must be the right guess

    • @amyagupta5969
      @amyagupta5969 4 роки тому +6

      I think we need not load list1 in the memory first, instead what we can do is directly initialize the list using iter function, i.e. pass the list in the iter function itself.
      You can use this statement: list1= iter([1,2,3,4,5,6,7])

    • @teenaagrawal8196
      @teenaagrawal8196 3 роки тому +1

      List1 = iter([1,2,3,4,5,6,7])
      Lsit2 = iter(List1)

  • @sandipansarkar9211
    @sandipansarkar9211 4 роки тому +1

    Thanks krish .Now I clearly understand the difference between iterable and iterator.Thanks

  • @i_amanrajput
    @i_amanrajput 2 роки тому +1

    you are legend Krish. Nice video

  • @AmitKumar-BIDSP
    @AmitKumar-BIDSP 4 роки тому +1

    Simple and clear explanation

  • @ganeshrao405
    @ganeshrao405 3 роки тому +1

    Understood well difference between list iterables vs iterators based on memory management way you explained.

  • @joyprokash4013
    @joyprokash4013 6 місяців тому +1

    Thanks Sir.Please make a advanced playlist of web scrapping.

  • @devenmali9820
    @devenmali9820 5 років тому +4

    So krish..iterator is a kind of dynamic memory call.. whenever u need it...we shall call the next function and retrieve the value

  • @priyankajhamb7061
    @priyankajhamb7061 4 роки тому

    Outstanding Sir 👍👍 Your way of teaching is very nice. Sir
    Thanks Sir

  • @Raja-tt4ll
    @Raja-tt4ll 5 років тому

    Very nice explanation. Thanks

  • @saleemmohammad8986
    @saleemmohammad8986 2 роки тому

    Well explained
    Thank you

  • @aslammohamed970
    @aslammohamed970 3 роки тому

    Sir,you are a genius

  • @talentzunlimited1398
    @talentzunlimited1398 Рік тому

    Thanks for this video !

  • @akashpawar9058
    @akashpawar9058 5 років тому +1

    Another goof video sir

  • @azarei2120
    @azarei2120 5 років тому +2

    Hi Krish, good work and thanks for your videos
    Would you please upload come tutorial for data cleaning?

  • @raneshmitra8156
    @raneshmitra8156 4 роки тому +2

    Kindly upload videos on Generator and Decorator....

  • @adityaChaudhari24
    @adityaChaudhari24 4 роки тому

    Great to the point thanks for the video.

  • @louerleseigneur4532
    @louerleseigneur4532 3 роки тому

    Thanks Krish

  • @sameerherkal9205
    @sameerherkal9205 8 місяців тому

    How to handle that error scenario? If it terminates.. in between of code..is there any if condition to check??

  • @manojgh5681
    @manojgh5681 10 місяців тому

    Krish when I am retrivewing iterator items by using for, is all item intalized in different memory?

  • @utkarshgupta7310
    @utkarshgupta7310 3 роки тому +1

    Hi Krish, So once next element is initialised in the memory, say suppose 2 from list ex shown in video, does the memory initialisation for 1 initially goes off? Or it stays?

  • @mudassarm30
    @mudassarm30 Рік тому

    The iterator is made from the already existing list that is fully initialised in memory, I dont understand how did you save memory by using iterator ? Can you comment on it ?

  • @sameerherkal9205
    @sameerherkal9205 2 роки тому

    Hi @Krish sir, can you tell me where exactly this iterators concept is used?Can you provide an real life example/scenario so as to relate.

  • @gopalakrishna9510
    @gopalakrishna9510 5 років тому +1

    sir y this vedio are not in your playlist

  • @niveditaparab6772
    @niveditaparab6772 11 місяців тому

    could you please add a material on difference between __new__ and __init__

  • @winviki123
    @winviki123 5 років тому +3

    Sir,I love your tutorials!
    I am a little embarassed to say this,but I'm getting so tensed while learning RNN and LSTM. I'm not able to get a complete understanding of RNN. In your deep learning,playlist,I couldn't find that video. Can you please make a video on that and explain the theoretical concept behind RNN and LSTM?? Please help

  • @paraschaurs
    @paraschaurs 5 років тому

    Hello Sir, how many more videos of python are there.. So I can download them all in one go and study... I have also downloaded from ineuron too..

  • @mohdzeeshankhan8118
    @mohdzeeshankhan8118 3 роки тому

    Sir loops ka video kaha hai

  • @CutechildTV
    @CutechildTV Рік тому

    Hi Krish, I will say you are wrong at this point. As you said in the video iterator that you generate get the memory location.
    But they got the memory address. You can see as we have created iterator called as iterList still it retrieve element when we deleted the reference of the original list
    list1= [1,2,3,4,5]
    iterList = iter(list1)
    del list1
    next(iterList)
    I hope you can modify this video.
    Everyone see this example!

  • @hometvfirestick
    @hometvfirestick 3 роки тому

    thanks

  • @madhurjadhav9777
    @madhurjadhav9777 2 роки тому

    thank u bhawa

  • @indirajithkv7793
    @indirajithkv7793 2 роки тому

    ❤💫

  • @JacklinSibiyal
    @JacklinSibiyal 10 місяців тому

    Day 7 - 23/02/24

  • @Adityakumar-wp2mk
    @Adityakumar-wp2mk Рік тому

    Kept repeating ,only change the tense
    Disappointed by video

  • @ashna409
    @ashna409 Рік тому

    Very bad explaination