Re: A different kind of interface

2009-01-27 Thread BBands
PyScripter does it for me. http://code.google.com/p/pyscripter/ jab -- http://mail.python.org/mailman/listinfo/python-list

Re: name space problem

2007-10-24 Thread BBands
Thank you. jab -- http://mail.python.org/mailman/listinfo/python-list

Re: name space problem

2007-10-23 Thread BBands
On Oct 23, 4:20 pm, [EMAIL PROTECTED] wrote: > Hello. Indeed the doStuff function in the doStuff module can't do 'a.b > = 0' (the double dot was just a typo, right?) Yes. > because it doesn't know anything about an object named a. I was trying to understand why it worked when written in, but not

name space problem

2007-10-23 Thread BBands
An example: class classA: def __init__(self): self.b = 1 def doStuff(): some calcs a..b = 0 a = classA(): print a.b doStuff() print a.b That works as hoped, printing 1, 0. But, if I move doStuff to another module and: import doStuff class classA: def __init__(self):

Re: with as a reserved word

2007-06-11 Thread BBands
On Jun 11, 12:47 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > estimating what "a lot" is isn't trivial, but it's worth noting that a > search for "lang:python \swith\W" over at google's code search only > brings up about 200 cases, and most of those are found in comments and > string literals. a

Re: with as a reserved word

2007-06-11 Thread BBands
On Jun 11, 11:34 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > if you have Python 2.5, you can try it out yourself: > > >>> dict(with=1) > :1: Warning: 'with' will become a reserved keyword in Python 2.6 > {'with': 1} > > >>> from __future__ import with_statement > >>> dict(with=1) >File ""

with as a reserved word

2007-06-11 Thread BBands
I gather that 'with' is on its way to becoming a reserved word. Is this something that will break? import Gnuplot gp = Gnuplot.Gnuplot(debug=1) data = Gnuplot.Data([1,2,3,4,3,2,3,4,3,2,1], with='linespoints') gp.plot(data) >>> :3: Warning: 'with' will become a reserved keyword in Python 2.6 http

Python editor

2007-02-06 Thread BBands
No, no, no, this is not an invitation to the editor wars. I have been using José Cláudio Faria's superb Tinn-R, http://www.sciviews.org/Tinn-R/, with the R language, http://www.r-project.org/. This editor allows you to send code to the R shell for execution. You can easily send a line, the select

Re: time series data and NumPy

2007-01-26 Thread BBands
On Jan 26, 10:46 am, Robert Kern <[EMAIL PROTECTED]> wrote: > Yes, one can make numpy arrays with "object" as its type. One can even extend > the C-level parts as well. For example, we have an experimental package in the > scipy sandbox for uniform time series that uses mx.DateTime. > > http://www

Re: time series data and NumPy

