Re: Using generator expressions

2023-09-25 Thread Chris Angelico via Python-list
On Tue, 26 Sept 2023 at 01:39, Jonathan Gossage via Python-list wrote: > > Many thanks, all. It turned out that my problem was not fully understanding > the use and power of the unpack operator *. Using it to activate my > generator made things start to work. I changed the line where I invoked the

Re: Using generator expressions

2023-09-25 Thread Jonathan Gossage via Python-list
Many thanks, all. It turned out that my problem was not fully understanding the use and power of the unpack operator *. Using it to activate my generator made things start to work. I changed the line where I invoked the generator to: y = test1(*(a for a in st)) adding the unpack operator. On

Re: Using generator expressions

2023-09-25 Thread Thomas Passin via Python-list
On 9/25/2023 10:15 AM, Jonathan Gossage via Python-list wrote: I am having a problem using generator expressions to supply the arguments for a class instance initialization. The following example shows the problem: class test1(object): def __init__(self, a, b): self.name = a

Re: Using generator expressions

2023-09-25 Thread Dom Grigonis via Python-list
y = test1(*[a for a in st]) y = test1(*st) Maybe any of these would be ok for you? Regards, DG > On 25 Sep 2023, at 17:15, Jonathan Gossage via Python-list > wrote: > > I am having a problem using generator expressions to supply the arguments > for a class instance initialization. The followi