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

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

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 nak

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

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

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 inf

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

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

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. name = "Tom" phone = "312-996-" I last met tom in 1998. He was still single then. blah blah name = "John" birthday = "1976-Mar-12" I need to ask him his email when I see him ne

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.

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

Re: Use empty string for self

2006-02-28 Thread John Salerno
Roy Smith wrote: > [EMAIL PROTECTED] wrote: >> Any comments? Has this been discussed before? > > 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. I understand that right now it is nece

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 didn’t download the right RPMs for MySQL for SUSE on AMD64 (so got lib errors I am assuming cos of that). Will download

MySQLdb compile error with AMD64

2006-02-28 Thread Keith Burns
Title: MySQLdb compile error with AMD64 >> 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 >>> bui

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 instea

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

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 cod

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

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 wa

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

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 mak

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 enumera

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

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 wor

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

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

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

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 t

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Paul Rubin 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:

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Paul Rubin 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 com

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Ben Finney
Paul Rubin 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 t

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

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

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: 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 -- http://mail.python.org/mailman/listinfo/python-list

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 s

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

ANN: Extended Python debugger 1.14

2006-02-28 Thread R. Bernstein
Download from http://sourceforge.net/project/showfiles.php?group_id=61395&package_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: 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 :-)

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

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 d

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:

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

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! -- http://mail.python.org/mailman/listinfo/python-list

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

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

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 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 10**math.ceil

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

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. -- http:/

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 ou

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

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 somet

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

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

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

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

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 on

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 s

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

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

Long running Script stops responding, CPU usage increases

2006-02-28 Thread Jeff Quandt
Title: Long running Script stops responding, CPU usage increases This is running Python 2.3 on windows 2003/windows xp. I have written a script to display and filter the Win32 event log in a scrolling list to the command line (it also does some summary tasks).  It uses the win32evtlog.ReadE

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Terry Hancock
On Tue, 28 Feb 2006 14:26:49 -0500 "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Stefan Rank" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > recent examples from this list: > > > > 2006-01-03: > > http://www.nabble.com/Re%3A-Regex-anomaly-p2179421.html > > 2006-02-20: > > http://w

Re: Thread Question

2006-02-28 Thread Felipe Almeida Lessa
Em Ter, 2006-02-28 às 20:38 +, Grant Edwards escreveu: > On 2006-02-28, D <[EMAIL PROTECTED]> wrote: > > > Thanks, Grant. I apologize for not being clear on what I > > meant by using "classes". This is an example of what I was > > referring to: > > http://www.wellho.net/solutions/python-pyth

Re: comple list slices

2006-02-28 Thread Fredrik Lundh
[EMAIL PROTECTED]: > Len(rows) recalculates each time the while loop begins. Now that I > think of it, "rows != []" is faster than "len(rows) > 0." the difference is very small, and "len(rows)" is faster than "rows != []" (the latter creates a new list for each test). and as usual, using the co

Re: Thread Question

2006-02-28 Thread Grant Edwards
On 2006-02-28, D <[EMAIL PROTECTED]> wrote: > Thanks, Grant. I apologize for not being clear on what I > meant by using "classes". This is an example of what I was > referring to: > http://www.wellho.net/solutions/python-python-threads-a-first-example.html Ah, I see. I had forgotten that peopl

Re: comple list slices

2006-02-28 Thread Felipe Almeida Lessa
Em Ter, 2006-02-28 às 09:10 -0800, [EMAIL PROTECTED] escreveu: > Although I don't know if this is faster or more efficient than your > current solution, it does look cooler: [snip] > print [x for x in grouper] This is not cool. Do print list(grouper) -- "Quem excele em empregar a força militar

Re: Firebird and Python

2006-02-28 Thread haxier
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. -- http://mail.python.org/mailman/lis

Make staticmethod objects callable?

2006-02-28 Thread Nicolas Fleury
Hi everyone, 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() I understand staticmethod objects don't need to implement __call__ for their other use cases, but w

Re: Thread Question

2006-02-28 Thread D
Thanks, Grant. I apologize for not being clear on what I meant by using "classes". This is an example of what I was referring to: http://www.wellho.net/solutions/python-python-threads-a-first-example.html See the second (threaded) example. Doug -- http://mail.python.org/mailman/listinfo/pyt

Re: Thread Question

2006-02-28 Thread Felipe Almeida Lessa
Em Ter, 2006-02-28 às 20:24 +, Grant Edwards escreveu: > > I have seen examples that used classes, and other examples > > that just called one thread start command - when should you > > use one over another? > > I'm not sure what you mean by "use classes" vs. "calling a > thread start command"

Re: comple list slices

2006-02-28 Thread johnzenger
You don't need to copy the list; but if you don't, your original list will be emptied. Len(rows) recalculates each time the while loop begins. Now that I think of it, "rows != []" is faster than "len(rows) > 0." By the way, you can also do this using (gasp) a control index: def grouprows(rows):

Re: Thread Question

2006-02-28 Thread Grant Edwards
On 2006-02-28, D <[EMAIL PROTECTED]> wrote: > I have a client application that I want (behind the scenes) to check > and make sure a remote host is up (i.e. by ping or TCP connect). I'm > assuming that, since I want this to go on "unknowingly" to the user, > that I would put this in a thread. Pr

