[SciPy-user] What can be improved ?
Stef Mientki
s.mientki at ru.nl
Thu May 17 06:11:27 EDT 2007
Thank you all,
All your answers give me a better insight in a more "Pythonic" way of
programming,
but also raises some new questions / remarks.
First what (I think) I've learned,
- lists are a better object to continuously expand than arrays
- alternatives to detect / convert empty strings into floats
- iteration / enumeration techniques, coming from a "classical"
language I've to get some more experience with it
- library for direct reading of Excel files
- and most important, I'm amazed about large amount of people, all
gently willing to help, on this list, THANK YOU ALL !!
And here are some aspects, for which I still have doubts or questions:
- from .... import *
the use of this construct is discouraged, and gives a warning (the only
warning I get is from David ;-)
Coming from Delphi, it's very common to include everything you've available,
so you never have to worry missing something,
and if included in the right order,
you are guaranteed to have the best version of everything (due to
overrides),
while you're still able to use older/previous libraries, by explictly
naming them.
The compiler will sort out everything you don't need.
So what's so different in Python, that I can't include everything that's
on my PC ?
- use CSV, yes but how should I've known ?
I think (and it's mentioned before by others) this is one of the major
problems of Python,
"where should I find something ?". I've read the book "Learning Python",
but nothing is mentioned about CSV :-(
I sometimes look at the official Python guide of Guido van Rossum (not
this time ;-), but there's no printable version of it.
I wonder if there isn't some kind of program that can create an PDF file
from such a site.
It looks like the early days of Delphi, in that time you had about 10
different sites, each containing different kinds of information,
none of them was complete. Nowadays, there is just 1 site for Delphi
(http:\\www.torry.net\) where everything of Delphi can be found very
easily (both freeware and commercial).
btw MatLab also has 1 site, where everything can be found, but besides
the annoying log in procedure, it can absolutely not be compared to
Torry's Delphi site !!
- better to use an object than a function
Yes I've thought about that, but I had one major concern why I didn't
choose for an object (besides the fact that in the beginning I assumed
the function to be much smaller), and that concern is memory usage. I
also never see something as a "closefile()" ??
But maybe my fear is totally wrong.
I've never understood how objects are freed/destroyed in Python.
Knowing that file reading/parsing should be eventually be performed on
several hundred of files,
I'm afraid that all files will be in memory.
Using a function, I understand that after leaving the function, Python
destroys all internal function objects and thus freeing memory (I don't
know for sure if this is true).
Thats why I choose for a function instead of an object.
thanks again,
for listening and answering all those questions of an enthusiastic newbie,
cheers,
Stef Mientki
More information about the SciPy-User
mailing list