On 03/03/2021 01:01, Cameron Simpson wrote:
On 02Mar2021 15:06, Larry Martell wrote:
I discovered something new (to me) yesterday. Was writing a unit test
for generator function and I found that none of the function got
executed at all until I iterated on the return value.
Aye. Generators are
The in-person version of 'Friday Finking' has been set-aside by
COVID-precautions. Here's hoping the questions asked below will
stimulate some thinking, or mild entertainment...
On 02/03/2021 03.10, Grant Edwards wrote:
> On 2021-03-01, Greg Ewing wrote:
>> On 28/02/21 1:17 pm, Cameron Simpson w
On Fri, Mar 12, 2021 at 8:20 AM Serhiy Storchaka wrote:
>
> 01.03.21 23:59, Cameron Simpson пише:
> > On 28Feb2021 23:47, Alan Gauld wrote:
> >> On 28/02/2021 00:17, Cameron Simpson wrote:
> >>> BUT... It also has a __iter__ value, which like any Box iterates over
> >>> the subboxes. For MDAT tha
01.03.21 23:59, Cameron Simpson пише:
> On 28Feb2021 23:47, Alan Gauld wrote:
>> On 28/02/2021 00:17, Cameron Simpson wrote:
>>> BUT... It also has a __iter__ value, which like any Box iterates over
>>> the subboxes. For MDAT that is implemented like this:
>>>
>>> def __iter__(self):
>>>
On 02Mar2021 15:06, Larry Martell wrote:
>I discovered something new (to me) yesterday. Was writing a unit test
>for generator function and I found that none of the function got
>executed at all until I iterated on the return value.
Aye. Generators are lazy - they don't run at all until you ask f
On Tue, Mar 2, 2021 at 2:16 PM Chris Angelico wrote:
>
> On Tue, Mar 2, 2021 at 5:51 AM Alan Gauld via Python-list
> wrote:
> >
> > On 28/02/2021 00:17, Cameron Simpson wrote:
> >
> > > BUT... It also has a __iter__ value, which like any Box iterates over
> > > the subboxes. For MDAT that is impl
On Mon, 1 Mar 2021 at 19:51, Alan Gauld via Python-list
wrote:
> Sorry, a bit OT but I'm curious. I haven't seen
> this before:
>
> yield from ()
>
> What is it doing?
> What do the () represent in this context?
It's the empty tuple.
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Mar 2, 2021 at 5:51 AM Alan Gauld via Python-list
wrote:
>
> On 28/02/2021 00:17, Cameron Simpson wrote:
>
> > BUT... It also has a __iter__ value, which like any Box iterates over
> > the subboxes. For MDAT that is implemented like this:
> >
> > def __iter__(self):
> > yield f
On 28/02/2021 23:47, Alan Gauld via Python-list wrote:
> On 28/02/2021 00:17, Cameron Simpson wrote:
>
>> BUT... It also has a __iter__ value, which like any Box iterates over
>> the subboxes. For MDAT that is implemented like this:
>>
>> def __iter__(self):
>> yield from ()
>
> Sorr
On Wed, Mar 3, 2021 at 8:21 AM Dieter Maurer wrote:
>
> Alan Gauld wrote at 2021-2-28 23:47 +:
> >yield from ()
>
> "yield from iterator" is similar to "for i in iterator: yield i" (with
> special handling when data/exceptions are injected into the generator).
>
> Thus, "yield from ()" does es
Alan Gauld wrote at 2021-2-28 23:47 +:
>yield from ()
"yield from iterator" is similar to "for i in iterator: yield i" (with
special handling when data/exceptions are injected into the generator).
Thus, "yield from ()" does essentially nothing with the side effect
that the containing function
On 01/03/2021 00:47, Alan Gauld via Python-list wrote:
On 28/02/2021 00:17, Cameron Simpson wrote:
BUT... It also has a __iter__ value, which like any Box iterates over
the subboxes. For MDAT that is implemented like this:
def __iter__(self):
yield from ()
Sorry, a bit OT but I
On 01Mar2021 14:10, Grant Edwards wrote:
>That was certainly my reaction. Can you imagine the confusion if len()
>of a list returned the number of bytes required for srorage insttead
>of the number of elements?
Yeah, well the ancestry of these classes is a binary
deserialise/serialise base class
On 28Feb2021 23:47, Alan Gauld wrote:
>On 28/02/2021 00:17, Cameron Simpson wrote:
>> BUT... It also has a __iter__ value, which like any Box iterates over
>> the subboxes. For MDAT that is implemented like this:
>>
>> def __iter__(self):
>> yield from ()
>
>Sorry, a bit OT but I'm cur
On 28/02/2021 00:17, Cameron Simpson wrote:
> BUT... It also has a __iter__ value, which like any Box iterates over
> the subboxes. For MDAT that is implemented like this:
>
> def __iter__(self):
> yield from ()
Sorry, a bit OT but I'm curious. I haven't seen
this before:
yield fro
On 2021-03-01, Greg Ewing wrote:
> On 28/02/21 1:17 pm, Cameron Simpson wrote:
>> [its length in bytes] is presented via the object's __len__ method,
>
>> BUT... It also has a __iter__ value, which like any Box iterates over
>> the subboxes.
>
> You're misusing __len__ here. If an object is iterab
On 01Mar2021 00:06, MRAB wrote:
>I'm not seeing a huge problem here:
>
>Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928
>64 bit (AMD64)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
import time
class A:
>... def __len__(self)
On 28/02/21 1:17 pm, Cameron Simpson wrote:
[its length in bytes] is presented via the object's __len__ method,
BUT... It also has a __iter__ value, which like any Box iterates over
the subboxes.
You're misusing __len__ here. If an object is iterable and
also has a __len__, its __len__ shoul
On 2021-02-28 23:28, Peter Otten wrote:
On 28/02/2021 23:33, Marco Sulla wrote:
On Sun, 28 Feb 2021 at 01:19, Cameron Simpson wrote:
My object represents an MDAT box in an MP4 file: it is the ludicrously
large data box containing the raw audiovideo data; for a TV episode it
is often about 2GB
On 01Mar2021 00:28, Peter Otten <__pete...@web.de> wrote:
>On 28/02/2021 23:33, Marco Sulla wrote:
>>I can't reproduce, Am I missing something?
>>
>>marco@buzz:~$ python3
>>Python 3.6.9 (default, Jan 26 2021, 15:33:00)
>>[GCC 8.4.0] on linux
>>Type "help", "copyright", "credits" or "license" for mo
On 28Feb2021 10:51, Peter Otten <__pete...@web.de> wrote:
>On 28/02/2021 01:17, Cameron Simpson wrote:
>>I noticed that it was stalling, and investigation revealed it was
>>stalling at this line:
>>
>> subboxes = list(self)
>>
>>when doing the MDAT box. That box (a) has no subboxes at all and (
On 28/02/2021 23:33, Marco Sulla wrote:
On Sun, 28 Feb 2021 at 01:19, Cameron Simpson wrote:
My object represents an MDAT box in an MP4 file: it is the ludicrously
large data box containing the raw audiovideo data; for a TV episode it
is often about 2GB and a movie is often 4GB to 6GB.
[...]
Th
On Sun, 28 Feb 2021 at 01:19, Cameron Simpson wrote:
> My object represents an MDAT box in an MP4 file: it is the ludicrously
> large data box containing the raw audiovideo data; for a TV episode it
> is often about 2GB and a movie is often 4GB to 6GB.
> [...]
> That length is presented via the ob
On 28/02/2021 01:17, Cameron Simpson wrote:
I just ran into a surprising (to me) issue with list() on an iterable
object.
My object represents an MDAT box in an MP4 file: it is the ludicrously
large data box containing the raw audiovideo data; for a TV episode it
is often about 2GB and a movie i
I just ran into a surprising (to me) issue with list() on an iterable
object.
My object represents an MDAT box in an MP4 file: it is the ludicrously
large data box containing the raw audiovideo data; for a TV episode it
is often about 2GB and a movie is often 4GB to 6GB. For obvious reasons,
I
25 matches
Mail list logo