Re: Thread Question

2006-02-28 Thread Grant Edwards
On 2006-02-28, Felipe Almeida Lessa [EMAIL PROTECTED] wrote: # He meant calling direct vs. subclassing. In your example you called the Thread class directly, but you could have subclassed it. Yup. I should have realized that. # In your case, Edwards, I'd prefer subclassing because then

Re: Thread Question

2006-02-28 Thread Kent Johnson
D wrote: My question is, how would I go about creating the thread? I have seen examples that used classes, and other examples that just called one thread start command - when should you use one over another? For simple use it doesn't matter. Use a class when you want to add more state or

Re: minimize a program into an icon on the taskbar.

2006-02-28 Thread Larry Bates
Frank Niessink wrote: Rajesh Sathyamoorthy: Hi, I would know how to minimize a program (wxpython app) into an icon on the taskbar on windows (the one at the side near the clock, i can't remember what is it called.) Is it easy to be done? Is there a way to do the same thing on Linux? Did

Re: Looking for Pythonic Examples

2006-02-28 Thread Larry Bates
G. Völkl wrote: Hello I am looking for examples of Pythonic Thinking: One example I found: Here some lines of the web side of Bruce Eckel: http://www.mindview.net/WebLog/log-0053 How to read a text file: for line in file(FileName.txt): # Process line It is a easy and sophisticated

Re: Thread Question

2006-02-28 Thread D
Guys - I appreciate the clarification. So it looks like they used a class for the ping thread because they were a) running multiple instances of the thread concurrently and b) needing to keep track of the state of each instance, correct? I believe that in my case, since I will be just running

Re: minimize a program into an icon on the taskbar.

2006-02-28 Thread Frank Niessink
Larry Bates: Its called the system tray and here is a link to some sample code for Windows I found via Google: But, but, but, ... the OP was talking about a wxPython app. wx.TaskBarIcon is the wxPython builtin support for making an icon in the system tray. Nothing else is needed. Cheers,

Py2exe

2006-02-28 Thread D
I have a simple client/server file server app that I would like to convert to a single .exe. The client is just uses Tkinter and displays a simple GUI. The server has no GUI and just listens for and processes connections. How can I convert these 2 files to an .exe, while enabling the server app

Re: Python Indentation Problems

2006-02-28 Thread Terry Hancock
On 26 Feb 2006 22:21:26 -0800 [EMAIL PROTECTED] wrote: I am a newbie to Python. I am mainly using Eric as the IDE for coding. Also, using VIM and gedit sometimes. I had this wierd problem of indentation. My code was 100% right but it wont run because indentation was not right. I checked

OT The Art

