Re: Question About Command line arguments

2011-06-10 Thread Kurt Smith
On Fri, Jun 10, 2011 at 12:58 PM, Mark Phillips wrote: > How do I write my script so it picks up argument from the output of commands > that pipe input into my script? def main(): import sys print sys.stdin.read() if __name__ == '__main__': main() $ echo "fred" | python script.py fr

Re: How to use Python well?

2011-02-16 Thread Kurt Smith
On Wed, Feb 16, 2011 at 12:35 PM, snorble wrote: > I use Python a lot, but not well. I usually start by writing a small > script, no classes or modules. Then I add more content to the loops, > and repeat. It's a bit of a trial and error learning phase, making > sure I'm using the third party modul

Re: Trying to decide between PHP and Python

2011-01-06 Thread Kurt Smith
On Thu, Jan 6, 2011 at 3:32 PM, Alan Meyer wrote: > On 1/5/2011 11:40 AM, Tomasz Rola wrote: >> >> On Tue, 4 Jan 2011, Roy Smith wrote: >> >>> There.  Now that I've tossed some gasoline on the language wars fire, >>> I'll duck and run in the other direction :-) >> >> May I suggest a better strateg

Re: Need advice on starting a Python group

2010-03-12 Thread Kurt Smith
On Thu, Mar 11, 2010 at 8:57 AM, gb345 wrote: > > > > I'm hoping to get advice from anyone with prior experience setting > up a Python group. > > A friend of mine and I have been trying to start a > scientific-programming-oriented Python group in our school (of > medecine and bio research), with n

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Kurt Smith
On Thu, Feb 18, 2010 at 10:46 PM, Steve Howell wrote: > On Feb 18, 2:49 pm, Jonathan Gardner > wrote: >> On Feb 18, 8:15 am, Steve Howell wrote: >> >> >> >> >     def print_numbers() >> >         [1, 2, 3, 4, 5, 6].map { |n| >> >             [n * n, n * n * n] >> >         }.reject { |square, cu

Re: Over(joy)riding

2010-02-17 Thread Kurt Smith
On Wed, Feb 17, 2010 at 9:08 AM, mk wrote: > Bruno Desthuilliers wrote: >> >> mk a écrit : >>> >>> P.S. Method resolution order in Python makes me want to kill small >>> kittens. >> >> mro is only a "problem" when using MI. > > Oh sure! And I have the impression that multiple inheritance is not us

Re: Using jython to call python procedures/methods

2010-01-20 Thread Kurt Smith
On Wed, Jan 20, 2010 at 9:32 AM, KB wrote: > Hi there, > > I have an application that only publishes a Java API. I can use jython > to access java classes, but jython currently (to the best of my > knowledge) does not support numpy/scipy. > > Ideally I would like to have jython call a "native" pyt

Re: Python/Fortran interoperability

2009-08-24 Thread Kurt Smith
On Sun, Aug 23, 2009 at 9:21 AM, Stefan Behnel wrote: > n...@cam.ac.uk wrote: >> I am interested in surveying people who want to interoperate between >> Fortran and Python to find out what they would like to be able to do >> more conveniently, especially with regard to types not supported for C >>

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-22 Thread Kurt Smith
On Wed, Jul 22, 2009 at 2:48 AM, Bearophile wrote: > greg: >> Posting benchmark times for Pyrex or Cython is pretty >> meaningless without showing the exact code that was >> used, since times can vary enormously depending on >> how much you C-ify things. > > Was this link, shown by William, not eno

Re: Why not enforce four space indentations in version 3.x?

2009-07-10 Thread Kurt Smith
On Fri, Jul 10, 2009 at 2:22 PM, walterbyrd wrote: > I believe Guido himself has said that all indentions should be four > spaces - no tabs. > > Since backward compatibility is being thrown away anyway, why not > enforce the four space rule? > > At least that way, when I get python code from somebo

Re: Converting Python code to C/C++

2009-06-23 Thread Kurt Smith
On Mon, Jun 22, 2009 at 9:49 PM, Andras Pikler wrote: > Hi! > > > > Short: I need to turn a Python program that I (mostly) wrote into C code, > and I am at a loss. > > > > Long: I’m doing research/programming for a professor, and we are working > with MIDI files (a type of simple music file). The r

Re: Tool for browsing python code

2009-06-17 Thread Kurt Smith
On Tue, Jun 16, 2009 at 7:48 AM, Lucas P Melo wrote: > Is there any tool for browsing python code? (I'm having a hard time trying > to figure this out) > Anything like cscope with vim would be great. Check out pycscope: http://pypi.python.org/pypi/pycscope/0.3 I use it myself, and it works fine.

Re: Memory efficient tuple storage

2009-03-13 Thread Kurt Smith
On Fri, Mar 13, 2009 at 1:13 PM, psaff...@googlemail.com wrote: > Thanks for all the replies. > [snip] > > The numpy solution does work, but it uses more than 1GB of memory for > one of my 130MB files. I'm using > > np.dtype({'names': ['chromo', 'position', 'dpoint'], 'formats': ['S6', > 'i4', 'f8

Re: Memory efficient tuple storage

2009-03-13 Thread Kurt Smith
On Fri, Mar 13, 2009 at 11:33 AM, Kurt Smith wrote: [snip OP] > > Assuming your data is in a plaintext file something like > 'genomedata.txt' below, the following will load it into a numpy array > with a customized dtype.  You can access the different fields by name > (

Re: Memory efficient tuple storage

2009-03-13 Thread Kurt Smith
On Fri, Mar 13, 2009 at 10:59 AM, psaff...@googlemail.com wrote: > I'm reading in some rather large files (28 files each of 130MB). Each > file is a genome coordinate (chromosome (string) and position (int)) > and a data point (float). I want to read these into a list of > coordinates (each a tupl

Re: Indentations and future evolution of languages

2009-03-10 Thread Kurt Smith
On Tue, Mar 10, 2009 at 12:39 PM, wrote: > > >    John> The only complaint I have there is that mixing tabs and spaces for >    John> indentation should be detected and treated as a syntax error. > > Guido's time machine strikes again (fixed in Python 3.x): > >    % python3.0 ~/tmp/mixed.py >    

Re: Data Coding suggestions

2009-02-28 Thread Kurt Smith
On Sat, Feb 28, 2009 at 10:08 AM, steven.oldner wrote: > > Thanks guys.  While shopping today I've thought of a few more columns > for my data so my first item will be building the 3 DB tables and a > way to populate them.  Since this was intended to automate what I do > on a weekly basis, I didn

Re: can multi-core improve single funciton?

2009-02-20 Thread Kurt Smith
On Fri, Feb 20, 2009 at 4:27 PM, Grant Edwards wrote: > On one hand, the upshot of that is that by finding an > appropriate library module you might gain some of the same > benefits as removing the GIL. > > On the other hand, that doesn't help if you're doing something > original enough that nobod

Re: Regular expression bug?

2009-02-19 Thread Kurt Smith
On Thu, Feb 19, 2009 at 12:55 PM, Ron Garret wrote: > I'm trying to split a CamelCase string into its constituent components. > This kind of works: > re.split('[a-z][A-Z]', 'fooBarBaz') > ['fo', 'a', 'az'] > > but it consumes the boundary characters. To fix this I tried using > lookahead and

Re: number theory libraries / project euler

2009-02-18 Thread Kurt Smith
On Wed, Feb 18, 2009 at 2:18 PM, eliben wrote: > > Hello, > > What are some good & recommended number theory libs for Python (or > accessible interfaces to C libs), for things like primes, > factorization, etc. Naturally, speed is of utmost importance here. > > In other words, which Python librari

Re: Fortran array in python (f2py?)...

2009-02-14 Thread Kurt Smith
On Sat, Feb 14, 2009 at 2:06 PM, tripp wrote: > OK. It sounds like it would be easiest for me, then, to dump the > arrays to a binary file (much faster than dumping it to a text) from > the fortran program. Then use f2py to load a fortran module to read > it.?. I've done something similar and

Re: getting object instead of string from dir()

2008-12-17 Thread Kurt Smith
On Wed, Dec 17, 2008 at 1:52 PM, Rominsky wrote: > On Dec 17, 10:59 am, Christian Heimes wrote: > > Rominsky schrieb: > > > > > I am trying to use dir to generate a list of methods, variables, etc. > > > I would like to be able to go through the list and seperate the > > > objects by type using

Re: "xxx.has_key(a)" vs "a in xxx"

2008-10-30 Thread Kurt Smith
On Thu, Oct 30, 2008 at 9:37 AM, Łukasz Ligowski <[EMAIL PROTECTED]>wrote: > Hi, > > There is small inconsistency (or I don't understand it right) between > python > 2.5 docs and python 2.6 docs. > > 2.5 docs say that: > "a.has_key(k) Equivalent to k in a, use that form in new code" Meaning: do

Re: 'Hidden Features of Python'

2008-10-17 Thread Kurt Smith
On Fri, Oct 17, 2008 at 11:48 AM, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 17, 2008, at 10:35 AM, coldpizza wrote: > >> If you are using and IDE, such as Eclipse, PyScripter, etc, then CTR >> +click on 'this' should do the trick. >> In ipython you can do 'import this' and then type 'this??' O

Re: Read and write binary data

2008-09-08 Thread Kurt Smith
On Sun, Sep 7, 2008 at 5:41 PM, Mars creature <[EMAIL PROTECTED]> wrote: > Hi guys, > I am new to Python, and thinking about migrating to it from matlab > as it is a really cool language. Right now, I am trying to figure out If you're trying to migrate from matlab to python I'd take a look at num

Re: Histogram of floating point values.

2008-07-25 Thread Kurt Smith
On Fri, Jul 25, 2008 at 5:02 PM, aditya shukla <[EMAIL PROTECTED]> wrote: > Hello folks, > > I have a list say > > data=[0.99,0.98,0.98,0.98,0.97,0.93,0.92,0.92,0.83,0.66,0.50,0.50] > > i am trying to plot histogram of these values > > i have installed numpy and matplotlib and this is what i am do

Re: Books for learning how to write "big" programs

2008-05-22 Thread Kurt Smith
On Thu, May 22, 2008 at 10:55 AM, duli <[EMAIL PROTECTED]> wrote: > Hi: > I would like recommendations for books (in any language, not > necessarily C++, C, python) which have walkthroughs for developing > a big software project ? So starting from inception, problem > definition, design, coding and

Re: subprocess.popen function with quotes

2008-03-25 Thread Kurt Smith
On Wed, Mar 26, 2008 at 12:15 AM, skunkwerk <[EMAIL PROTECTED]> wrote: > On Mar 25, 9:25 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > En Wed, 26 Mar 2008 00:39:05 -0300, skunkwerk <[EMAIL PROTECTED]> > > escribió: > > > > > >>i'm trying to call subprocess.popen on the 'rename' f

New subclass vs option in __init__

2007-12-06 Thread Kurt Smith
Hi List: Class inheritance noob here. For context, I have the following base class and subclass: class Base(object): def __init__(self, val): self.val = val class Derived1(Base): def __init__(self, val): super(Derived1, self).__init__(val) I'm curious as to other's thou

Re: Newbi Q: Recursively reverse lists but NOT strings?

2007-10-15 Thread Kurt Smith
On 10/15/07, Gary Herron <[EMAIL PROTECTED]> wrote: > Dmitri O.Kondratiev wrote: > > Gary, thanks for lots of info! > > Python strings are not lists! I got it now. That's a pity, I need two > > different functions: one to reverse a list and one to reverse a string: > True, they are not both lists,

Re: What does the syntax [::-1] really mean?

2007-10-04 Thread Kurt Smith
On 10/4/07, Casey <[EMAIL PROTECTED]> wrote: [snippage] > > Following the reference to section 3.2 provides a (non-rigorous) > description of what a slice object is, in terms of the extended > slicing semantics. But it doesn't shed any additional light on the > meaning of [::-1]. > > >From this, I

Re: How to assign a function to another function

2007-09-17 Thread Kurt Smith
On 9/17/07, Stefano Esposito <[EMAIL PROTECTED]> wrote: > Hi all > > what i'm trying to do is this: > > >>>def foo (): > ... return None > ... > >>>def bar (): > ... print "called bar" > ... > >>>def assigner (): > ... foo = bar > ... You need to tell "assigner()" that foo doesn't belo

Re: Drawing a graph

2007-08-13 Thread Kurt Smith
On 8/12/07, Ghirai <[EMAIL PROTECTED]> wrote: > Hello list, > > I need to draw a graph, 2 axes, 2D, nothing fancy. > One of the axes is time, the other one is a series of integers. > > I don't care much about the output format. > > Are there any specialized libraries for this, or should i use PIL?

Re: Strange set of errors

2007-08-03 Thread Kurt Smith
On 8/3/07, Stephen Webb <[EMAIL PROTECTED]> wrote: > Greetings all, > > I've recently begun using Python to do scientific computation, and I wrote > the following script to find approximate eigenvalues for a semi-infinite > matrix: > > > from pylab import * > from numpy import * > from scipy impor

Re: Strange set of errors

2007-08-03 Thread Kurt Smith
Sorry, forgot to "Reply to all." On 8/3/07, Stephen Webb <[EMAIL PROTECTED]> wrote: > Greetings all, <> > Also, I've been having trouble with the plot function in matplotlib. For > example, I enter the following in the terminal: > > >>> from pylab import * > >>> plot([1,2,3]) > [] > I can help