Re: An oddity in list comparison and element assignment

2006-06-02 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > [snip] > > Can somebody please shut down this bot? I think it's running out of Much as you might love for somebody to "shut me down", that (unfortunately, no doubt, from your viewpoint) is quite unlikely to happen. Although "making predict

Re: Sampling a population

2006-06-02 Thread Brian Quinlan
Robert Kern wrote: > [numpy implementation snipped] > Ed Schofield has an implementation of an algorithm by Marsaglia[1] which turns > sampling into a fast table lookup. If your probabilities have limited > precision > (2**-30 or so rather than the full double precision 2**-52 or so), then this

Re: An oddity in list comparison and element assignment

2006-06-02 Thread anton . vredegoor
Alex Martelli wrote: [snip] Can somebody please shut down this bot? I think it's running out of control. It seems to be unable to understand that "don't be evil" might be good when you're small (at least it's not very bad) but that it becomes distinctly evil when you're big. What is good when

Re: how to erase a variable

2006-06-02 Thread Ben Finney
"greenflame" <[EMAIL PROTECTED]> writes: > Is there a way to get rid of a variable as though it never existed? I > know this sounds very basic but I have not come across any such > methods. You can use the 'del' statement to delete a name. > Also is the fact that I will have a bunch of extra var

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-02 Thread Warren Block
John Machin <[EMAIL PROTECTED]> wrote: > On 2/06/2006 9:08 AM, A.M wrote: >> Hi, >> >> Is there any built in feature in Python that can format long integer >> 123456789 to 12,3456,789 ? >> >> Thank you, >> Alan > > Not that I know of, but this little kludge may help: > 8<--- > import re > > subb

Re: Seg fault in python extension module

2006-06-02 Thread sam
Sorry, From MethodObject.h the 4th parameter is usually documented as having a NULL, but is intended to be used for a documentation string that will be available to the user under the various GUI IDE's such as IDLE or PyWin32. I just wanted to point that out.. struct PyMethodDef { const char

Re: Seg fault in python extension module

