Add readline capability to existing interactive program

2007-03-14 Thread Jacob Rael
Hello, I use an interactive simulator/data plotter called ocean. I get really frustrated using it because it does not have basic readline capabilities like ctrl-a for beginning of line and ctrl-k to kill the rest of the line. I was thinking this might be easy to add with Python. Do something like

c_string missing from ctypes?

2007-02-23 Thread Jacob Rael
Hello, I was following along with this site: http://www.brunningonline.net/simon/blog/archives/000659.html and I got a error. It boils down to: In [9]: import ctypes In [10]: dir(ctypes.c_string) ---

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Thanks all. I think I'll follow the "don't do that" advice. jr Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick

Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to learn/try a full blown parsing module. My simple script works well until it runs into functions that straddle

Re: Reading GDSII layouts

2006-11-28 Thread Jacob Rael
Funny, I started writing one this past weekend as a learning exercise (handling large files and start to use classes). If ipkiss does not work out, let me know specifically what you need and maybe my hack will work. jr Vincent Arnoux wrote: > Hello, > I am looking for a library for reading GDSII

Re: Using a browser as a GUI: which Python package

2006-05-01 Thread Jacob Rael
I am looking for the samething. I was thinking of Karrigell. http://karrigell.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: skip item in list "for loop"

2006-04-14 Thread Jacob Rael
Thanks for the suggestions. The solution I liked most was to prevent the lines from appearing in the first place!! -- http://mail.python.org/mailman/listinfo/python-list

skip item in list "for loop"

2006-04-14 Thread Jacob Rael
I am new to python and I love it. I am hacking a file. I want to not print a line if it contains the word 'pmos4_highv'. I also don't want to print the next line. The following code works but it "smells bad" and just doesn't look right. I was reading about generators. If I was using one, I could do

Re: parsing engineering symbols

2005-12-21 Thread Jacob Rael
Wow!! 261 v. 75 lines!! jr -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing engineering symbols

2005-12-21 Thread Jacob Rael
Just a newbie, trolling. I like this solution. Simple, easy to understand. Did you put the SI_prefixes outside the def so you could wrap the whole thing in a module and reuse it in other blocks? jr -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: generate a function based on an expression

2005-12-14 Thread Jacob Rael
Thanks for all the suggestions and comments!! I will try all those suggestions just to I can figure out how they work. For phase 1 of this project, I will probably go with the eval. thanks again, happy hacking... jr -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: generate a function based on an expression

2005-12-13 Thread Jacob Rael
Another example is a filter. From the CppSim doc: Filter filt("1+1/(2*pi*fz)s","C3*s + C3/(2*pi*fp)*s^2","C3,fz,fp,Ts",1/gain,fz,fp,Ts); jr -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: generate a function based on an expression

2005-12-13 Thread Jacob Rael
Overall I am trying to learn OOP by porting CppSim (http://www-mtl.mit.edu/~perrott) to Python. In CppSim, classes are defined that allow various functions to be defined, like amplifiers. In some cases they are linear: y = A*x some have offsets: y = A*x + off some are non-linear y = A*x - C*x

newbie: generate a function based on an expression

2005-12-12 Thread Jacob Rael
Hello, I would like write a function that I can pass an expression and a dictionary with values. The function would return a function that evaluates the expression on an input. For example: fun = genFun("A*x+off", {'A': 3.0, 'off': -0.5, 'Max': 2.0, 'Min': -2.0} ) >>> fun(0) -0.5 >>> fun(-10) -