Newbie asks(2): How to do this line of C in Py?
Joe Potter
jm7potter at hotmail.com
Wed Jul 11 09:59:08 EDT 2001
On Wed, 11 Jul 2001 09:19:48 -0400, Peter Hansen <peter at engcorp.com> wrote:
>Joe Potter wrote:
>>
>> On 10 Jul 2001 20:29:23 -0400, David Bolen <db3l at fitlinxx.com> wrote:
>>
<snip>
>> As a newbie to Python, I find that the one liners in c are easy to follow and the
>> translation into Python show me where I am missing Python techniques.
>>
>> My purpose in writing this is simply to say you are not just helping Mr. Wong when
>> you respond.
>
>Good point, Joe. My slightly boorish response failed to consider that fact.
>
I sorta figured you might have forgot that a lot of newbies lurk here.
(I wonder how many)
>
>On the other hand, posting obscure one-liners from C is not necessarily
>the best way to learn much, if anything about Python. Context is always
>useful, and the response might be different if more of the original
>C code were made available. I think this is similar to an attempt
>to translate from one spoken language into another, one word at a time,
>which looks like it works for a while but doesn't withstand serious
>scrutiny.
>
I have bought 5 books on Python in the last three weeks, and 2 on MySQL. I have a
working program now which uses Tkinter/Python/Gadfly. I had to pick up gui
programming and learn SQL to do the program the way I wanted. The folks here have
been wonderful --- make that damn wonderful --- in providing help. So, it is not as
if I am trying to learn Python with just his one-liners.
However, it has been great fun to see if I could do the little one-liners in Python
before I read what the crowd suggests. Sorta like problems in a math text with
answers in the back.
>(As it stands, Steve kindly wrote to me off-line and mentioned he was
>attempting to port GnuGo from C to Python as a learning exercise. If
>we want "context" we can always go look at the source ourselves. :-)
>
>Joe (and other self-professed newbies), why don't you find some other
>interesting one-liners (or two, or three-liners) and post them here?
>
I will try to do so as soon as I get the MySQL module working so I can port my little
program out of Gadfly and into MySQL.
>
>Maybe the code base for GnuGo is not one of the best sources of example
>code for conversion to Python... Based on a sample size of three,
>it consists of 33% strtok() calls and 67% sscanf() calls, making it
>one of the all-time poorest C programs! ;-)
One of the worst perhaps, but I am positive that I wrote the very worst one in 1986
while modeling population growth for a math grad class. Also, I think I recall that
extrapolation from a small data set can lead to erroneous conclusions.
:-)
Warmest Regards, Joe
More information about the Python-list
mailing list