New Python User Question about Python.

Chris Barker chrishbarker at home.net
Mon Aug 27 14:20:45 EDT 2001


Andrew Dalke wrote:
> Grant Griffin wrote:
> >But in all honesty, how often do you really
> >_need_ to do generic programming?  I'm guessing, only a very
> >small fraction of the time--1%, maybe?
 
> All the time.  I work with file-like objects, which are file

> handles, or cStringIOs, or StringIOs, or wrappers around file
> handles that allow pushing data back, or wrappers around compressed
> file streams, or popen file handles, or socket connections, or ....
> 
> I also work with strings that can be "" or u"" strings.

This is kind of my point: many of us do use dynamic typng a LOT, but
that doesn't mean that there is no point in creating an easy way to get
majpr speed improvment for when we don't need it... maybe grant will
create what I am looking for. (I am probably only 1/10 as smart as Tim,
so I'm sure I could be any help)

By the way, Python does have some of the kin dof optimization I am
looking for built in: strings. If strings were sinply tuples of
characters, we wouldn't have all those nifty string methods, or a fast
re module, and Python would be essentially unusable for string
processing, and I imagine is is fairly rare t  write a program that
doesn't use string processing.

Personally, I think Python without NumPy is similar: it seems insane to
me to represent a long sequence of numbers as a sequence of arbitrary
objects that happen to be numbers. Unfortunatlyl NumPy is not native
Pythin, and native Python has no concept of a homogenous sequence, so it
can be pretty awkward to even write C extensions that optimise working
with a homogenous sequence (and think how much list comprehensions could
be sped up if we had homogenous sequences!)


> But I do need it, and enjoy it.  I know how to do it in C++ but my
> fingers (and brain) aches thinking about it.

I don't know how to do it (or anything else) in C++, and my brain hurts
thinking about learning!!

-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list