2007-01-26 Thread BBands
On Jan 26, 10:18 am, Bob Greschke wrote: > You're using the Python-MySQL module mysqldb, right? Actually I using MySQL with pyodbc as the mysqldb Windows binaries for Python 2.5 aren't out yet. :-( > You can select the data from the database and have > MySQL do the conversion with an SQL command

Re: time series data and NumPy

2007-01-26 Thread BBands
On Jan 26, 9:29 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > What you could do would be to convert the date-column into a timestamp, > which is a int/long, and use that. Would that help? Actually that might help, as all I need the date for is to index values. Thanks, I'll give it a spin.

time series data and NumPy

2007-01-26 Thread BBands
Good morning, I store time series data in a SQL database. The results of a typical query using pyodbc look like this. DateClose "2007-01-17" 22.57 Where Date is a datetime.date object and Close is a float. I'd like to put this data in a NumPy array for processing, but am unsure as t

Reduced invective

2006-12-19 Thread BBands
My fat-fingered alter ego typed delete from iv where date > '2006-01-01'; instead of delete from iv where date > '2006-12-01'; leaving me with 50 tables to reload. :( estimated time to fix > several hours estimated invective dispensed during fix = classified Python to the rescue! import

Re: DDE (eSignal)

2006-11-30 Thread BBands
Thomas Heller wrote: > Looks like a bug, either in the dde module or the dde server. > But it's easy to find a workaround: > '1402.6700\x00\x12\x00*\x00\x00\x004\xfb\x12\x00\xfd\x1a\xd9w4\xc1\x00'.split("\0")[0] > '1402.6700' float(last.split("\0")[0]) works for me. Thanks for tha

DDE (eSignal)

2006-11-30 Thread BBands
I have a Python ap that needs current stock prices, which I want to get from eSignal's DDE server. Following the win32all example: import win32ui import dde server = dde.CreateServer() server.Create("eSignalDDE") conversation = dde.CreateConversation(server) conversation.ConnectTo("WINROS", "Last"

locating strings approximately

2006-06-28 Thread BBands
I'd like to see if a string exists, even approximately, in another. For example if "black" exists in "blakbird" or if "beatles" exists in "beatlemania". The application is to look though a long list of songs and return any approximate matches along with a confidence factor. I have looked at edit di

Re: list*list

2006-05-03 Thread BBands
Very useful comments... Thanks to all! Once again this community has demonstrated why Python is THE language. jab -- http://mail.python.org/mailman/listinfo/python-list

list*list

2006-05-01 Thread BBands
There must be a better way to multiply the elements of one list by another: a = [1,2,3] b = [1,2,3] c = [] for i in range(len(a)): c.append(a[i]*b[i]) a = c print a [1, 4, 9] Perhaps a list comprehension or is this better addressed by NumPy? Thanks, jab -- http://mail.python.org/

Tokens?

2006-04-18 Thread BBands
In the invaluable 'Dr. Dobb's Python-URL! - weekly Python news and links' of April 17 Peter Otten writes: "Michele Simionato's little script lets you search for a name in Python scripts, avoiding false positives that a standard tool like grep would yield." Can someone explain why this is so? I have

Re: Fuzzy Lookups

2006-02-03 Thread BBands
Diez B. Roggisch wrote: > I did a levenshtein-fuzzy-search myself, however I enhanced my version by > normalizing the distance the following way: > > def relative(a, b): > """ > Computes a relative distance between two strings. Its in the range > (0-1] where 1 means total equality. >

Re: Fuzzy Lookups

2006-01-30 Thread BBands
Diez B. Roggisch wrote: > I did a levenshtein-fuzzy-search myself, however I enhanced my version by > normalizing the distance the following way: Thanks for the snippet. I agree that normalizing is important. A distance of three is one thing when your strings are long, but quite another when they

Fuzzy Lookups

2006-01-30 Thread BBands
I have some CDs and have been archiving them on a PC. I wrote a Python script that spans the archive and returns a list of its contents: [[genre, artist, album, song]...]. I wanted to add a search function to locate all the versions of a particular song. This is harder than you might think. For exa

Re: Add lists to class?

2005-09-02 Thread BBands
> Why don't you use a real list instead? I am using lists... I just showed the naming schema. Here is how they are implemented. for var in range(len(self.symbols)): setattr(self, "_" + str(var), []) > I don't understand what > self.__dict__["_" + str(var)] gets you. It let's me access lists

Re: Add lists to class?

2005-09-02 Thread BBands
That's interesting and I take your point. Maybe there is a better way. Here is what I am doing now. (working) I start with a text file of ticker symbols. I read each symbol and stick it in a list, retrieve the data for it from MySQL, do a trivial smoothing and pass the data to a modeling routine.

Re: Add lists to class?

2005-09-02 Thread BBands
That's interesting and I take your point. Maybe there is a better way. Here is what I am doing now. (working) I start with a text file of ticker symbols. I read each symbol and stick it in a list, retrieve the data for it from MySQL, do a trivial smoothing and pass the data to a modeling routine.

Re: Add lists to class?

2005-09-01 Thread BBands
tested and working... jab, now possessing an embarrassment of riches, says "Thanks!" -- http://mail.python.org/mailman/listinfo/python-list

Re: Add lists to class?

2005-09-01 Thread BBands
Thanks to a generous Pyhtonista replied with a pointer to setattr(). jab -- http://mail.python.org/mailman/listinfo/python-list

Add lists to class?

2005-09-01 Thread BBands
I have a list with some strings in in it, 'one', 'two' 'three' and so on. I would like to add lists to a class with those names. I have no way of knowing what will be in the list or how long the list will be in advance. Something like: class master: def __init__(self, list): self.coun

Re: breaking up is hard to do

2005-03-28 Thread bbands
Cameron, Thanks for the heads up on that. (I have been following it, but from a long distance, as I very happy with my garden-variety Python.) Separately, let me offer you my thanks for your contributions to the community; they are great and they are much appreciated. The community around Python

Re: breaking up is hard to do

2005-03-28 Thread bbands
Thanks for your reply. That seems like an interesting and practical approach. However, I have one worry. In addition to the config file I am parsing command-line overrides to the config values via optparse. Many modules, classes and functions depend on these values, which means a lot of code dupli

Re: breaking up is hard to do

2005-03-25 Thread bbands
For example I have a class named Indicators. If I cut it out and put it in a file call Ind.py then "from Ind import Indicators" the class can no longer see my globals. This is true even when the import occurs after the config file has been read and parsed. John -- http://mail.python.org/mailman/

breaking up is hard to do

2005-03-25 Thread bbands
I've a 2,000 line and growing Python script that I'd like to break up into a modules--one class alone is currently over 500 lines. There is a large config.ini file involved (via ConfigParser), a fair number of passed and global variables as well as interaction with external programs such as MySQL (