2006-06-02 Thread John Machin
On 3/06/2006 1:38 PM, sam wrote: > I recommend that you also replace the NULL after the METH_VARARGS with > a valid documentations string such as: > > static PyMethodDef modglMethods[] = >{ > { (char *)"glVertex4f", _wrap_glVertex4f, METH_VARARGS, "My > Doc String"}, > {

Re: how to erase a variable

2006-06-02 Thread John Machin
greenflame wrote: > Is there a way to get rid of a variable as though it never existed? I > know this sounds very basic but I have not come across any such > methods. Also is the fact that I will have a bunch of extra variables > just haning around because my use for them is over a bad thing? I wi

how to erase a variable

2006-06-02 Thread greenflame
Is there a way to get rid of a variable as though it never existed? I know this sounds very basic but I have not come across any such methods. Also is the fact that I will have a bunch of extra variables just haning around because my use for them is over a bad thing? I will likely have on the order

Re: Seg fault in python extension module

2006-06-02 Thread sam
I recommend that you also replace the NULL after the METH_VARARGS with a valid documentations string such as: static PyMethodDef modglMethods[] = { { (char *)"glVertex4f", _wrap_glVertex4f, METH_VARARGS, "My Doc String"}, { NULL, NULL, 0, NULL } }; Sam Schulenburg

Re: Making a second window with Tkinter

2006-06-02 Thread greenflame
Ok so I played with your script. Here is a script that more closely mimics what I would like to do except that the way I make the variable deckstr will be different. The only thing I am confused about is that it opens the second window in the beginning and when I click on the button, it does nothin

Re: beginner code problem

2006-06-02 Thread RJ
Thanks for all the help and examples. As I mentioned, I'm trying to teach myself and starting with the basics (if, elif, else, while, for, raw_input, int are about all I know so far and don't know that well yet) Some of the example posted are still beyond my understanding but it's good to see oth

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Alex Martelli
Terry Reedy <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > (As an aside, may I point out that Python In A Nutshell states on page > > 46 "The result of S*n or n*S is the concatenation of n copies of S". > > It would be more exact to say that S*n is

Re: Seg fault in python extension module

2006-06-02 Thread John Machin
On 3/06/2006 9:51 AM, Luke Miller wrote: > Hello, > > I am working on my first python module based on a c program. The > module builds and installs OK using dist-utils, and imports fine into > python. However, when I try and use the one wrapper > ("modgl.glVertex4f(1, 2, 3, 1)") in the module, it

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > (As an aside, may I point out that Python In A Nutshell states on page > 46 "The result of S*n or n*S is the concatenation of n copies of S". It > might be well to put a warning in a future edition that this is not > strictly the case.) Can you give me an exampl

Re: [ANN] lxml 1.0 released

2006-06-02 Thread Kent Johnson
Stefan Behnel wrote: > Hallo everyone, > > I have the honour to announce the availability of lxml 1.0. > > http://codespeak.net/lxml/ > > It's downloadable from cheeseshop: > http://cheeseshop.python.org/pypi/lxml Are there any plans to offer a Windows installer? Thanks, Kent -- http://mail.p

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > (As an aside, may I point out that Python In A Nutshell states on page > 46 "The result of S*n or n*S is the concatenation of n copies of S". It would be more exact to say that S*n is [] extended with S n times, which makes it clear

Re: announce: DaVinci Rendering Engine

2006-06-02 Thread Carl Banks
K.S.Sreeram wrote: > Hi All, > > I've started working on a new open source graphics library called > DaVinci. DaVinci aims to provide a declarative vector graphics based > framework for building GUIs. > > http://tachyon.in/davinci/ I hope it'll get St. John's face right this time. Carl Banks --

Re: check for dictionary keys

2006-06-02 Thread faulkner
def all(s): for x in s: if not x: return False return True bad_combos = [['-A', '-B'], ['-A', '-C'], ...] for bad_combo in bad_combos: assert not all([bad_elem in a for bad_elem in bad_combo]) [EMAIL PROTECTED] wrote: > hi > in my code, i use dict(a) to make to "a" into a dic

check for dictionary keys

2006-06-02 Thread micklee74
hi in my code, i use dict(a) to make to "a" into a dictionary , "a" comes from user input, so my program does not know in the first place. Then say , it becomes a = { '-A' : 'value1' , '-B' : "value2" , "-C" : "value3" , '-D' : 'value4' } somewhere next in my code, i will check for these..: 1)

Re: beginner code problem

2006-06-02 Thread Rene Pijlman
RJ: >import random >flip = random.randrange(2) >heads = 0 >tails = 0 >count = 0 >while count < 100: > if flip == 0: > heads += 1 > else: > tails += 1 > count += 1 Since flip isn't changed in the loop, this is going to report 100 heads or 100 tails, dep

[ANNOUNCE] pyPgSQL 2.5 released

2006-06-02 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, the last pyPgSQL release was in July 2003. Now, after a much too long time I went through all items in the bugtracker and created a release. pyPgSQL is a Python database adapter for PostgreSQL databases. Its homepage is at http://pypgsql.sf.ne

Re: beginner code problem

2006-06-02 Thread Rob Johnson
On 2006-06-02 19:25:28 -0400, John Machin <[EMAIL PROTECTED]> said: > Thanks for the reply John. I seem to be getting all the same problems > with your code that I had with mine so it may be an issue with Python > on this computer though I haven't had one prior to now. I'm running it > on OSX T

do you have a local copy of Lython?

2006-06-02 Thread faulkner
# Lython = Miles Egan's Lisp->Python compiler. The usual place http://www.caddr.com/code/lython/> throws a 404, and when I tried the email address in whois the server threw an error. I've asked around on a few forums, and somebody on irc.efnet.org/python suggested posting

Re: beginner code problem

2006-06-02 Thread DaveM
On Fri, 2 Jun 2006 18:41:53 -0400, RJ <[EMAIL PROTECTED]> wrote: > I'm trying to teach myself Python (probably running into the old dog >new tricks issue) and I'm trying to start with the very basics to get a >handle on them. > > I'm trying to write code to get the computer to flip a coin 100

Seg fault in python extension module

2006-06-02 Thread Luke Miller
Hello, I am working on my first python module based on a c program. The module builds and installs OK using dist-utils, and imports fine into python. However, when I try and use the one wrapper ("modgl.glVertex4f(1, 2, 3, 1)") in the module, it seg faults. Can anyone spot why this isn't working,

Re: Initializing an attribute that needs the object

2006-06-02 Thread John Machin
On 3/06/2006 9:17 AM, David Pratt **TOPPOSTED**: > Hi Bruno. This is certainly what I was missing. Thank you. I am afraid I > am behind the times with use of object. Will I only use object when I am > not subclassing? More precisely, don't use object when you are subclassing. > Where will I fi

Re: beginner code problem

2006-06-02 Thread Schüle Daniel
Hello > Here's the code I wrote: > > import random > > flip = random.randrange(2) > heads = 0 > tails = 0 > count = 0 > > while count < 100: > > if flip == 0: flip never changes again it's not reassigned in the while loop > heads += 1 > > else: > tails += 1 >

Re: beginner code problem

2006-06-02 Thread John Machin
On 3/06/2006 8:41 AM, RJ wrote: > I'm trying to teach myself Python (probably running into the old dog > new tricks issue) and I'm trying to start with the very basics to get a > handle on them. > > I'm trying to write code to get the computer to flip a coin 100 times > and give me the output

Re: Initializing an attribute that needs the object

2006-06-02 Thread David Pratt
Hi Bruno. This is certainly what I was missing. Thank you. I am afraid I am behind the times with use of object. Will I only use object when I am not subclassing? Where will I find a document that provides info on the use of object in new style classes? Many thanks. Regards, David Bruno Desthu

Re: Open Source Charting Tool

2006-06-02 Thread Piet van Oostrum
> Felipe Almeida Lessa <[EMAIL PROTECTED]> (FAL) wrote: >FAL> Em Sex, 2006-06-02 às 16:56 -0400, A.M escreveu: >>> I can't browse to www.reporlab.org, but I found http://www.reportlab.com/ >>> which has a commercial charting product. Is that what you referring to? >FAL> ReportLab (the comme

Re: Using pysqlite2

2006-06-02 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dennis Benzinger wrote: > [EMAIL PROTECTED] wrote: >> Is it possible to use this for sending triggers to a sqlite db?Could >> someone provide me with an example of how to do this please? >> Thanks > > Do you want to implement a trigger for a SQLite da

Re: after del list , when I use it again, prompt 'not defined'.how could i delete its element, but not itself?

2006-06-02 Thread Piet van Oostrum
> SuperHik <[EMAIL PROTECTED]> (S) escribió: >S> [EMAIL PROTECTED] wrote: >>> python wrote: after del list , when I use it again, prompt 'not defined'.how could i delete its element,but not itself? >>> >>> This is a way: >> a = range(10) >> del a[:] >S> or simply >S> a = []

beginner code problem

2006-06-02 Thread RJ
I'm trying to teach myself Python (probably running into the old dog new tricks issue) and I'm trying to start with the very basics to get a handle on them. I'm trying to write code to get the computer to flip a coin 100 times and give me the output of how many times heads and tails. After

Re: Initializing an attribute that needs the object

2006-06-02 Thread Bruno Desthuilliers
David Pratt a écrit : > Hi. I want to have different handlers to do perform logic. The problem > is the Handler requires an instance of the factory since it will use its > own methods in conjunction with methods of the factory. > > Once I have got a Factory instance I can give it a new handler (

Re: Open Source Charting Tool

2006-06-02 Thread Larry Bates
Ouch. I had a typo. -Larry Scott David Daniels wrote: > Felipe Almeida Lessa wrote: >> Em Sex, 2006-06-02 às 16:56 -0400, A.M escreveu: >>> I can't browse to www.reporlab.org, but I found >>> http://www.reportlab.com/ which has a commercial charting product. >>> Is that what you referring to? >

Re: Replace one element of a tuple (LONG)

2006-06-02 Thread Bruno Desthuilliers
Captain Dondo a écrit : (snip) > c=masterDB.cursor() > c.execute("""SELECT title, subtitle, starttime FROM recorded""") > > # build our dialog checkbox > > d = dialog.Dialog(dialog="dialog") > d.add_persistent_args(["--backtitle", "Myth2Go"]) > > recordings=[] > for listing in c.fetchall(): >

Re: Open Source Charting Tool

2006-06-02 Thread Tim Churches
A.M wrote: > I can't browse to www.reporlab.org, but I found http://www.reportlab.com/ > which has a commercial charting product. Is that what you referring to? Typo in the URL. Try http://www.reportlab.org You should also have a look at http://matplotlib.sourceforge.net/ Tim C -- http://mail

struct.pack('d', ...) -> "frexp() result out of range" (was Re: PyExcelerator)

2006-06-02 Thread John Machin
On 3/06/2006 3:39 AM, [EMAIL PROTECTED] wrote: > I write data to Excel files using PyExcelerator 0.6.3.a and have done > so successfully for small files (10-15 cells). I'm experiencing an > error when writing a big chunk of data (10,000 cells) to Excel. By way > of comparison, the same data writes

Re: Reversible replacement of whitespace characters with visible characters

2006-06-02 Thread Micah
James Stroud wrote: > Micah wrote: > > Hi, > > > > I'm looking for a tool to do the following 2 things: > > > > 1) Given a string (ie. file, std input, whatever), replace all > > whitespace characters with visible characters (like their Unicode value > > or something). The end result will be one l

Re: Open Source Charting Tool

2006-06-02 Thread Scott David Daniels
Felipe Almeida Lessa wrote: > Em Sex, 2006-06-02 às 16:56 -0400, A.M escreveu: >> I can't browse to www.reporlab.org, but I found http://www.reportlab.com/ >> which has a commercial charting product. Is that what you referring to? > > ReportLab (the commercial bussiness thing on .com) is where t

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread gregarican
I needed certain Windows specific libraries that were difficult to impossible to do in Ruby. For example the Qt toolkit, LDAP support, and a WinCE implementation. Python is more Windows-friendly so I ported certain apps over to Python since Ruby left me hanging in just those specifics areas. As fo

Re: Initializing an attribute that needs the object

2006-06-02 Thread David Pratt
My apologies. What I meant to write was this class Factory def __init__(self, handler): David Pratt wrote: > Hi Marco. Thanks for your reply. I am providing the handler with the > factory instance as I have shown. This is how my code currently works. > What I am trying to figure out

Re: Initializing an attribute that needs the object

2006-06-02 Thread David Pratt
Hi Marco. Thanks for your reply. I am providing the handler with the factory instance as I have shown. This is how my code currently works. What I am trying to figure out is how to possibly provide the handler in the constructor when it needs the factory instance. This would give me some better

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread Jarek Zgoda
Fredrik Lundh napisał(a): >>I am new to Python, with C#/Java background > > that's not really much of an excuse for not reading *any* Python tutorial > before > you jump in... That's a great idea, anytime I had a problem with Java I would write c.l.j with heading "I am new to Java, but have sol

Re: Making a second window with Tkinter

2006-06-02 Thread James Stroud
greenflame wrote: > I have a script that will make a window that shows the text I want > using Tkinter. What I need to do is to make another window popup above > the current window showing other text. I tryed: > > --- > from Tkinter imprt * > > root = Tk() > > L = Label(root, text="Blah"

[ANN] pkipplib v0.04 is out

2006-06-02 Thread Jerome Alet
Hi there, I'm pleased to announce pkipplib v0.04 This GPLed Python library allows you to create, manage or parse IPP (Internet Printing Protocol) requests. In addition, it exposes a CUPS() class which allows one to interact with a CUPS print server (or an IPP printer). Written in pure Python, t

Re: Initializing an attribute that needs the object

2006-06-02 Thread Marco Giusti
On Fri, Jun 02, 2006 at 06:15:28PM -0300, David Pratt wrote: >Hi. I want to have different handlers to do perform logic. The problem >is the Handler requires an instance of the factory since it will use its >own methods in conjunction with methods of the factory. > >Once I have got a Factory inst

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread Ravi Teja
A.M wrote: > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > A.M wrote: > > > >> This is my 1st day that I am seriously diving into Python and I have to > >> finish this application by the end of today. Maybe it wasn't a good idea > >> to choose the language that

Initializing an attribute that needs the object

2006-06-02 Thread David Pratt
Hi. I want to have different handlers to do perform logic. The problem is the Handler requires an instance of the factory since it will use its own methods in conjunction with methods of the factory. Once I have got a Factory instance I can give it a new handler (see below). It would be more fl

Re: Open Source Charting Tool

2006-06-02 Thread Felipe Almeida Lessa
Em Sex, 2006-06-02 às 16:56 -0400, A.M escreveu: > I can't browse to www.reporlab.org, but I found http://www.reportlab.com/ > which has a commercial charting product. Is that what you referring to? ReportLab (the commercial bussiness thing on .com) is where the main developers of ReportLab (a l

Re: Open Source Charting Tool

2006-06-02 Thread A.M
Hi Larry, I can't browse to www.reporlab.org, but I found http://www.reportlab.com/ which has a commercial charting product. Is that what you referring to? Thanks, Alan "Larry Bates" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > ReportLab Graphics can do 2D and pie char

Re: Open Source Charting Tool

2006-06-02 Thread Felipe Almeida Lessa
Em Sex, 2006-06-02 às 15:42 -0500, Larry Bates escreveu: > ReportLab Graphics can do 2D and pie charts, but I don't think it does > 3D charts yet. > > www.reporlab.org It does, but I'm not sure if the PNG backend is as good as the PDF one. -- Felipe. -- http://mail.python.org/mailman/listinfo

Making a second window with Tkinter

2006-06-02 Thread greenflame
I have a script that will make a window that shows the text I want using Tkinter. What I need to do is to make another window popup above the current window showing other text. I tryed: --- from Tkinter imprt * root = Tk() L = Label(root, text="Blah") L.grid(row=0, column=0) # Other lab

Re: after del list , when I use it again, prompt 'not defined'.how could i delete its element,but not itself?

2006-06-02 Thread Bruno Desthuilliers
python a écrit : > after del list , when I use it again, prompt 'not defined'.how could i > delete its element,but not itself? FWIW, del don't delete an object (not directly at least), it just delete the name<->object association. If (and only if) it was the only name referencing that object, th

Re: after del list , when I use it again, prompt 'not defined'.how could i delete its element,but not itself?

2006-06-02 Thread Bruno Desthuilliers
python a écrit : > after del list , when I use it again, prompt 'not defined'.how could i > delete its element,but not itself? > except list.remove(val) ,are there other ways to delete list 's > elements? > > and , I wrote: > > list1=[] > def method1(): Why naming a function "method" ? >

Re: Using pysqlite2

2006-06-02 Thread Dennis Benzinger
[EMAIL PROTECTED] wrote: > Is it possible to use this for sending triggers to a sqlite db?Could > someone provide me with an example of how to do this please? > Thanks Do you want to implement a trigger for a SQLite database in Python? That won't work. Triggers in SQLite can only contain UPDATE,

Re: Sampling a population

2006-06-02 Thread Roger Miller
For your example, since the probabilities are all multiples of 0.01 you could make a list of 100 elements. Set one of them to a, 5 of them to b, 50 of them to c, etc. Then just randomly sample from the table (which is O(1)). Of course if the probabilities can be arbitrary floating point values the

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread Bruno Desthuilliers
Fredrik Lundh a écrit : > "A.M" wrote: > > >>>are your boss aware of this ? >> >>In fact my boss is quite impressed with my progress so far. > > > *your* progress ? I think this meant "the progress status of the software". -- http://mail.python.org/mailman/listinfo/python-list

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread Bruno Desthuilliers
A.M a écrit : > Well the work is done now. I arrived home at 10:30 PM. > (snip) > > > Now that I finished the 1st part of the application, I have to admit that > choosing Python was an excellent decision. Python is an awesome programming > language with comprehensive library and great commun

Re: How do you practice Python?

2006-06-02 Thread sam
Years ago I developed a Hard Disk Drive diagnostic program "SCSIPython" while working for a disk drive company. When I left that company,and realized that these routines would never be used by the company, I released it as Open Source. Since then I have maintained this code, and enhanced it with t

Re: Reversible replacement of whitespace characters with visible characters

2006-06-02 Thread James Stroud
Micah wrote: > Hi, > > I'm looking for a tool to do the following 2 things: > > 1) Given a string (ie. file, std input, whatever), replace all > whitespace characters with visible characters (like their Unicode value > or something). The end result will be one long unbroken line > > 2) Given a

Re: Open Source Charting Tool

2006-06-02 Thread Larry Bates
ReportLab Graphics can do 2D and pie charts, but I don't think it does 3D charts yet. www.reporlab.org Larry Bates A.M wrote: > Hi, > > > > I developed a HTML reporting tool that renders Oracle data to HTML and > Oracle. > > > > At this point I have to add charts (3d bars and pie charts)

Re: integer to binary...

2006-06-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Grant Edwards wrote: > >>On 2006-06-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> >>>does anyone know a module or something to convert numbers like integer >>>to binary format ? >> >>They _are_ in binary format. >> >> >>>for example I want to convert number 7

Re: integer to binary...

2006-06-02 Thread Bruno Desthuilliers
Grant Edwards a écrit : > On 2006-06-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>does anyone know a module or something to convert numbers like integer >>to binary format ? > > > They _are_ in binary format. Not really. >>> (7).__class__ >>> dir((7)) ['__abs__', '__add__', '__and_

Re: integer to binary...

2006-06-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > does anyone know a module or something to convert numbers like integer > to binary format ? > > for example I want to convert number 7 to 0111 so I can make some > bitwise operations... You don't need to convert anything. The bitwise ops are &, |, <<, >> 0 | 2 | 4 -

Reversible replacement of whitespace characters with visible characters

2006-06-02 Thread Micah
Hi, I'm looking for a tool to do the following 2 things: 1) Given a string (ie. file, std input, whatever), replace all whitespace characters with visible characters (like their Unicode value or something). The end result will be one long unbroken line 2) Given a string altered as in step 1, "d

Re: Using print instead of file.write(str)

2006-06-02 Thread Bruno Desthuilliers
Sion Arrowsmith a écrit : > A.M <[EMAIL PROTECTED]> wrote: > >>I found print much more flexible that write method. > > > "more flexible"? More convenient, yes. More powerful, maybe. But I > don't see more flexible. Everything print can to stdout.write() can > do. The reverse isn't true. eg (this

Re: Conditional Expressions in Python 2.4

2006-06-02 Thread Bruno Desthuilliers
Steven Bethard a écrit : > A.M wrote: > > Do we have the conditional expressions in Python 2.4? > > bruno at modulix wrote: > (snip) > >> In the meanwhile, there are (sometime trickyà ways to get the same >> result: >> >> a = 1 == 1 and "Yes" or "No" >> a = ("No", "Yes")[1 == 1] > > And just

Open Source Charting Tool

2006-06-02 Thread A.M
Hi, I developed a HTML reporting tool that renders Oracle data to HTML and Oracle. At this point I have to add charts (3d bars and pie charts) to this application. I don't think that I have to do it from scratch. Is there any open source charting tool that help me create charts in JPG or

Re: Sampling a population

2006-06-02 Thread Robert Kern
Brian Quinlan wrote: > The fastest algorithm that I have been able to devise for doing so is: > O(n * log(len(lst))). Can anyone think or a solution with a better time > complexity? If not, is there an obviously better way to do this > (assuming n is big and the list size is small). numpy.searc

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread DataSmash
A simple way to get all the files throughout the directory sturcture... You may have to rewrite the "CONVERTING" part. import os, glob for root, dirs, files in os.walk(os.getcwd()): for file in files: if file.endswith(".mp3"): print "File: " + os.path.abspath(os.path.join(

Re: wxPython problems with Fedora Core 5

2006-06-02 Thread jerry . levan
writeson wrote: > Hi all, > > I'm trying to use wxPython from a fairly new installation of Fedora > Core 5. I installed wxPython using yum -y install wxPython and that all > seemed to work fine. However, when I run Python and do this: > > import wx > > I get this: > > Traceback (most recent call l

Re: How do you practice Python?

2006-06-02 Thread Jarek Zgoda
[EMAIL PROTECTED] napisał(a): >>In our field, we don't always get to program in the language we'd like >>to program. So... how do you practice Python in this case? > > Write code. Lots of it. Work on a project at home, contribute to > something open source, use it to write support scripts at wo

Re: An oddity in list comparison and element assignment

2006-06-02 Thread michael . f . ellis
Perhaps a little background to my original post will defuse some of the controversy. While working during an airline flight, I ran into an unexpected outcome from using the * replication operator to initialize an array of lists. When I modified a single element of the array an entire column chang

Returned mail: see transcript for details

2006-06-02 Thread Returned mail
Your message was not delivered due to the following reason(s): Your message could not be delivered because the destination computer was not reachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most lik

Using pysqlite2

2006-06-02 Thread [EMAIL PROTECTED]
Is it possible to use this for sending triggers to a sqlite db?Could someone provide me with an example of how to do this please? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Sampling a population

2006-06-02 Thread Terry Reedy
"Paddy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Brian Quinlan wrote: >> This is less a Python question and more a optimization/probability >> question. Imaging that you have a list of objects and there frequency in >> a population e.g. >> >> lst = [(a, 0.01), (b, 0.05), (c,

ANN: M2Crypto 0.16beta1

2006-06-02 Thread Heikki Toivonen
I am happy to announce the first beta of the M2Crypto 0.16 release. Please give these bits a spin and report any problems. I will be making new betas once a week (or more often if needed) until regressions are fixed. I expect the final 0.16 bits will be out by the end of June 2006. Highlights: -

can you iterate over a FieldStorage object?

2006-06-02 Thread John Salerno
I'm trying to use a for loop with a FieldStorage object and I get the following error. Can you not treat it like a dictionary, or am I writing the for loop incorrectly? for item in form: print item # or print item.value KeyErrorPython 2.2.1: /usr/bin/python Fri Jun 2 15:12:3

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Terry Hancock
Alex Martelli wrote: > to be called "identical" by ALL observers (because trying to > ascertain the differences, if any, would inevitably perturb the > systems irretrievably by Heisenberg's effect Not to detract from your point, but the "Heisenberg effect", if you mean the "Heisenberg uncertain

Re: win32com: how to connect to a specific instance of a runningobject?

2006-06-02 Thread Terry Reedy
"ago" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > solved, if it can be useful to others here is my code: > > import pythoncom > import win32com.client > > def getWorkbook(workbookName): > lenstr = len(workbookName) > workbook = None > rot = pythoncom.GetRunningObjectTable() > ro

Re: Sampling a population

2006-06-02 Thread Paddy
Brian Quinlan wrote: > This is less a Python question and more a optimization/probability > question. Imaging that you have a list of objects and there frequency in > a population e.g. > > lst = [(a, 0.01), (b, 0.05), (c, 0.50), (d, 0.30), (e, 0.04), (f, 0.10)] > > and you want to drawn n items fro

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Terry Hancock
Alex Martelli wrote: > Slawomir Nowaczyk <[EMAIL PROTECTED]> wrote: > > On Thu, 01 Jun 2006 13:40:34 -0700 [EMAIL PROTECTED] wrote: > > #> Scott David Daniels wrote: #> > Would you say that envelope > > containing five $100 bills is equal to #> > an envelope containing > > five $100 bills with dif

Re: Sampling a population

2006-06-02 Thread Mitja Trampus
Brian Quinlan wrote: > The fastest algorithm that I have been able to devise for doing so is: > O(n * log(len(lst))). Can anyone think or a solution with a better time > complexity? If not, is there an obviously better way to do this > (assuming n is big and the list size is small). If list is

Re: win32com: how to connect to a specific instance of a running object?

2006-06-02 Thread ago
solved, if it can be useful to others here is my code: import pythoncom import win32com.client def getWorkbook(workbookName): lenstr = len(workbookName) workbook = None rot = pythoncom.GetRunningObjectTable() rotenum = rot.EnumRunning() while True:

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Terry Reedy
"Aahz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Except, of course, that BofA doesn't exist anymore. Oh, the *name* > does, but what's now called BofA is simply the current name of the bank > that acquired BofA. In Pythonese, they performed SomeBank.extend(BofA) BofA = Some

Re: Conditional Expressions in Python 2.4

2006-06-02 Thread Steven Bethard
A.M wrote: > Do we have the conditional expressions in Python 2.4? bruno at modulix wrote: > No, AFAIK they'll be in for 2.5 Yep: Python 2.5a2 (trunk:46491M, May 27 2006, 14:43:55) [MSC v.1310 32 bit (Intel)] on win32 >>> "Yes" if 1 == 1 else "No" 'Yes' > In the meanwhile, there are (sometim

announce: DaVinci Rendering Engine

2006-06-02 Thread K.S.Sreeram
Hi All, I've started working on a new open source graphics library called DaVinci. DaVinci aims to provide a declarative vector graphics based framework for building GUIs. http://tachyon.in/davinci/ It is being built on top of Anti-Grain Geometry and PyQt4. Currently, dvpaint, a python wrapper

Re: execfile then import back

2006-06-02 Thread overly . crazy . steve
Dennis Lee Bieber wrote: > And the problem you are seeing is that the initial "v" in the t.py > that you "run", is considered "__main__.v", NOT "t.v" Yes, the 2 different copies of v apparently imply that __main__ and t are 2 different modules. But I had expected __main__ to be an alias of t

Re: How do you practice Python?

2006-06-02 Thread [EMAIL PROTECTED]
Ray wrote: > In our field, we don't always get to program in the language we'd like > to program. So... how do you practice Python in this case? Write code. Lots of it. Work on a project at home, contribute to something open source, use it to write support scripts at work, whatever. Figure out

wxPython problems with Fedora Core 5

2006-06-02 Thread writeson
Hi all, I'm trying to use wxPython from a fairly new installation of Fedora Core 5. I installed wxPython using yum -y install wxPython and that all seemed to work fine. However, when I run Python and do this: import wx I get this: Traceback (most recent call last): File "", line 1, in ? Fil

Re: Are there something like "Effective Python"?

2006-06-02 Thread gene tani
Mike Meng wrote: > Hi all, > I just finished reading Learning Python 3rd ed, and am doing my > first Python application, which retrieves and process text and XML > documents from Web. Python helped me to write the application in a few > hours, I'm very happy with its productivity. But the p

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > #!/usr/bin/python > > from os import * > > chdir("/home/chainlynx/Desktop/Music") > for artist in listdir(getcwd()): > print "===ARTIST: "+artist > chdir(artist) > for album in listdir(getcw

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread BartlebyScrivener
>> for album in listdir(getcwd()): doesn't listdir give you subdirectories AND files? So, then if you try to: chdir(album) If album is a file, it chokes? Just a guess. I'm on Windows, not Linux. rd -- http://mail.python.org/mailman/listinfo/python-list

PyExcelerator

2006-06-02 Thread tkpmep
I write data to Excel files using PyExcelerator 0.6.3.a and have done so successfully for small files (10-15 cells). I'm experiencing an error when writing a big chunk of data (10,000 cells) to Excel. By way of comparison, the same data writes perfectly well to a csv file using Python's built in cs

Re: Are there something like "Effective Python"?

2006-06-02 Thread Aahz
In article <[EMAIL PROTECTED]>, Mike Meng <[EMAIL PROTECTED]> wrote: > >For example, one of my friends read my program and suggest me to >move the re.compile() out of a for-loop, since the regular pattern is >fixed, and re.compile() is slow. I want to find more such advice, where >can I find th

Re: Conditional Expressions in Python 2.4

2006-06-02 Thread A.M
>> a = 1 == 1 and "Yes" or "No" >> a = ("No", "Yes")[1 == 1] Smart! Thanks alot. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sampling a population

2006-06-02 Thread Duncan Smith
Brian Quinlan wrote: > This is less a Python question and more a optimization/probability > question. Imaging that you have a list of objects and there frequency in > a population e.g. > > lst = [(a, 0.01), (b, 0.05), (c, 0.50), (d, 0.30), (e, 0.04), (f, 0.10)] > > and you want to drawn n items f

Re: Package

2006-06-02 Thread Max Erickson
I'm no expert, but your post made me curious. It appears that __all__ has the effect of ensuring that from test import * picks up test1, but doesn't go any further than that. from test.test1.test2 import * should cause test3 to be imported. max -- http://mail.python.org/mailman/listinfo/

  1   2   >