wisecracker at wisecracker at
Fri Feb 25 03:18:09 EST 2011

HI Steven...

> For *small* snippets, say, a single function, you can use the ActiveState Cookbook:
> A few random comments about your code:

Thanks duly noted...

>> # Original idea copyright, (C)2009, B.Walker, G0LCU.

> You can't copyright ideas.

True, but it is inside a Python file too. So therefore the idea is in a working state.

>> # >>> import afg[RETURN/ENTER]

> I thought you said you use only "STANDARD Python"? What's afg? It doesn't
> seem very standard to me:

> >>> import afg
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named afg

I made the mistake of making an assumption that intelligent guys like you
would know to save the first file as and the second as from the
import statements given... Oh well, can`t win `em all.

>> # Import any modules, ~sys~ is not rquired but added nevertheless.
>> import sys

> Don't do that. If you don't need a module, don't import it. *Especially* 
> don't import it only to say "Hey, you don't need this code, I'm just 
> wasting your time by making you read this!!!"

Duly noted...

>> # The program proper...
>> def main():
>> 	# Make all variables global, a quirk of mine... :)

> It's not 1970 any more. People will avoid like the plague code that over-uses globals.

Maybe not but I code for 10 year olds to understand and be able to modify easily, I build
HW for 10 year olds to make, modify and understand, I marry the two for 10 year olds to
modify and understand.

Mine is easy to understand even by programmer of limited knowledge.
Most of the Python code I`ve seen would be just visual 'noise' to a 10 year old.

> 	sine=chr(15)+chr(45)+chr(63)+chr(45)+chr(15)+chr(3)+chr(0)+chr(3)

> This is much more easily and efficiently written as:

> sine = ''.join([chr(n) for n in (15, 45, 63, 45, 15, 3, 0, 3)])

> or even shorter, as a string constant:

> sine = '\x0f-?-\x0f\x03\x00\x03'

Now show your code to a 10 year old and see if he understands it...

Anyhow, thanks for the reply...



Bazza, G0LCU...

Team AMIGA...

More information about the Python-list mailing list