2006-02-28 Thread julianlzb87
Illuminated manuscripts, 13 volumes http://ptlslzb87.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Terry Hancock
On 28 Feb 2006 09:58:47 -0800 [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Add me to the me, too! list of people who think enumerations would be better off without or comparison. +1 on unordered Comparable enums do have use-cases (like the days of the week), but I can't think of many of them.

Re: Py2exe

2006-02-28 Thread jay graves
First google.com hit using your title. http://www.google.com/search?q=py2exe -- http://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib logarithmic scatter plot

2006-02-28 Thread Derek Basch
Thanks again. Here is the finished product. Maybe it will help someone in the future: from pylab import * def log_10_product(x, pos): The two args are the value and tick position. Label ticks with the product of the exponentiation return '%1i' % (x) ax = subplot(111) # Axis scale

Re: Py2exe

2006-02-28 Thread D
Jay - what I'm not sure of is the syntax to use. I have downloaded and installed py2exe. -- http://mail.python.org/mailman/listinfo/python-list

Re: Py2exe

2006-02-28 Thread Larry Bates
D wrote: Jay - what I'm not sure of is the syntax to use. I have downloaded and installed py2exe. First a question: Have you written the server program as a windows service? You can't just run something as a service, it has to be written to be a service. Your setup files will look

Re: Make staticmethod objects callable?

2006-02-28 Thread Steven Bethard
Nicolas Fleury wrote: I was wondering if it would make sense to make staticmethod objects callable, so that the following code would work: class A: @staticmethod def foo(): pass bar = foo() Do you have a real-world use case? I pretty much never use staticmethods (preferring

Re: Make staticmethod objects callable?

2006-02-28 Thread Felipe Almeida Lessa
Em Ter, 2006-02-28 às 15:17 -0500, Nicolas Fleury escreveu: class A: @staticmethod def foo(): pass bar = foo() # Why not: def foo(): pass class A: bar = foo() foo = staticmethod(foo) -- Quem excele em empregar a força militar subjulga os exércitos dos outros

Re: Get my airlines boarding pass

2006-02-28 Thread James Stroud
rh0dium wrote: Hi all, Has any of you fine geniuses figured out a nice python script to go to the Southwest airlines website and check in, and retrieve your boarding pass - automatically 24 hours in advance Not yet, but I think you are the real genius here. Brilliant idea. --

Re: type = instance instead of dict

2006-02-28 Thread James Stroud
Fredrik Lundh wrote: James Stroud wrote: Perhaps you did not know that you can inheret directly from dict, which is the same as {}. For instance: class Dict({}): pass I must have been hallucinating. I swear I did this before and it worked just like class Dict(dict). Since it doesn't

Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread Derek Basch
Given a value (x) that is within the range (1e-1, 1e7) how do I round (x) up to the closest exact logarithmic decade? For instance: 10**3 = 1000 x = 4978 10**4 = 1 x = 1 Thanks Everyone! Derek Basch -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread Fredrik Lundh
Derek Basch wrote: Given a value (x) that is within the range (1e-1, 1e7) how do I round (x) up to the closest exact logarithmic decade? For instance: 10**3 = 1000 x = 4978 10**4 = 1 x = 1 how about import math def roundup(x): ...return

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread jao
Quoting Derek Basch [EMAIL PROTECTED]: Given a value (x) that is within the range (1e-1, 1e7) how do I round (x) up to the closest exact logarithmic decade? For instance: How about this: def roundup(x): if x 1: return 1 else: return '1' + ('0' * len(str(int(x

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread Felipe Almeida Lessa
Em Ter, 2006-02-28 às 17:47 -0500, [EMAIL PROTECTED] escreveu: Quoting Derek Basch [EMAIL PROTECTED]: Given a value (x) that is within the range (1e-1, 1e7) how do I round (x) up to the closest exact logarithmic decade? For instance: How about this: def roundup(x): if x 1:

RE: MySQLdb compile error with AMD64

2006-02-28 Thread Heiko Wundram
[EMAIL PROTECTED] wrote: Can anyone offer any assistance on this one? Look here: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-x86_64-2.4/_mysql.o

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread Derek Basch
Thanks effbot. I knew their had to be something buried in the math module that could help. ceil() it is! /dTb -- http://mail.python.org/mailman/listinfo/python-list

Re: Firebird and Python

2006-02-28 Thread Claudio Grondi
haxier wrote: All the info you need is in the kinterbasdb module. I've worked with it under windows and Linux and... it just works. Really well indeed. I'd recommend it a lot. http://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_embedded_using_with -- Asier. Thanks - you

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread Grant Edwards
On 2006-02-28, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Derek Basch [EMAIL PROTECTED]: Given a value (x) that is within the range (1e-1, 1e7) how do I round (x) up to the closest exact logarithmic decade? For instance: How about this: def roundup(x): if x 1: return

Re: Make staticmethod objects callable?

2006-02-28 Thread Nicolas Fleury
Felipe Almeida Lessa wrote: Em Ter, 2006-02-28 às 15:17 -0500, Nicolas Fleury escreveu: class A: @staticmethod def foo(): pass bar = foo() # Why not: def foo(): pass class A: bar = foo() foo = staticmethod(foo) Well, you could even do: class A:

Re: Make staticmethod objects callable?

2006-02-28 Thread Nicolas Fleury
Steven Bethard wrote: Nicolas Fleury wrote: I was wondering if it would make sense to make staticmethod objects callable, so that the following code would work: class A: @staticmethod def foo(): pass bar = foo() Do you have a real-world use case? I pretty much never use

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread johnzenger
I like Fredrik's solution. If for some reason you are afraid of logarithms, you could also do: x = 4978 decades = [10 ** n for n in xrange(-1,8)] import itertools itertools.ifilter(lambda decade: x decade, decades).next() 1 BTW, are the python-dev guys aware that 10 ** -1 =

Re: PyQT: QDialog and QMainWindow interacting with each other

2006-02-28 Thread Fabian Steiner
Hi Kai! Kai Teuber wrote: Hi Fabian, override the accept() method and call self.showListViewItems() there. But remember to call QDialog.accept() at the end. def accept( self ): self.showListViewItems() QDialog.accept( self ) Thank you very much, I got it working :-) Cheers,

ANN: Extended Python debugger 1.14

2006-02-28 Thread R. Bernstein
Download from http://sourceforge.net/project/showfiles.php?group_id=61395package_id=175827 On-line documentation is at http://bashdb.sourceforge.net/pydb/pydb/lib/index.html Changes since 1.12 * Add MAN page (from Debian) * Bump revision to 0.12 to 1.13 to be compatible with Debian pydb package.

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread Grant Edwards
On 2006-02-28, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I like Fredrik's solution. If for some reason you are afraid of logarithms, you could also do: x = 4978 decades = [10 ** n for n in xrange(-1,8)] import itertools itertools.ifilter(lambda decade: x decade, decades).next() 1

Use empty string for self

2006-02-28 Thread paullanier
It seems that lots of people don't like having to prefix self. in front of instance variables when writing methods in Python. Of course, whenever someone suggests doing away with 'self' many people point to the scoping advantages that self brings. But I hadn't seen this proposal when I searched

Re: Rounding up to the nearest exact logarithmic decade

2006-02-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: BTW, are the python-dev guys aware that 10 ** -1 = 0.10001 ? http://docs.python.org/tut/node16.html /F -- http://mail.python.org/mailman/listinfo/python-list

Re: Use empty string for self

2006-02-28 Thread Peter Hansen
[EMAIL PROTECTED] wrote: It seems that lots of people don't like having to prefix self. in front ... But what if we keep the '.' and leave out the self. ... Any comments? Has this been discussed before? Yes, at least once (found by group-googling for removing self in this newsgroup):

Re: type = instance instead of dict

2006-02-28 Thread Cruella DeVille
This is off topic, but if read the documentation is the answere to everything why do we need news groups? The problem with the documentation for Python is that I can't find what I'm looking for (and I didn't even know what I was looking for either). And since every language is well documented...

Re: Py2exe

2006-02-28 Thread D
Thanks Larry - that is exactly what I needed! I do have the program written to be a service, and now plan to use py2exe and Inno Setup to package it up. Doug -- http://mail.python.org/mailman/listinfo/python-list

Re: bsddb3 database file, are there any unexpected file size limits occuring in practice?

2006-02-28 Thread Klaas
In my current project I expect the total size of the indexes to exceed by far the size of the data indexed, but because Berkeley does not support multiple indexed columns (i.e. only one key value column as index) if I access the database files one after another (not simultaneously) it should

Re: Fetching the Return results of a spawned Thread

2006-02-28 Thread Alvin A. Delagon
Thanks a lot for the links that you gave me. I will look into that today! :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Paul Rubin http://[EMAIL PROTECTED] writes: Ben Finney [EMAIL PROTECTED] writes: If an enumeration object were to be derived from, I would think it just as likely to want to have *fewer* values in the derived enumeration. Subclassing would not appear to offer a simple way to do that.

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Paul Rubin http://[EMAIL PROTECTED] writes: say that Weekdays = enum('mon', 'tue', ...) What is the type of Weekdays.mon supposed to be? The specification doesn't mention that; it should. I'm calling them EnumValue, but that makes it difficult to talk about. The term value is commonly

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Paul Rubin http://[EMAIL PROTECTED] writes: Do you anticipate having parameters like socket.AF_INET that are currently integers, become enumeration members in future releases? That, and the 're' flags referred to earlier, seems to be a good application of enumerations. -- \ Jealousy: The

Default Section Values in ConfigParser

2006-02-28 Thread mwt
I want to set default values for a ConfigParser. So far, its job is very small, so there is only one section heading, ['Main']. Reading the docs, I see that in order to set default values in a ConfigParser, you initialize it with a dictionary or defaults. However, I'm not quite sure of the syntax

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Roy Smith [EMAIL PROTECTED] writes: A few random questions: a = enum ('foo', 'bar', 'baz') b = enum ('foo', 'bar', 'baz') Two separate enumerations are created, and bound to the names 'a' and 'b'. Each one has three unique member values, distinct from any others. what's the value of the

Re: Use empty string for self

2006-02-28 Thread paullanier
Thanks. I thought for sure it must have been discussed before but for whatever reason, my googling skills couldn't locate it. -- http://mail.python.org/mailman/listinfo/python-list

Cross compile generation of .pyc from .py files...

2006-02-28 Thread venkatbo
Hi all, We've managed to cross-compile (from i686 targeting ppc) python (2.4.2) binaries and extension modules. However we cannot figure out how to cross-compile the .py (of distribution) files and generate the .pyc files for the target ppc from an i686 system. Is it possible to cross compile

Re: type = instance instead of dict

2006-02-28 Thread Mel Wilson
James Stroud wrote: Fredrik Lundh wrote: James Stroud wrote: Perhaps you did not know that you can inheret directly from dict, which is the same as {}. For instance: class Dict({}): pass I must have been hallucinating. I swear I did this before and it worked just like class

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Steven Bethard [EMAIL PROTECTED] writes: Ben Finney wrote: This PEP specifies an enumeration data type for Python. An enumeration is an exclusive set of symbolic names bound to arbitrary unique values. Values within an enumeration can be iterated and compared, but the values have no

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Toby Dickenson [EMAIL PROTECTED] writes: On Monday 27 February 2006 02:49, Ben Finney wrote: Coercing a value from an enumeration to a ``str`` results in the string that was specified for that value when constructing the enumeration:: That sentence seems to assume that all enumeration

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Ben Finney [EMAIL PROTECTED] writes: PEP:354 Title: Enumerations in Python Version:$Revision: 42186 $ Last-Modified: $Date: 2006-01-26 11:55:20 +1100 (Thu, 26 Jan 2006) $ Most people seem to be unopposed or in favour of some kind of enumeration mechanism making

Re: SyntaxError: can't assign to a function call

2006-02-28 Thread Aahz
In article [EMAIL PROTECTED], Tim Roberts [EMAIL PROTECTED] wrote: One thing that can be helpful in situations like this is to remember that += in Python isn't quite as special as it is in C. So, f() += [4] is the same as f() = f() + [4] and I think you can see why that is a problem.

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Paul Rubin
Ben Finney [EMAIL PROTECTED] writes: These don't seem simple or elegant. I don't see a particular benefit to doing it that way, rather than being explicit about manipulating the member list:: pentium_instructions = enum('add', 'sub', 'mul') athlon64_instructions = enum( *[

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Felipe Almeida Lessa
Em Seg, 2006-02-27 às 17:10 -0800, Paul Rubin escreveu: Ben Finney [EMAIL PROTECTED] writes: If an enumeration object were to be derived from, I would think it just as likely to want to have *fewer* values in the derived enumeration. Subclassing would not appear to offer a simple way to do

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Roy Smith
Ben Finney [EMAIL PROTECTED] wrote: a = enum ('foo', 'bar', 'baz') b = enum ('foo', 'bar', 'baz') Two separate enumerations are created OK, most of the rest follows from that. str (a) Not defined in the current specification. Suggestions? Well, by analogy with a = set ((1, 2, 3))

Re: Use empty string for self

2006-02-28 Thread Roy Smith
[EMAIL PROTECTED] wrote: Any comments? Has this been discussed before? Yes. To death. Executive summary: self is here to stay. -- http://mail.python.org/mailman/listinfo/python-list

Re: Use empty string for self

2006-02-28 Thread Terry Hancock
On 28 Feb 2006 15:54:06 -0800 [EMAIL PROTECTED] wrote: The issue I have with self. is that is makes the code larger and more complicated than it needs to be. Especially in math expressions like: self.position[0] = self.startx + len(self.bitlist) * self.bitwidth It really makes the code

Re: Default Section Values in ConfigParser

2006-02-28 Thread Terry Hancock
On 28 Feb 2006 17:05:32 -0800 mwt [EMAIL PROTECTED] wrote: I want to set default values for a ConfigParser. So far, its job is very small, so there is only one section heading, ['Main']. Reading the docs, I see that in order to set default values in a ConfigParser, you initialize it with a

Re: Use empty string for self

2006-02-28 Thread Roy Smith
Terry Hancock [EMAIL PROTECTED] wrote: However, there is a slightly less onerous method which is perfectly legit in present Python -- just use s for self: This is being different for the sake of being different. Everybody *knows* what self means. If you write your code with s instead of

RE: MySQLdb compile error with AMD64

2006-02-28 Thread Keith Burns
Title: RE: MySQLdb compile error with AMD64 Found it. Had to change Extra_compile_args = config(cflags) to the actual list with march=athlon64 Now just realized that I didnt download the right RPMs for MySQL for SUSE on AMD64 (so got lib errors I am assuming cos of that). Will download

Re: Use empty string for self

2006-02-28 Thread Grant Edwards
On 2006-03-01, John Salerno [EMAIL PROTECTED] wrote: Yes. To death. Executive summary: self is here to stay. A related thing I was wondering about was the use of 'self' in class methods as the first parameter. It's not a related thing, it's the same thing. I understand that right now it

Re: type = instance instead of dict

2006-02-28 Thread James Stroud
Mel Wilson wrote: James Stroud wrote: Fredrik Lundh wrote: James Stroud wrote: Perhaps you did not know that you can inheret directly from dict, which is the same as {}. For instance: class Dict({}): pass I must have been hallucinating. I swear I did this before and it worked

Re: Make staticmethod objects callable?

2006-02-28 Thread Murali
You have a text-database, each record has some header info and some data (text-blob). e.g. HEADER name = Tom phone = 312-996- /HEADER I last met tom in 1998. He was still single then. blah blah HEADER name = John birthday = 1976-Mar-12 /HEADER I need to ask him his email

Re: Use empty string for self

2006-02-28 Thread John Salerno
Grant Edwards wrote: A related thing I was wondering about was the use of 'self' in class methods as the first parameter. It's not a related thing, it's the same thing. Oh sorry. I thought the OP was asking about having to use self when qualifying attributes, or even if he was, I didn't

Re: Use empty string for self

2006-02-28 Thread James Stroud
John Salerno wrote: Grant Edwards wrote: A related thing I was wondering about was the use of 'self' in class methods as the first parameter. It's not a related thing, it's the same thing. Oh sorry. I thought the OP was asking about having to use self when qualifying attributes, or

PyGUI 1.6: A Note for MacOSX Users

2006-02-28 Thread greg
A small problem has come to light with PyGUI 1.6 on MacOSX systems. If you get the following exception: File GUI/Generic/BaseAlertFunctions.py, line 5, in ? ImportError: No module named Alerts it's probably because you don't have PyObjC installed. I will fix this to produce a more

Re: Python Indentation Problems

2006-02-28 Thread John M. Gabriele
Renato wrote: If you use vi (vim, I hope), then place something like this in your .vimrc set ts=4 set sw=4 set expandtab set ai Or, more verbose: set tabstop=4 set shiftwidth=4 set autoindent There are a lot more tricks for python in vim (and plugins, and helpers, and so on), but

Re: C++ OpenGL rendering, wxPython GUI?

2006-02-28 Thread John M. Gabriele
[EMAIL PROTECTED] wrote: [snip] Now I'm looking to build a GUI in python with the rendering engine as an integrated window. I will most likely use wxPython for the GUI and I know it has support for adding an OpenGL canvas. You might look into PyFLTK (which I think was just recently

PyPornography was: Re: Python vs. Lisp -- please explain

2006-02-28 Thread Christos Georgiou
On Tue, 21 Feb 2006 15:05:40 -0500, rumours say that Steve Holden [EMAIL PROTECTED] might have written: Chris Mellon wrote: [...] Torstens definition isn't useful for quantifying a difference between interpeted and compiled - it's a rough sort of feel-test. It's like how much of a naked body

Re: type = instance instead of dict

2006-02-28 Thread Steven D'Aprano
Cruella DeVille wrote: This is off topic, but if read the documentation is the answere to everything why do we need news groups? Because read the documentation is NOT the answer to everything. However, it was the answer to your question. The problem with the documentation for Python is

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Terry Reedy
Ben Finney [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Should I amend the PEP to propose either in the builtins or in the collections module? Yes, if the idea is accepted, Guido and devs will debate and decide that anyway ;-) Or should I propose two PEPs and let them compete?

[ python-Bugs-1440472 ] email.Generator is not idempotent

2006-02-28 Thread SourceForge.net
Bugs item #1440472, was opened at 2006-02-28 12:11 Message generated for change (Settings changed) made by bwarsaw You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1440472group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1438537 ] modules search in help() crashes on insufficient file perms

2006-02-28 Thread SourceForge.net
Bugs item #1438537, was opened at 2006-02-25 03:41 Message generated for change (Comment added) made by logistix You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1438537group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-518846 ] exception cannot be new-style class

2006-02-28 Thread SourceForge.net
Bugs item #518846, was opened at 2002-02-17 12:09 Message generated for change (Comment added) made by bcannon You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=518846group_id=5470 Please note that this message will contain a full copy of the comment thread,

<    1   2