ANN: ReportLab PDF Library version 2.0 and 1.21 released

2006-06-02 Thread John J. Lee
ReportLab are proud to announce not one but two major releases of our PDF document generation framework. The ReportLab PDF Toolkit lets you generate rich flowing documents in PDF from dynamic data, complete with multiple columns, tables and charts, at extremely high speeds; and to generate charts

[ANN] lxml 1.0 released

2006-06-02 Thread Stefan Behnel
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 lxml is a Pythonic binding for the libxml2 and libxslt libraries. It provides safe and convenient access to these

Re: image lib Qt4

2006-06-02 Thread Fredrik Lundh
Fredrik Lundh wrote: To get better performance, you should be able to use PIL's tostring() method together with the QImage(buffer, width, height, depth, colortable, numColors, bitOrder) form of the QImage constructor. for PyQt4, that seems to have changed to QImage(buffer, width, height,

Re: Are there something like Effective Python?

2006-06-02 Thread Ray
I think Aahz stated somewhere that he was workign on Effective Python. I'm not sure if it's an ongoing plan or it's been canned though? 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

Re: C# equivalent to range()

2006-06-02 Thread Michel Claveau
Hi! There are thousands of threads to choose from in this forum. If they didn't like this question, they could have picked any other one to discuss. There's no need to be disagreeable :-) I think the same thing. -- @-salutations Michel Claveau --

Re: Are there something like Effective Python?

2006-06-02 Thread BartlebyScrivener
I just finished reading Learning Python 3rd ed, For real? I thought there was only a 2nd edition. http://www.oreilly.com/catalog/lpython2/ -- http://mail.python.org/mailman/listinfo/python-list

Re: grouping a flat list of number by range

2006-06-02 Thread Paddy
Jim Segrave wrote: In article [EMAIL PROTECTED], Paddy [EMAIL PROTECTED] wrote: What I ran was more like the version below, but i did a quick separation of the line that has the ';' in it and goofed. def interv2(inlist): ... for i,val in enumerate(inlist): ... if i==0: ...

Import Issue

2006-06-02 Thread praveenkumar . 117
Hi all, I am facing a problem while importing a file in python script. After doing import file i am updating that file. Later i am accessing a dictionary contained in that file. Eventhough changes are reflected in the file... When i access a dictionary those

Re: grouping a flat list of number by range

2006-06-02 Thread Paddy
John Machin wrote: On 2/06/2006 8:36 AM, Paddy wrote: Oh the siren call of every new feature in the language! enumerate() just to get a first-time test, and then botch it?? Read the following; the replacement version uses a simple old-fashioned inelegant flag, works with an empty

tp_richcompare

2006-06-02 Thread Sreeram Kandallu
I'm writing an extension type, for which i'd like to implement only == and !=, but not the other comparison operators like ,=,,=. What is the right way to do this? I currently have a tp_richcompare function, which handles Py_EQ, and Py_NE, but raises a TypeError for the other operations. Is this

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

2006-06-02 Thread Fredrik Lundh
A.M wrote: are your boss aware of this ? In fact my boss is quite impressed with my progress so far. *your* progress ? /F -- http://mail.python.org/mailman/listinfo/python-list

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

2006-06-02 Thread Tim Golden
[ago] | Is it possible to use win32com.client to connect to a | specific instance | of a running application? In particular I am interested in finding the | instance of excel which has a particular spreadsheet opened | considering | that there might be more instances of excel running at the |

Re: struct: type registration?

2006-06-02 Thread Serge Orlov
John Machin wrote: On 2/06/2006 4:18 AM, Serge Orlov wrote: If you want to parse binary data use pyconstruct http://pyconstruct.wikispaces.com/ Looks promising on the legibility and functionality fronts. Can you make any comment on the speed? I don't know really. I used it for small

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

2006-06-02 Thread python
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(): global list1 list1=['a','b','c','d'] def method2():

Re: Trying to get FreeImagePy to work.

2006-06-02 Thread Iain King
Iain King wrote: Michele Petrazzo wrote: Iain King wrote: However, when I'm do the fipy.convertToPil(), it inverts the image? No, it not invert the image... It only return the image as is. I've inserted a fipy.invert() before the conversion as a temporary fix, but is there a

Re: Are there something like Effective Python?

2006-06-02 Thread Mike Meng
Bart, I'm sorry, it's 2nd edtion. Thanks. mike BartlebyScrivener 写道: I just finished reading Learning Python 3rd ed, For real? I thought there was only a 2nd edition. http://www.oreilly.com/catalog/lpython2/ -- http://mail.python.org/mailman/listinfo/python-list

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 bearophileHUGS
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[:] a [] a.append(20) a [20] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: How to format datetime values

