The end to all language wars and the great unity API to come!
rantingrick
rantingrick at gmail.com
Wed Jul 6 09:41:52 EDT 2011
On Jul 6, 6:44 am, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> A control structure is a structure which controls the program flow. Control
> structures include:
>
> * jumps (goto, gosub, comefrom, exceptions, break, continue)
>
> * loops (for, while, repeat...until)
>
> * conditional branches (if, case/switch)
-------------------------------------------
THIS CODE RESULTS IN A CONTROL STRUCTURE!
--> lst.sort(lambda x,y: cmp(x[1], y[1]))
-------------------------------------------
I am using a user defined spec as an argument to the cmp function.
That spec then modifies the body of the compare function and creates a
user defined control structure. You can argue all day that it is not a
user defined control structure but no one is going to believe you.
> A function which includes a control structure inside it is not itself a
> control structure,
Of course the FUNCTION is not a control structure (not directly). No
wonder you are confused. It's the FUNCTION BODY that is the control
structure. The function body that has been modified by my arguments to
the cmp function. But in a way, you can say the function OWNS the code
block so it is itself a control structure. Still confused? Read on...
> in the same way that the existence of bones inside you
> does not make you a bone.
Bad analogy. See last comment.
> I see what you did there. First you put words into Cory's mouth that he did
> not say, they you try to criticise him based on those words -- YOUR words.
I quoted Corey exactly. And why do you feel the need to answer for
him?
> The cmp argument to sort is not a control structure because it is not a
> structure and it does not control the program flow.
Again you lack simple reading and comprehension skills. It's not the
argument that is the control structure itself. The argument is just
the SPEC for creating a control structure. The control structure is
the modified CODE BLOCK owned by the "CMP" function.
The modified code block owned by the cmp function-- defined by the
user through an argument spec-- controls the return value to the list
sort method. USER DEFINED CONTROL STRUCTURE. Plain and simple. I don't
think i can use any simpler terms to describe it.
Give it up man and admit i am correct and you are wrong.
More information about the Python-list
mailing list