Tuple Comprehension ???

Hen Hanna henhanna at gmail.com
Tue Feb 21 13:18:48 EST 2023


On Tuesday, February 21, 2023 at 9:33:29 AM UTC-8, Axy wrote:
> On 21/02/2023 04:13, Hen Hanna wrote: 
> > 
> > (A) print( max( * LisX )) 
> > (B) print( sum( * LisX )) <------- Bad syntax !!! 
> > 
> > What's most surprising is.... (A) is ok, and (B) is not. 
> > 
> > even tho' max() and sum() have (basically) the same syntax... ( takes one arg , whch is a list ) 
> > 
> > 
> > 
> >           i've been programming for many years... ( just  new to Python )



> LOL, python is full of surprises. I'd definitely step into the same 
> piece of... Someday. 
> 
> Of course 'Builtin functions' section explains that, but the 
> inconsistency is weird. 
> 
> My response is absolutely useless, just two cents on the issue. Maybe 
> someone will fix that. 
> 
> Axy.


i'm glad you get it         ( that the inconsistency is weird. )

        (1)     print(1, sum( [1,2,3,4] ))
        (2)     print(2, max( [1,2,3,4] ))

        (3)   print(3, sum( * [1,2,3,4] ))
        (4)   print(4, max( * [1,2,3,4] ))

both 3,4 should be good    OR
both 3,4 should be bad. ------------ that's what i think!

ok....  i thnk i finally got it...   (just before  seeing  Roel Schroeven's  msg)



More information about the Python-list mailing list