Advanced Python Series - Iterators Vs Generators

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

КОМЕНТАРІ • 52

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

    Excellent! One additional point a function can have many yield statements however, we can have only one return statement.

    • @lepidoptera9337
      @lepidoptera9337 Рік тому +2

      Huh???? Where did you get this nonsense from? A function can have an arbitrary number of return statements. Multiple returns are functionally completely equivalent to a case statement or a series of if-then-else statements. A function can even have zero return statements. A function doesn't have to return a value. A function doesn't even have to finish. That's quite useful in multitasking systems that have to repeat the same functionality over and over again in the background.

  • @PratikDalvi-mg8qx
    @PratikDalvi-mg8qx 29 днів тому

    Yes..! I got the real Krish who helps the needy Students .❤☺

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

    Hi Krishna , before gng for interview i hv gone through ur iterator vidoe and same concept asked in interview as i hv gone through ur iterator video i was able to explain well with an example of iterator.iterviewr was very much convenienced with the example and answer .Thanks for the amazing video very well explained.
    I am grateful to you for these videos and easy explanation

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

      As an interviewer I would have rejected you on your lack of communication skills alone. Life is not a series of smartphone texts. :-)

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

    You explained in very very simple and understanding manner ... thanks for making it

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

      Really? I found it to be quite confusing!

  • @ramarao_amara
    @ramarao_amara 3 роки тому +2

    other than generator function , we can use generator comprehension also used for creating generators.

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

    nums = [i*i for i in [1,2,3,4,5]]
    for i in nums:
    print (i)

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

    8:40
    def square(n):
    for i in range(n):
    return n**2
    square(3)
    >>> 9
    I'm getting 9 instead of 0. Why so?

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

    superb lecture Krish.

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

    Wow this was much needed Krish sir. Thanks a lot

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

    Wonderful! Thank you so much.

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

    Thanks Krish, very good explanation

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

    Best video needed it so much. Thankyou sir.🌟

  • @bongmou2845
    @bongmou2845 3 роки тому +3

    Thank you for the clarification , well explained .

  • @abhishekjain7645
    @abhishekjain7645 3 роки тому +2

    I bought the membership but I didn't received the study material

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

    Amazing krish

  • @ranjit9427
    @ranjit9427 3 роки тому +5

    Why is Iterator more memory efficient compared to the Generator??

    • @prannoyroy5312
      @prannoyroy5312 3 роки тому +6

      It is the other way round. Generators are memory-efficient ways of processing huge datasets. They process the data incrementally and do not allocate memory to all the results at the same time.

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

    for i in range(3):
    here "i" which will iterate through the range values. can we call that "i" as "iterator"?
    if not why?

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

      No because I doesn't iterate through the range of values. i represents each individual value in the range from 0 to 2.

  • @swadhikarc7858
    @swadhikarc7858 3 місяці тому

    Nice video krish. I can see the effort behind making people to understand 🫡

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

    Think about it generator is like yield return in c# which just return a list which you can iterate over it , multiple return rather than 1 return value

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

    I'm getting this error AttributeError: module 'collections' has no attribute 'Iterator' while calling this function issubclass(types.GeneratorType,collections.Iterator).

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

      issubclass(types.GeneratorType, collections.abc.Iterator) should work

  • @AshisRaj
    @AshisRaj Рік тому +1

    10:33 crux is here

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

    Well explained
    Thanks

  • @iftibuni
    @iftibuni 4 дні тому

    i think generators are more memmory efficent as they produce values on demand

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

    Plz tell if im wrong sir,
    In your 2 point yield save the local variable value.
    I think Yield hold the state of local variable.

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

    Sir, can you please make a video on decorators as well ??

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

    sir i have a query can you please share how to use the log values for a set of values in column

  • @kartiksharma-yw7qf
    @kartiksharma-yw7qf 3 роки тому +1

    Sir any update about data science 15 month course by ineuron?

  • @AnilKumar-do6nj
    @AnilKumar-do6nj 3 роки тому +1

    Hi this is anil how to read directly excel sheet wise data without download excel file s3 bucket using python please explan

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

    Still don't understand where this will be used

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

    As the 4th point, I think you mean the opposite, right?

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

    One small correction: Generators are more memory efficient than iterators in python.

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

    I want to learn python in hy head, first learn html first or c language Please Reply

  • @abhinavlakhani5637
    @abhinavlakhani5637 3 роки тому +2

    It looks like Iterators are using "linked lists" under the hood.🤔

  • @mdmamun-vp9xj
    @mdmamun-vp9xj 3 роки тому +3

    First viewer😘😍😍

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

    Why not we do the same task with functions

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

    i was thinking i would be 1 st comment 1 like 1 view but in 18 second 18 view and 7 likes

  • @MuhammadShahzad-dx5je
    @MuhammadShahzad-dx5je 3 роки тому

    #awesome

  • @amitsingh-ox4uo
    @amitsingh-ox4uo 2 роки тому

    Didn't make any sense.Where is it used?

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

    He has to know the difference and it's application. Video is not worth.

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

    Generator is memory efficient not iterator

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

    Not a good way of teaching.
    Doesn't make any sense

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

    Too many adds