2006-06-02 Thread Laurent Pointal
A.M a écrit : BartlebyScrivener [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Are you trying to get banned, or what? It's the equivalent of me asking you: Hey, does Ruby have anything like dictionaries and will you teach me about strings? Oh, and what's an object? Go read

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Maric Michaud
Le Vendredi 02 Juin 2006 00:12, [EMAIL PROTECTED] a écrit : I believe that 'is' tests equality of reference, such that a = range(1,3) b = range(1,3) a is b False The 'is' operator tells you whether a and b refer to the same object. Yeah ! That's it. And you proposed a definition of

Re: Python for Visual Basic or C# programmers

2006-06-02 Thread Laurent Pointal
A.M a écrit : Hi, I am trying to find the equivalent functions such as vb's str or asc in Python. Is there any resource that help me to find these kinds of functions in Python faster? mode pub=on I've written the PQRC for that purpose:

Re: tp_richcompare

2006-06-02 Thread Ziga Seilnacht
Sreeram Kandallu wrote: I'm writing an extension type, for which i'd like to implement only == and !=, but not the other comparison operators like ,=,,=. What is the right way to do this? I currently have a tp_richcompare function, which handles Py_EQ, and Py_NE, but raises a TypeError for

Re: How do you practice Python?

2006-06-02 Thread Norbert Kaufmann
Ray wrote: [...] Um, I mean, what if you have to use something other than Python/Jython/IronPython? :) How do you keep your Python skill sharp? You could use IPython as your primary shell. Than you have the opportunity to do all these nasty automation tasks -- create test data, deploy

Re: Function mistaken for a method

2006-06-02 Thread Christophe
Maric Michaud a écrit : Le Jeudi 01 Juin 2006 15:36, Christophe a écrit : self.x = self.__class__.f(0) nope, this will result in a TypeError unbound method must be called with instance as first argument Your right :( staticmethod it is then. --

how to define a static field of a given class

2006-06-02 Thread feel_energetic
Hi, I already knew how to define a static method of a class( using staticmethod() ),but I find there isn't a built-in func to build a static field ( something like staticfield() ) can anyone help me on this? thanks very much for your help :) --

Re: how to define a static field of a given class

2006-06-02 Thread Maric Michaud
Le Vendredi 02 Juin 2006 11:07, feel_energetic a écrit : Hi, I already knew how to define a static method of a class( using staticmethod() ),but I find there isn't a built-in func to build a static field ( something like staticfield() ) can anyone help me on this? thanks very

Re: Conditional Expressions in Python 2.4

2006-06-02 Thread bruno at modulix
A.M wrote: Hi, I am using Python 2.4. I read the PEP 308 at: http://www.python.org/dev/peps/pep-0308/ I tried the statement: a= Yes if 1==1 else No but the interpreter doesn't accept it. Do we have the conditional expressions in Python 2.4? No, AFAIK they'll be in for 2.5

Re: shuffling elements of a list

2006-06-02 Thread David C.Ullrich
On Thu, 01 Jun 2006 03:25:23 -0700, Erik Max Francis [EMAIL PROTECTED] wrote: David C. Ullrich wrote: Good example, because we know that EMF is not dumb. I've seen the same algorithm many times - the best example is ... Man, an error made _six years ago_ and people are still bringing it up

Re: how to define a static field of a given class

2006-06-02 Thread Rob Williscroft
feel_energetic wrote in news:1149239221.045268.6170 @g10g2000cwb.googlegroups.com in comp.lang.python: Hi, I already knew how to define a static method of a class( using staticmethod() ),but I find there isn't a built-in func to build a static field ( something like staticfield() )

Re: How do you practice Python?

2006-06-02 Thread Doug Bromley
On 6/2/06, Norbert Kaufmann [EMAIL PROTECTED] wrote: Ray wrote:[...] Um, I mean, what if you have to use something other than Python/Jython/IronPython? :) How do you keep your Python skill sharp?You could use IPython as your primary shell. Than you have the opportunity to do all these nasty

Re: Inheritance structure less important in dynamic languages?

2006-06-02 Thread bruno at modulix
Marvin wrote: Hi, It's been claimed s/claimed/observed/ In Python and Ruby, class hierarchies tends to be *really* flat when compared to Java or C++. that inheritance structures are less important in dynamic languages like Python. Why is that Don't you guess ?-) A very obvious point is

Re: how to define a static field of a given class

