ANN: Dogelog Runtime, Prolog to the Moon (2021)

alister alister.ware at ntlworld.com
Wed Sep 15 14:45:39 EDT 2021


On Wed, 15 Sep 2021 18:40:52 +0000, alister wrote:

> On Wed, 15 Sep 2021 11:31:48 -0700, Mostowski Collapse wrote:
> 
>> There is a further problem with this:
>> 
>>> for i,term in enumerate(term.args):
>>> ____mark_term(term.args[i])
>> 
>> It should read:
>> 
>> for i,help in enumerate(term.args):
>> ____mark_term(help)
>> 
>> But then i isn't need.
> even Better (i had only skimmed the code as I was certain I would find
> this, it is probably the No. 1 thing new python programmers get wrong if
> your example is correct the it can be simplified even further to
> 
> for help in term.args:
>     mark_term(help)
> 
> & if help does not get used after this loop then a comprehension is even
> better _ == [mark_term(help) for help in term.args]
> 
> 
> the underscore character is python convention for an unneeded place-
> holder variable.
> 
> 
I also notice you are using match case - this was only introduced in 
python 10 so it is very new (i had not seen it before)
the break statements are probably not necessary as if ii understand this 
feature correctly python does not fall-through & execute every subsequent 
case after a successful match.

& finally the netiquette in this forum is to interleave of bottom post 
rather than top post, it makes it easier to follow the thread.
 




-- 
Don't quit now, we might just as well lock the door and throw away the 
key.


More information about the Python-list mailing list