Newbie:Considering using Python. Arrays?, Pointers?
Tom
tom22 at verio.com
Fri May 21 17:45:46 EDT 1999
Quinn,
Thank you so much for this reply. It is just what I was looking for!!
Tom
Quinn Dunkan wrote:
> On Fri, 21 May 1999 12:48:43 -0700, Tom <tom22 at verio.com> wrote:
> >Attached is a small "C" program that I wrote years ago that used pointers to
> >"linked lists" of "structures" (it finds the best match for the parallel
> >combination of two resistors...that should give away my real profession...E.E).
> >Admittedly, it is not very readable and would probably be less readable in
> >PERL. Also, the output data formatting is dreadfull and at one point I think I
> >just gave up making it "prettier".
>
> Well, you're in for a treat because handling arrays (lists) and structures
> (objects, which have the added benefit of storing behavior as well)) in Python
> is much less hassle than C. There is no need to construct linked lists,
> because python's lists are smart enough already. Instead of hacking up your
> own linked lists, just use python's lists, append() to append, sort() to sort,
> etc. Instead hacking up your own routine to store structures persistently in
> a file, just use pickle (or you could use a "real" database like gdbm (or sql
> if it's a lot more complicated than that)). Instead of futzing around with
> pointers and deferencing, just pass your data around directly. Error
> reporting will be much nicer (an exception rather than a random segfault, or
> whatever it is you get on windows).
>
> But read the tutorial at www.python.org. For me, python involves much more
> time thinking "how do I solve this?" while C involves much more thinking "how
> do I get C to do this?" From cursory examination of your source, it appears
> most of it is getting C to do things, and the actual math part is a small
> part, so this program ought to be a _lot_ shorter and easier in python.
>
> Anyway, this boils down to "yes". Learn python, use it, you'll like it.
>
> And what did you expect, posting to a python newsgroup :)
More information about the Python-list
mailing list