2006-06-02 Thread bruno at modulix
feel_energetic wrote: Hi, I already knew how to define a static method of a class( using staticmethod() ), FWIW, it's probably one of the most useless construct in Python IMHO. classmethod are really much more useful to me. but I find there isn't a built-in func to build a static

Re: how to define a static field of a given class

2006-06-02 Thread Maric Michaud
Le Vendredi 02 Juin 2006 11:47, bruno at modulix a écrit : FWIW, it's probably one of the most useless construct in Python IMHO. classmethod are really much more useful to me. +1 I do prefer classmethod, both for the name and behavior (everything should be intended for polymorphism, after all,

Re: how to define a static field of a given class

2006-06-02 Thread feel_energetic
thanks for all of your replies I did this before I posted the subject but got (NameError: global name 'startTime' is not defined) the most important thing i didn't know is the static field should be referred with the qualifier ClassName it's a little different from C++ :) (the static field

Re: struct: type registration?

2006-06-02 Thread [EMAIL PROTECTED]
using struct for the stuff you're up to and you'll finish with weird unmaintainable code. save yourself a lot of pain and use construct instead. http://pyconstruct.wikispaces.com/ -- http://mail.python.org/mailman/listinfo/python-list

import confused by contents of working directory

2006-06-02 Thread Jon
It appears that (windows) python searches in the current working directory before looking in the local site-packages directory, or that '.' comes first in sys.path? The problem arises when I made the mistake of running a test program from the same directory where I built and installed my package.

Re: Import Issue

2006-06-02 Thread A.T.Hofkamp
On 2006-06-02, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, After doing import file i am updating that file. Later i am accessing a dictionary contained in that file. Eventhough changes are reflected in the file... When i access a dictionary those changes are not there. I believe that

Selection in Tkinter Text widget.

2006-06-02 Thread Ant
Hi all, I have been trying to select text in a Text widget programmatically. I have been trying the following minimal example: #= from Tkinter import * def showgui(): win = Tk() area = Text(win, width = 50, height = 20) area.pack() new = Lots of

Re: Import Issue

2006-06-02 Thread Maric Michaud
Le Vendredi 02 Juin 2006 08:42, [EMAIL PROTECTED] a écrit : Hi all, After doing import file i am updating that file. Later i am accessing a dictionary contained in that file. Eventhough changes are reflected in the file... When i access a dictionary those changes are

Re: import confused by contents of working directory

2006-06-02 Thread Fredrik Lundh
Jon wrote: Would somebody please explain how to know what is going on when an import statement is ambiguous? there is no ambiguity: python searches through a list of directories, in a given order. the list is stored in the sys.path list, which you can inspect and modify freely. also see the

Re: shuffling elements of a list

2006-06-02 Thread Iain King
David C. Ullrich wrote: On 30 May 2006 21:53:32 -0700, greenflame [EMAIL PROTECTED] wrote: That's DSU for _sorting_ a list. I read about this, thought it was pretty neat. I thought that the fact that you could use the same trick for _shuffling_ a list was my idea, gonna make me rich and

Re: grouping a flat list of number by range

2006-06-02 Thread Jim Segrave
In article [EMAIL PROTECTED], Paddy [EMAIL PROTECTED] wrote: John Machin wrote: On 2/06/2006 8:36 AM, Paddy wrote: Oh the siren call of every new feature in the language! enumerate() just to get a first-time test, and then botch it?? Read the following; the replacement version uses a

Re: shuffling elements of a list

2006-06-02 Thread Peter Otten
Iain King wrote: or shorter but possible less readable (and only in 2.4+): def shuffle(data): return [y[1] for y in sorted([(random(), x) for x in data])] sorted() and list.sort() will happily accept a key function argument and then do the decorating/undecorating for you: from random

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Slawomir Nowaczyk
On Thu, 01 Jun 2006 19:16:16 -0700 [EMAIL PROTECTED] (Alex Martelli) wrote: # What does parallel mutations mean? In particular, what should be the # results of each of the following three comparisons: # # x, y, z = [1],[1],[1] # a, b = [x,y], [y,z] # c, d = [[1],[1]], [[1],[1]] # a == b #

Re: Selection in Tkinter Text widget.

2006-06-02 Thread Fredrik Lundh
Ant [EMAIL PROTECTED] wrote: I have been trying to select text in a Text widget programmatically. I have been trying the following minimal example: #= from Tkinter import * def showgui(): win = Tk() area = Text(win, width = 50, height = 20)

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

2006-06-02 Thread Piet van Oostrum
A.M [EMAIL PROTECTED] (AM) wrote: AM This is my 1st day that I am seriously diving into Python and I have AM to finish this application by the end of today. Are you serious? -- Piet van Oostrum [EMAIL PROTECTED] URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL

RE: Tkinter - changing existing Dialog?

2006-06-02 Thread Michael Yanowitz
Thanks. That is what I was looking for. The configure command (as you and John pointed out), should do what I need. The first response of starting a new thread was not what I was looking for. Michael Yanowitz -Original Message- In article [EMAIL PROTECTED], Michael Yanowitz [EMAIL

Re: Selection in Tkinter Text widget.

2006-06-02 Thread Ant
Fredrik Lundh wrote: ... it does, but by default, the selection is only shown for widgets that has the key- board focus. if you add an explicit focus_set() call, you'll see the selection. /F Perfect! Thanks Fredrik. Strange behaviour though (IMHO), that the selection is only shown if

Re: Tkinter: select multiple entries in Listbox widget?

2006-06-02 Thread SuperHik
Rob Williscroft wrote: Bernard Lebel wrote in news:mailman.6413.1149178158.27775.python- [EMAIL PROTECTED] in comp.lang.python: Hello, Is there an option or a way to allow the selection of multiple entries in the Listbox widget? I could not find any, and would like to allow the end user

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 Duncan Smith
python wrote: [snip] How could I keep the list1 not to change when remove list2's elements? You can't when the names list1 and list2 refer to the same list. Try making list2 a copy of list1, list2 = list(list1) Duncan -- http://mail.python.org/mailman/listinfo/python-list

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

2006-06-02 Thread ago
Thanks, after some further digging I hit something... The following seems to do the trick: import win32gui WINDOW_CLASS = 'XLMAIN' WINDOW_TITLE = 'Microsoft Excel - MySpreadsheet.xls' hwindow = win32gui.FindWindow(WINDOW_CLASS,WINDOW_TITLE) Now the next question is: how do I use the

Which exceptions are recommended to me handled?

2006-06-02 Thread Florencio Cano
Hello, Is it recommended as a good programming practice to catch all exceptions and raise our own exceptions or let Python itself raise these kinds of exceptions? For example imagine a function that needs an integer and '34' is passed, this is ok because inside the function it uses int(variable)

Tkinter

2006-06-02 Thread david brochu jr
Does anyone know how to get the value of the file selected when using tk_getOpenFile in Tkinter? -- http://mail.python.org/mailman/listinfo/python-list

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 SuperHik
[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[:] or simply a = [] a [] a.append(20) a [20] Bye, bearophile --

Re: Tkinter

2006-06-02 Thread Fredrik Lundh
david brochu jr wrote: Does anyone know how to get the value of the file selected when using tk_getOpenFile in Tkinter? why not use the tkFileDialog module: http://www.pythonware.com/library/tkinter/introduction/x1164-data-entry.htm ? /F --

Re: integer to binary...

2006-06-02 Thread Claudio Grondi
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: 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... Thanks Use the gmpy module. import gmpy a = 14 b = 7 c =

Re: losing handles of open files

2006-06-02 Thread Anthra Norell
- Original Message - From: Ben Finney [EMAIL PROTECTED] To: python-list@python.org Sent: Friday, June 02, 2006 12:30 AM Subject: Re: losing handles of open files Please don't post non-text message bodies to discussion forums. Message bodies should be plain text. Anthra Norell [EMAIL

ANN: ReportLab PDF Library version 2.0 and 1.21 released

2006-06-02 Thread John J. Lee
ReportLab are proud to announce not one but two major releases of our PDF document generation framework. The ReportLab PDF Toolkit lets you generate rich flowing documents in PDF from dynamic data, complete with multiple columns, tables and charts, at extremely high speeds; and to generate charts

[ANN] lxml 1.0 released

2006-06-02 Thread Stefan Behnel
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 lxml is a Pythonic binding for the libxml2 and libxslt libraries. It provides safe and convenient access to these

Re: Python for Visual Basic or C# programmers

2006-06-02 Thread Chris Lambacher
On Fri, Jun 02, 2006 at 10:26:28AM +0200, Laurent Pointal wrote: A.M a ?crit : Hi, I am trying to find the equivalent functions such as vb's str or asc in Python. Is there any resource that help me to find these kinds of functions in Python faster? mode pub=on I've

gadfly error gadfly instance has no attribute 'execute'

2006-06-02 Thread bussiere maillist
here is the error i've get :Traceback (most recent call last): File D:\Programmation\pitney\pitney.py, line 13, in ? connection.execute('create table personne(nom varchar)') AttributeError: gadfly instance has no attribute 'execute'i'am under windows and i still haven't found the errorhere is my

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

2006-06-02 Thread ago
The other approach I tried (as suggested by Tim, thanks) involves browsing the ROT. import pythoncom SPREADSHEET_NAME = r'\MySpreadsheet.xls' lenstr = len(SPREADSHEET_NAME) obj = None rot = pythoncom.GetRunningObjectTable() rotenum = rot.EnumRunning() while True: monikers = rotenum.Next()

Re: How do you practice Python?

2006-06-02 Thread Ant
In our field, we don't always get to program in the language we'd like For sure! to program. So... how do you practice Python in this case? Say you're doing J2EE right now. How do you practice Python to keep your skills sharp? Well, we have to use J2EE at work. I keep my Python skills going

Re: integer to binary...

2006-06-02 Thread John Salerno
[EMAIL PROTECTED] wrote: Use the gmpy module. Yes, it's good. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: integer to binary...

2006-06-02 Thread Sion Arrowsmith
Tim Chase [EMAIL PROTECTED] wrote: bitCount = len([c for c in 01001010101 if c==1]) bitCount = 01001010101.count(1) -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | Frankly I have no feelings towards penguins one way or the other \X/ |-- Arthur C. Clarke her nu

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

2006-06-02 Thread Sion Arrowsmith
gregarican [EMAIL PROTECTED] wrote: I came from using Ruby about a year or so [ ... ] That's an interesting way round. Why did you consider Python if you already knew Ruby, and which is now your preferred language? (I've no interest in learning Ruby, but from what I've seen of it I similarly

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

2006-06-02 Thread Sion Arrowsmith
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 appears to be a FAQ on this group, although I

Re: Are there something like Effective Python?

2006-06-02 Thread Brian
You might want to give this site a look: http://www.livewires.org.uk/python/ -- http://mail.python.org/mailman/listinfo/python-list

Sampling a population

2006-06-02 Thread Brian Quinlan
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 from that list (duplicates

Package

2006-06-02 Thread Matthieu Pichaud
I have a problem organizing my programs in packages and subpackages. I use python.2.3.3 I built a test structure to try to understand how it worked: /test /test/__init__.py (containing: __all__=['test1']) /test/test1/ /test/test1/__init__.py (containing: __all__=['test2'])

Re: Best Python Editor

2006-06-02 Thread Edward K. Ream
I like scite for small tasks, Leo for larger tasks and python scripting. Leo's script buttons are something probably no other tool has: http://webpages.charter.net/edreamleo/customizing.html#creating-script-buttons Edward

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

2006-06-02 Thread A.M
Sion Arrowsmith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] gregarican [EMAIL PROTECTED] wrote: I came from using Ruby about a year or so [ ... ] That's an interesting way round. Why did you consider Python if you already knew Ruby, and which is now your preferred language?

os.chdir doesn't accept variables sometimes

2006-06-02 Thread [EMAIL PROTECTED]
I have a strange problem with os.chdir... here is my script that I am using to edit the filenames of my music library: #!/usr/bin/python from os import * chdir(/home/chainlynx/Desktop/Music) for artist in listdir(getcwd()): print ===ARTIST: +artist chdir(artist) for

Re: grouping a flat list of number by range

2006-06-02 Thread Steven Bethard
[EMAIL PROTECTED] wrote: i'm looking for a way to have a list of number grouped by consecutive interval, after a search, for example : [3, 6, 7, 8, 12, 13, 15] = [[3, 4], [6,9], [12, 14], [15, 16]] Know your itertools. From the examples section[1]: # Find runs of consecutive numbers

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Aahz
In article [EMAIL PROTECTED], Alex Martelli [EMAIL PROTECTED] wrote: Just to share some tidbits (about which, as an Italian now living between San Francisco and San Jose, I'm sort of proud of...!-)...: Bank of America is a private bank, founded in San Francisco more than 100 years ago by an

Re: Are there something like Effective Python?

2006-06-02 Thread Aahz
In article [EMAIL PROTECTED], Mike Meng [EMAIL PROTECTED] wrote: 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

Re: Package

2006-06-02 Thread bruno at modulix
Matthieu Pichaud wrote: I have a problem organizing my programs in packages and subpackages. I use python.2.3.3 I built a test structure to try to understand how it worked: /test /test/__init__.py(containing: __all__=['test1']) /test/test1/ /test/test1/__init__.py(containing:

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 --

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 from

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: 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 them?

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

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

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(getcwd()):

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

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 stdin, line 1, in ?

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 a

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. Can you

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: 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 (sometime trickyà

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 = SomeBank

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: 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: 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 different serial

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 from that

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() rotenum =

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 uncertainty

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

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: -

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, 0.50), (d,

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

  1   2   >