General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Dr Gamma D
Indently
comments
Comments by "Dr Gamma D" (@DrDeuteron) on "What exactly is 'yield from' in Python? [Easy explanation]" video.
no, that's good. you shuffle the deck into a collections deque, wrapped in your personal Deck class with a dunder next that calls deque's popleft(). that's nice. You can't go back in a deal. So for hold em you;d have "burn" method which calls next(self), while the deal(self, n, m) (n=players, m=hole cards which is 2 for hold em, 4 for PLO), which would deal n*m into some zip() construction.
3
really? I just don't ever want to initialize and empty list and fill it with a loop (or thing that are two complex for a comprehension, and things that are computationally hard).
1
@y2ksw1 maybe just write some code that uses them? Like a toy card game for instance. Learn by using? Then you 'll see where they work better than containers (list, tuple..). Also: itertools "tee" function is pretty cool, if you have terms in a series that go to two different formula (e.g. sum(x^2) and sum(x)^2 calculations, it's very cool. It makes a difference when the computations are hard and the terms in the series a huge messes, e.g some big data file or something). Actually that's a good case--say you want read 1000 100kB data files and compute a metric from it. Your not going to open 1000 files and load them into a list and then loop over that, rather: a generator that yields each file into a metric computing function, so the user just see "file name" turned into 1000 element array, and dev sees each step separated into. The file read can be an iterator to, so you yield file reading iterators straight into a function of it's contents. idk...if that makes sense at all in a yt comment. Need a white board.
1