Re: escaping quotes

2006-02-28 Thread John Salerno
Fredrik Lundh wrote: > because the interactive prompt echos the result back to you as > a Python literal, where possible. compare Ah, of course! I forgot it wasn't 'print'ing it. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading - will threads run in parallel?

2006-02-28 Thread Jarek Zgoda
SolaFide napisał(a): > The problem is on Windows: when I run c:\python24\myprogram.py, it has > a command window open up. If I close it, the program ends. So I want it > to run without opening that window. Give it .pyw extension or start using pythonw.exe instead of python.exe. -- Jarek Zgoda h

Re: Looking for Pythonic Examples

2006-02-28 Thread Ido Yehieli
This one is from our very own BDFL, behold- wget implemented in 7 lines of python code: import sys, urllib def reporthook(*a): print a for url in sys.argv[1:]: i = url.rfind('/') file = url[i+1:] print url, "->", file urllib.urlretrieve(url, file, reporthook) -- http://mail.p

Re: Threading - will threads run in parallel?

2006-02-28 Thread SolaFide
Thanks! The problem is on Windows: when I run c:\python24\myprogram.py, it has a command window open up. If I close it, the program ends. So I want it to run without opening that window. -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading - will threads run in parallel?

2006-02-28 Thread Rene Pijlman
SolaFide: >(get() is a function which waits for a ping on a specific port, thus >stopping the program for a while.) > >Will these run together, Thread 2 can run while thread 1 is blocked for I/O and v.v. >Also, is it possible to split off a program for the terminal that >started it? As in I type

Re: Threading - will threads run in parallel?

2006-02-28 Thread Ido Yehieli
>> Also, is it possible to split off a program for the terminal that >> started it? As in I type in python test.py and test.py runs in the >> background and lets me do other things in that terminal? try: python test.py & -- http://mail.python.org/mailman/listinfo/python-list

Thread Question

2006-02-28 Thread D
I have a client application that I want (behind the scenes) to check and make sure a remote host is up (i.e. by ping or TCP connect). I'm assuming that, since I want this to go on "unknowingly" to the user, that I would put this in a thread. My question is, how would I go about creating the threa

Re: telnetlib problems

2006-02-28 Thread vercingetorix52
I just hit upon something that seems to work... ## import telnetlib from select import select tn = telnetlib.Telnet('192.168.100.11') sock = tn.get_socket() tn.read_until('login: ', 5) select([sock], [], [], 5) tn.write('user\n') tn.read_until('Password: ', 5) select([so

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Terry Reedy
"Stefan Rank" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > recent examples from this list: > > 2006-01-03: http://www.nabble.com/Re%3A-Regex-anomaly-p2179421.html > 2006-02-20: > http://www.nabble.com/Re%3A-Regular-expression-gone-mad-p3029028.html If the re flags were implement

Threading - will threads run in parallel?

2006-02-28 Thread SolaFide
I have 2 threads that I want to run at the same time: for instance: from threading import Thread class test(Thread): def run(self): while True: get(asdf) class test2(Thread): def run(self): while True:

Re: sort one list using the values from another list

2006-02-28 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Following Ron Adam solution (and using [] instead of list() in the last > line), this may be a possible solution of the problem, that is often > quite fast: > > def psort16(s1, s2): > try: > d = dict(izip(s2, s1)) > except TypeError: > _indices =

telnetlib problems

2006-02-28 Thread vercingetorix52
I'm trying to use a python script to access an embedded computer running linux and connected via a crossover ethernet cable using the following script... ...and I realize the username and password is not realistic... I'm still in "proof of concept" stage here :) # import t

Re: Numerical solver

2006-02-28 Thread Robert Kern
Laszlo Zsolt Nagy wrote: > Hello, > > I would like to use a numerical solver for a specific problem. My > problem looks like this: > >1. I have numeric constants, named A,B,C etc. >2. I have numeric variables, named x,y,z etc. >3. I have functions, like f1(x), f2(x), f3(x,y), f4(y)

Re: escaping quotes

2006-02-28 Thread Fredrik Lundh
John Salerno wrote: > I'm reading through the tutorial and found this in section 3: > > >>> '"Isn\'t," she said.' > '"Isn\'t," she said.' > > Why doesn't the escape sequence work in this case? because the interactive prompt echos the result back to you as a Python literal, where possible. compa

Re: Best python module for Oracle, but portable to other RDBMSes

2006-02-28 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > What would be the next best Oracle database module for Python next to > cx_oracle? That would probably be DCOracle2. > I'd like to compare two and choose one, just for the sake of > seeing how two modules doing the same th

Numerical solver

2006-02-28 Thread Laszlo Zsolt Nagy
Hello, I would like to use a numerical solver for a specific problem. My problem looks like this: 1. I have numeric constants, named A,B,C etc. 2. I have numeric variables, named x,y,z etc. 3. I have functions, like f1(x), f2(x), f3(x,y), f4(y) etc. 4. I have constraints like f1(x

  1   2   >