Re: Character Sequence Generation

2005-09-22 Thread Peter Otten
Jeff Schwab wrote: > What's the best way to generate a sequence of characters in Python? I'm > looking for something like this Perl code: 'a' .. 'z' . >>> import re >>> def char_set(a_z, all_chars="".join(map(chr, range(256: ... return re.compile("[%s]" % a_z).findall(all_chars) ... >>>

Re: Help on regular expression match

2005-09-22 Thread Fredrik Lundh
Johnny Lee wrote: > I've met a problem in match a regular expression in python. Hope > any of you could help me. Here are the details: > > I have many tags like this: > xxxhttp://xxx.xxx.xxx"; xxx>xxx > xx > xxxhttp://xxx.xxx.xxx"; xxx>xxx > . > And I want to find

Re: words relating to networks that I should probably know

2005-09-22 Thread Alessandro Bottoni
John Walton wrote: > Hello, again. I'm back with my instant messenger > project. My teacher has assigned us to write our > papers, excluding the procedure, results, and > conclusion. One of my topics is going to be networks. > Does anyone know a list of words relating to > networking/networks

Re: How to use a timer in Python?

2005-09-22 Thread Wolfram Kraus
Nico Grubert wrote: > Hi there, > > on a Linux machine running Python 2.3.5. I want to create a file > 'newfile' in a directory '/tmp' only if there is no file 'transfer.lock' > in '/temp'. > A cronjob creates a file 'transfer.lock' in '/temp' directory every 15 > minutes while the cronjob is d

Re: How to use a timer in Python?

2005-09-22 Thread Sybren Stuvel
Nico Grubert enlightened us with: > How can I use a timer that waits e.g. 10 seconds if 'transfer.lock' > is present and then checks again if 'transfer.lock' is still there? Make a while loop in which you sleep. Or use the threading module if you want to go multi-threading. Sybren -- The problem

How to use a timer in Python?

2005-09-22 Thread Nico Grubert
Hi there, on a Linux machine running Python 2.3.5. I want to create a file 'newfile' in a directory '/tmp' only if there is no file 'transfer.lock' in '/temp'. A cronjob creates a file 'transfer.lock' in '/temp' directory every 15 minutes while the cronjob is doing something. This job takes aro

Help on regular expression match

2005-09-22 Thread Johnny Lee
Hi, I've met a problem in match a regular expression in python. Hope any of you could help me. Here are the details: I have many tags like this: xxxhttp://xxx.xxx.xxx"; xxx>xxx xx xxxhttp://xxx.xxx.xxx"; xxx>xxx . And I want to find all the "http://xxx.xxx.

Re: Newbie regular expression and whitespace question

2005-09-22 Thread Paul McGuire
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > timeit -s "import test" "test.test3()" > 100 loops, best of 3: 6.73 msec per loop > > > timeit -s "import test" "test.test4()" > 1 loops, best of 3: 27.8 usec per loop > > that's a 240x slowdown. hmm. > > > > W

Re: Sniffing Text Files

2005-09-22 Thread Mike Meyer
David Pratt <[EMAIL PROTECTED]> writes: > Hi. I have files that I will be importing in at least four different > plain text formats, one of them being tab delimited format, a couple > being token based uses pipes (but not delimited with pipes), another > being xml. There will likely be others as w

Re: C#3.0 and lambdas

2005-09-22 Thread Erik Wilsher
Python developement is discussed, decided and usually developed within the members of python-dev. Have you seen any discussions about xml-literals in python-dev lately? -- http://mail.python.org/mailman/listinfo/python-list

Re: Character Sequence Generation

2005-09-22 Thread Devan L
Jeff Schwab wrote: > [EMAIL PROTECTED] wrote: > > Jeff Schwab wrote: > > > >>What's the best way to generate a sequence of characters in Python? I'm > >>looking for something like this Perl code: 'a' .. 'z' . > > > > > import string > > > > > print string.ascii_lowercase > > > > abcdefghi

Re: Character Sequence Generation

2005-09-22 Thread Pedro Werneck
On Thu, 22 Sep 2005 23:26:58 -0400 Jeff Schwab <[EMAIL PROTECTED]> wrote: > What's the best way to generate a sequence of characters in Python? > I'm looking for something like this Perl code: 'a' .. 'z' . If you want arbitrary sequences, you may use something like: >>> [chr(x) for x in xrang

Sniffing Text Files

2005-09-22 Thread David Pratt
Hi. I have files that I will be importing in at least four different plain text formats, one of them being tab delimited format, a couple being token based uses pipes (but not delimited with pipes), another being xml. There will likely be others as well but the data needs to be extracted and re

Re: Alternatives to Stackless Python?

2005-09-22 Thread D H
[EMAIL PROTECTED] wrote: > After recently getting excited about the possibilities that stackless > python has to offer > (http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/) > and then discovering that the most recent version of stackless > available on stack

Re: Character Sequence Generation

2005-09-22 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > Jeff Schwab wrote: > >>What's the best way to generate a sequence of characters in Python? I'm >>looking for something like this Perl code: 'a' .. 'z' . > > import string > > print string.ascii_lowercase > > abcdefghijklmnopqrstuvwxyz Thanks. Is there a g

Re: Character Sequence Generation

2005-09-22 Thread [EMAIL PROTECTED]
Jeff Schwab wrote: > What's the best way to generate a sequence of characters in Python? I'm > looking for something like this Perl code: 'a' .. 'z' . >>> import string >>> print string.ascii_lowercase abcdefghijklmnopqrstuvwxyz Others: ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL

Character Sequence Generation

2005-09-22 Thread Jeff Schwab
What's the best way to generate a sequence of characters in Python? I'm looking for something like this Perl code: 'a' .. 'z' . -- http://mail.python.org/mailman/listinfo/python-list

Re: Alternatives to Stackless Python?

2005-09-22 Thread Peter Hansen
[EMAIL PROTECTED] wrote: >>I found LGT http://lgt.berlios.de/ but it didn't seem as if the >>NanoThreads module had the same capabilites as stackless. > > What specific capabilities of Stackless are you looking for, that are > missing from NanoThreads? While I can't speak for the OP, isn't it the

Weekly Python Patch/Bug Summary

2005-09-22 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 337 open ( -6) / 2941 closed (+14) / 3278 total ( +8) Bugs: 908 open ( +0) / 5262 closed (+17) / 6170 total (+17) RFE : 194 open ( +5) / 187 closed ( +2) / 381 total ( +7) New / Reopened Patches __ use LIST_

Re: Anyone else getting posts back as email undeliverable bounces?

2005-09-22 Thread Ron Adam
Terry Reedy wrote: > "Bengt Richter" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>It seems lately all my posts have been coming back to me as bounced >>emails, >>and I haven't emailed them ;-( > > > They are gatewayed to the general python email list. But bouncing list

Re: What is "self"?

2005-09-22 Thread Erik Max Francis
Ron Adam wrote: > When you call a method of an instance, Python translates it to... > > leader.set_name(leader, "John") It actually translates it to Person.set_name(leader, "John") -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20

Re: Ide RAD for linux?

2005-09-22 Thread DaveInSidney
Komodo is my multi-platform IDE. -- .. Remove NOSPAM. before replying Pursuant to U.S. code, title 47, Chapter 5, Subchapter II, Section 227 Any and all unsolicited commercial E-mail sent to this address is subject to a fee of U

Re: What is "self"?

2005-09-22 Thread James Stroud
I'm sure there are answers to this out there, but I'm typing this one up so I can show it to people that I try to teach this language. They consistently get hung up on what self is. So here is my try: == Self is one of those python concepts that new python programmers have a little difficulty

Re: What is "self"?

2005-09-22 Thread Ron Adam
Wayne Sutton wrote: > OK, I'm a newbie... > I'm trying to learn Python & have had fun with it so far. But I'm having > trouble following the many code examples with the object "self." Can > someone explain this usage in plain english? > > Thanks, > Wayne I'll give it a try.. When you have

Re: What is "self"?

2005-09-22 Thread marduk
On Thu, 2005-09-22 at 21:36 -0400, Wayne Sutton wrote: > OK, I'm a newbie... > I'm trying to learn Python & have had fun with it so far. But I'm having > trouble following the many code examples with the object "self." Can > someone explain this usage in plain english? "self" references the ob

Re: What is "self"?

2005-09-22 Thread Sam Pointon
self is the class instance that the bound function being called belongs to. This example should illustrate a bit. class Foo(object): def __init__(self, value): self.value = value # so the Foo instance now has an attribute, value def get_value(self): return self.value # Th

Re: Anyone else getting posts back as email undeliverable bounces?

2005-09-22 Thread Terry Reedy
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It seems lately all my posts have been coming back to me as bounced > emails, > and I haven't emailed them ;-( They are gatewayed to the general python email list. But bouncing list emails back to authors instead of

Re: Newbie regular expression and whitespace question

2005-09-22 Thread googleboy
Thanks for the great positive responses. I was close with what I was trying, I guess, but close only counts in horseshoes and um.. something else that close counts in. :-) googleboy -- http://mail.python.org/mailman/listinfo/python-list

words relating to networks that I should probably know

2005-09-22 Thread John Walton
Hello, again. I'm back with my instant messenger project. My teacher has assigned us to write our papers, excluding the procedure, results, and conclusion. One of my topics is going to be networks. Does anyone know a list of words relating to networking/networks that I should know for this proj

What is "self"?

2005-09-22 Thread Wayne Sutton
OK, I'm a newbie... I'm trying to learn Python & have had fun with it so far. But I'm having trouble following the many code examples with the object "self." Can someone explain this usage in plain english? Thanks, Wayne -- http://mail.python.org/mailman/listinfo/python-list

Re: Alternatives to Stackless Python?

2005-09-22 Thread simonwittber
> I found LGT http://lgt.berlios.de/ but it didn't seem as if the > NanoThreads module had the same capabilites as stackless. What specific capabilities of Stackless are you looking for, that are missing from NanoThreads? Sw. -- http://mail.python.org/mailman/listinfo/python-list

optimizing a program that just shuffles data, a bit like cat...

2005-09-22 Thread Dan Stromberg
...but with much bigger blocksizes, and with a netcat-like ability to use sockets. The program is at http://dcs.nac.uci.edu/~strombrg/pnetcat I'm a bit concerned about the program's performance, because it actually seems to get slower sometimes with larger blocksizes, which really isn't what I'd

Re: Anyone else getting posts back as email undeliverable bounces?

2005-09-22 Thread James Stroud
This is an autoreply to your message. Oh wait, no its not, its really me. Yes, I am getting the same trash. I hope whoever it is at liage.net, gets tired of mail related threads like this and disables their damn autobounce. Perhaps they will check to see if they are responsible before the chime

Re: Anyone else getting posts back as email undeliverable bounces?

2005-09-22 Thread Ron Adam
Bengt Richter wrote: > It seems lately all my posts have been coming back to me as bounced emails, > and I haven't emailed them ;-( > > I've been getting bounce messages like (excerpt): > ... Yes, I get them too. Plugging http://deimos.liage.net/ into a browser get: This domain is parked

Re: Question About Logic In Python

2005-09-22 Thread Ron Adam
Terry Hancock wrote: > On Thursday 22 September 2005 12:26 pm, Ron Adam wrote: > >>Steve Holden wrote: >> >>>Ron Adam wrote: >>> >>> True * True 1 # Why not return True here as well? >>> >>>Why not return 42? Why not return a picture of a banana? >> >>My question st

Re: time challenge

2005-09-22 Thread Bengt Richter
On Thu, 22 Sep 2005 08:11:26 -0500, nephish <[EMAIL PROTECTED]> wrote: > >Hey there, >i am doing a plotting application. >i am using mxRelativeDateTimeDiff to get how much time is between >date x and date y > >now what i need to do is divide that time by 20 to get 20 even time >slots >for plotting

Re: The .NET Framework SDK needs to be installed before building

2005-09-22 Thread Claudio Grondi
I mean I have seen this error already in the past installing another package requiring compilation of C sources. As I can remember, the actual problem was, that C++ .NET 2003 compiler environment was not installed - so this message seems to point in the wrong direction (is created somewhere inside

Re: Newbie regular expression and whitespace question

2005-09-22 Thread George Sakkis
"googleboy" <[EMAIL PROTECTED]> wrote: > Hi. > > I am trying to collapse an html table into a single line. Basically, > anytime I see ">" & "<" with nothing but whitespace between them, I'd > like to remove all the whitespace, including newlines. I've read the > how-to and I have tried a bunch of

Anyone else getting posts back as email undeliverable bounces?

2005-09-22 Thread Bengt Richter
It seems lately all my posts have been coming back to me as bounced emails, and I haven't emailed them ;-( I've been getting bounce messages like (excerpt): ... ___ This is the Postfix program at host deimos.liage.net. I'm sorry to have to inform you

Re: Finding where to store application data portably

2005-09-22 Thread Tony Houghton
In <[EMAIL PROTECTED]>, Ron Adam <[EMAIL PROTECTED]> wrote: > Tony Houghton wrote: > >> > This works on Win XP. Not sure if it will work on Linux. >> > >> > import os >> > >> > parent = os.path.split(os.path.abspath(os.sys.argv[0]))[0] >> > file = parent + os.sep + '.bombz' >> >> Ooh, no,

Re: Question About Logic In Python

2005-09-22 Thread Bengt Richter
On Thu, 22 Sep 2005 14:12:52 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Steve Holden" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Which is yet another reason why it makes absolutely no sense to apply >> arithmetic operations to Boolean values. > >Except for counting t

Re: subprocess.Popen and replacing the shell pipe line

2005-09-22 Thread jepler
Probably the quoting of the argument to grep. try this instead: > p1 = Popen(['grep', 'Sep 22', '/var/log/auth.log'], stdout=PIPE) etc Jeff -- http://mail.python.org/mailman/listinfo/python-list

Re: C#3.0 and lambdas

2005-09-22 Thread Steven Bethard
Reinhold Birkenfeld wrote: > > This is Open Source. If you want an initiative, start one. +1 QOTW. STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading, real or simulated?

2005-09-22 Thread Sam
Antoon Pardon writes: Assuming you mean threading.Thread, this is a native thread. It is not a simulation. Something else is going wrong. Then I must have something locked. Here's what I do: Yes you have locked the GIL. Take a look at the following URL: http://docs.python.org/api/threads

Re: strange import phenomenon

2005-09-22 Thread Christoph Zwerschke
Thank you, Dieter! Bingo. When I think about it now, it is very logical: There must be another mechanism besides sys.path, otherwise modules inside packages would not find their siblings or subpackages. But whereever the search path is explained, only sys.path was mentioned, so I took that at

Re: C#3.0 and lambdas

2005-09-22 Thread Reinhold Birkenfeld
Erik Wilsher wrote: > And I think the discussion that followed proved your point perfectly > Fredrik. Big discussion over fairly minor things, but no "big picture". > Where are the initiatives on the "big stuff" (common documentation > format, improved build system, improved web modules, reworking

subprocess.Popen and replacing the shell pipe line

2005-09-22 Thread Tom Brown
I need to chain together three linux commands and get the final output. I read the documentation for Popen in the subprocess module for replacing the shell pipe line. I followed the example and keep getting a 0 where I should be getting a 1. I am trying to do this: grep "Sep 22" /var/log/auth.

Re: Noobie Starting New Project

2005-09-22 Thread megafrenzy
Well, I'm not too worried about the serial communications aspect, I've developed perhaps a dozen different RS-232, 422, 485, and even SPI, CANBUS interfaces in the past year for embedded systems. And also, the Subaru protocol is easier than OBDII, no need to change the baud to 5, its fixed at 4800

Re: Question About Logic In Python

2005-09-22 Thread Terry Hancock
On Thursday 22 September 2005 12:26 pm, Ron Adam wrote: > Steve Holden wrote: > > Ron Adam wrote: > >> >>> True * True > >> 1 # Why not return True here as well? > >> > > Why not return 42? Why not return a picture of a banana? > > My question still stands. Could it be helpful

Re: Module import via sys.path and py2exe

2005-09-22 Thread flupke
flupke wrote: > Hi, > > i have a program with is built like this: > startup.py > dir1/__init__.py > dir1/file1.py > dir2/__init__.py > dir2/file2.py > dir3/__init__.py > dir3/file3.py > > The program works but now i want to add the functionality into an > existing program 2. This is program 2: >

Re: authentication for xmlrpc via cgi

2005-09-22 Thread David M. Cooke
[EMAIL PROTECTED] writes: > I'm using python 2.2 (hopefully we'll be upgrading our system to 2.3 > soon) and I'm trying to prototype some xml-rpc via cgi functionality. > If I override the Transport class on the xmlrpclib client and add some > random header like "Junk", then when I have my xmlrpc

Re: C#3.0 and lambdas

2005-09-22 Thread Erik Wilsher
And I think the discussion that followed proved your point perfectly Fredrik. Big discussion over fairly minor things, but no "big picture". Where are the initiatives on the "big stuff" (common documentation format, improved build system, improved web modules, reworking the standard library to men

[no subject]

2005-09-22 Thread Dane Ensign
Hi all, Im new to python. Please can someone suggest a url for reading or solution to validating user input in python reliably? upon building a small terminal app, it appears that using the raw_input function combined with try-catch for the input conversion to integer, might be a good way to go.

Re: How to show percentage

2005-09-22 Thread Terry Hancock
On Thursday 22 September 2005 12:51 pm, Sen-Lung Chen wrote: > Dear All: > I have a question of show percentage. > For example ,I want to show the percentage of 1/3 = 33.33% > > I use the 1*100/3 = 33 > it is 33 not 33.33 , how to show the 33.33 % > Thanks In addition to needing a floating poi

[no subject]

2005-09-22 Thread Dane Ensign
Hi all, Im new to python. Please can someone suggest a url for validating user input in python reliably? upon building a small terminal app, it appears that using the raw_input function combined with try-catch for the input conversion to integer, might be a good way to go. ? I need users to e

Module import via sys.path and py2exe

2005-09-22 Thread flupke
Hi, i have a program with is built like this: startup.py dir1/__init__.py dir1/file1.py dir2/__init__.py dir2/file2.py dir3/__init__.py dir3/file3.py The program works but now i want to add the functionality into an existing program 2. This is program 2: program2.py program2dir1/__init__.py pro

Os.fork() replacement for windows.

2005-09-22 Thread Payton, Zack
Title: Os.fork() replacement for windows. Ok ladies and gentlemen, I'm attemtping to port a unix based app written in python over to windows.  However this app relies on the os.fork() to achieve parallelism for sending and receiving network packets.  I need to 'fork' the code to send a seri

Re: in-memory db? gadfly?

2005-09-22 Thread Peter Hansen
chris wrote: > I'm looking for a completely in-memory sql db. I have seen gadfly, but > its startup method seems to require a directory for the on-disk file > storage. I have a script and I want to create a database/tables in the > script, insert some data (not much), and execute some queries, al

Re: win32 service and time.sleep()

2005-09-22 Thread Steve Horsley
Oracle wrote: > On Tue, 20 Sep 2005 10:49:13 -0400, rbt wrote: > >> I have a win32 service written in Python. It works well. It sends a >> report of the status of the machine via email periodically. The one >> problem I have is this... while trying to send an email, the script >> loops until a sen

Re: How to show percentage

2005-09-22 Thread George Sakkis
"Sen-Lung Chen" <[EMAIL PROTECTED]> wrote: > Dear All: > I have a question of show percentage. > For example ,I want to show the percentage of 1/3 = 33.33% > > I use the 1*100/3 = 33 > it is 33 not 33.33 , how to show the 33.33 % > Thanks "%.2f%%" % (100./3.) Not quite the most readable expres

in-memory db? gadfly?

2005-09-22 Thread chris
I'm looking for a completely in-memory sql db. I have seen gadfly, but its startup method seems to require a directory for the on-disk file storage. I have a script and I want to create a database/tables in the script, insert some data (not much), and execute some queries, all in-memory. Don't n

authentication for xmlrpc via cgi

2005-09-22 Thread qhfgva
I'm using python 2.2 (hopefully we'll be upgrading our system to 2.3 soon) and I'm trying to prototype some xml-rpc via cgi functionality. If I override the Transport class on the xmlrpclib client and add some random header like "Junk", then when I have my xmlrpc server log it's environment when ru

Re: Wrapping classes

2005-09-22 Thread Peter Hansen
Jeremy Sanders wrote: > Is it possible to implement some sort of "lazy" creation of objects only > when the object is used, but behaving in the same way as the object? > > For instance: > > class Foo: > def __init__(self, val): > """This is really slow.""" > self.num = val > > # this d

Re: Newbie regular expression and whitespace question

2005-09-22 Thread Fredrik Lundh
Paul McGuire wrote: > If you're absolutely stuck on using RE's, then others will have to step > forward. Meanwhile, here's a pyparsing solution (get pyparsing at > http://pyparsing.sourceforge.net): so, let's see. using ... from pyparsing import * import re data = """ ... table example from o

Wrapping classes

2005-09-22 Thread Jeremy Sanders
Is it possible to implement some sort of "lazy" creation of objects only when the object is used, but behaving in the same way as the object? For instance: class Foo: def __init__(self, val): """This is really slow.""" self.num = val # this doesn't call Foo.__init__ yet a = lazyclass(F

Re: Newbie regular expression and whitespace question

2005-09-22 Thread Paul McGuire
"googleboy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi. > > I am trying to collapse an html table into a single line. Basically, > anytime I see ">" & "<" with nothing but whitespace between them, I'd > like to remove all the whitespace, including newlines. I've read the > h

Re: NTEventLogHandler not logging `info'?

2005-09-22 Thread Jaime Wyant
On 22 Sep 2005 12:23:50 -0700, Vinay Sajip <[EMAIL PROTECTED]> wrote: > Jaime Wyant wrote: > > I must be missing something. This is what I read from the documentation: > > > > When a logger is created, the level is set to NOTSET (which causes all > > messages to be processed in the root logger, or

Re: Newbie regular expression and whitespace question

2005-09-22 Thread Bruno Desthuilliers
googleboy a écrit : > Hi. > > I am trying to collapse an html table into a single line. Basically, > anytime I see ">" & "<" with nothing but whitespace between them, I'd > like to remove all the whitespace, including newlines. I've read the > how-to and I have tried a bunch of things, but noth

Small python24.dll / how to strip off asian codecs to separate package(s) ?

2005-09-22 Thread Robert
updating a py2exe'd software I was impressed by python24.dll's footprint - double size of python23.dll Is there a version without/separate asianc codecs (which seem to mainly blow up python24.dll)? Or how to build one? Robert -- http://mail.python.org/mailman/listinfo/python-list

Newbie regular expression and whitespace question

2005-09-22 Thread googleboy
Hi. I am trying to collapse an html table into a single line. Basically, anytime I see ">" & "<" with nothing but whitespace between them, I'd like to remove all the whitespace, including newlines. I've read the how-to and I have tried a bunch of things, but nothing seems to work for me: -- t

Re: Classes derived from dict and eval

2005-09-22 Thread Jeremy Sanders
On Tue, 20 Sep 2005 13:59:50 -0700, Robert Kern wrote: > globals needs to be a real dictionary. The implementation uses the C > API, it doesn't use the overridden __getitem__. The locals argument, > apparently can be some other kind of mapping. It seems that on Python 2.3 then neither globals or

Re: NTEventLogHandler not logging `info'?

2005-09-22 Thread Vinay Sajip
Jaime Wyant wrote: > I must be missing something. This is what I read from the documentation: > > When a logger is created, the level is set to NOTSET (which causes all > messages to be processed in the root logger, or delegation to the > parent in non-root loggers). > The documentation could be c

Re: How to show percentage

2005-09-22 Thread Mike Meyer
"Sen-Lung Chen" <[EMAIL PROTECTED]> writes: > Dear All: > I have a question of show percentage. > For example ,I want to show the percentage of 1/3 = 33.33% > > I use the 1*100/3 = 33 > it is 33 not 33.33 , how to show the 33.33 % Python interprets '/' in an integer environment to return ints,

Re: How to show percentage

2005-09-22 Thread Bill Mill
You need to convert 1 or 3 to a float. How about: >>> def pct(num, den): return (float(num)/den) * 100 ... >>> pct(1, 3) 33.329 Peace Bill Mill bill.mill at gmail.com On 22 Sep 2005 10:51:43 -0700, Sen-Lung Chen <[EMAIL PROTECTED]> wrote: > Dear All: > I have a question of show perc

Re: How to show percentage

2005-09-22 Thread [EMAIL PROTECTED]
Traditionally, one part of the expression has to be a float for the result to be a float (this is a holdover from C). So 100/3.0 will give you the result you want. Alternatively, you can put "from __future__ import division" at the top of your script, and then 100/3 will return a float. http://www

Re: Question About Logic In Python

2005-09-22 Thread Terry Reedy
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Which is yet another reason why it makes absolutely no sense to apply > arithmetic operations to Boolean values. Except for counting the number of true values. This and other legitimate uses of False/True as 0/1 (inde

Re: Finding where to store application data portably

2005-09-22 Thread Ron Adam
Tony Houghton wrote: > > This works on Win XP. Not sure if it will work on Linux. > > > > import os > > > > parent = os.path.split(os.path.abspath(os.sys.argv[0]))[0] > > file = parent + os.sep + '.bombz' > > Ooh, no, I don't want saved data to go in the installation directory. In > genera

Re: Linux/Python -> SQL*Server Connexion chain

2005-09-22 Thread Benji York
Gilles Lenfant wrote: > Have you guys any good experience on connecting a Python (Zope) app > running on Linux to a Windoze SQL*Server ? Yep. I wrote bindings to ODBTP (http://odbtp.sourceforge.net/) using ctypes. It worked really well, good performance and quite reliable. You can see an alph

Re: Perl's documentation come of age

2005-09-22 Thread Fredrik Lundh
Mike wrote: > > Jim Hugunin's keynote speech at this year's PyCon was accompanied by a > > projection if his interactive interpreter session, and I know I wasn't > > alone in finding this a convincing example of Microsoft's (well, Jim's, > > really) full integration of Python into the .net framewo

Re: Writing a parser the right way?

2005-09-22 Thread Steven Bethard
beza1e1 wrote: > Verbs are the tricky part i think. There is no way to recognice them. > So i will have to get a database ... work to do. ;) Try the Brill tagger[1] or MXPOST[2]. STeVe [1] http://www.cs.jhu.edu/~brill/code.html [2] ftp://ftp.cis.upenn.edu/pub/adwait/jmx/jmx.tar.gz -- http://mai

How to show percentage

2005-09-22 Thread Sen-Lung Chen
Dear All: I have a question of show percentage. For example ,I want to show the percentage of 1/3 = 33.33% I use the 1*100/3 = 33 it is 33 not 33.33 , how to show the 33.33 % Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading, real or simulated?

2005-09-22 Thread Peter Hansen
Antoon Pardon wrote: > Op 2005-09-22, Sam schreef <[EMAIL PROTECTED]>: >>What's the GIL?. > > The general interpretor lock. In general changing python internals That should be "global" (and, more pedantically, "interpreter"). -- http://mail.python.org/mailman/listinfo/python-list

Re: time challenge

2005-09-22 Thread Scott David Daniels
nephish wrote: > i am doing a plotting application> If its 40 minutes, > i need 20 plots that are 2 minutes apart. > what would be a way i could pull this off? > > thanks Sounds like homework related to another assignment discussed above. Write your code, try to get it to work, and _then_ i

Linux/Python -> SQL*Server Connexion chain

2005-09-22 Thread Gilles Lenfant
Hi, Have you guys any good experience on connecting a Python (Zope) app running on Linux to a Windoze SQL*Server ? Many thanks by advance to report your success, failure, pitfalls (...) and used products. Even reports using commercial solutions are welcome. -- Gilles -- http://mail.python.o

Re: Python installation root directory problem

2005-09-22 Thread Matt Leslie
Further diggingappears to show this is an instance of the problem documented here: http://tinyurl.com/82dt2 Running msiexec with logging revealed the following lines: MSI (s) (48:F8) [18:15:47:990]: Ignoring disallowed property X MSI (s) (48:F8) [18:15:47:990]: Ignoring disallowed property TARG

Re: Finding where to store application data portably

2005-09-22 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: > >> Tony Houghton wrote: >> >>> I'm using pygame to write a game called Bombz which needs to save some >>> data in a directory associated with it. In Unix/Linux I'd probably use >>> "~/.bombz", in Windows something like >>> "C:\Documents And Settings\\Applic

Re: Writing a parser the right way?

2005-09-22 Thread beza1e1
Thanks for the hints. I just found NLTK and MontyLingua. And yes, it is just adventure game language. This means every tense except present tense is discarded as "not changing world". Furthermore the parser will make a lot of assumptions, which are perhaps 90% right, not perfect: if word[-2:] ==

Re: Question About Logic In Python

2005-09-22 Thread Ron Adam
Steve Holden wrote: > Ron Adam wrote: >> >> 2. Expressions that will be used in a calculation or another >> expression. >> > By which you appear to mean "expressions in which Boolean values are > used as numbers". Or compared to other types, which is common. >> This matters because if you

Re: Indexed variables

2005-09-22 Thread Laszlo Zsolt Nagy
>If you really want to change an actual parameter inside an object, then > > inside a function, I mean -- http://mail.python.org/mailman/listinfo/python-list

Re: Indexed variables

2005-09-22 Thread Tom Anderson
On Thu, 22 Sep 2005 [EMAIL PROTECTED] wrote: > How do I do the following flawed things right: Well, that depends on what you mean by 'right'. I'm going to give you two solutions; one that answers your apparent question, and one that addresses what i suspect is your true question. > a1=a2=0 > >

Re: Indexed variables

2005-09-22 Thread Rocco Moretti
[EMAIL PROTECTED] wrote: > So how do I define the function such as to discrimate wheter I call it by > f(a1) or f(a2) ? I don't want to sound rude, but I think you'll be better served by telling us why you would want to do such a thing - ten to one someone can suggest a better way to acomplish

Re: Indexed variables

2005-09-22 Thread Laszlo Zsolt Nagy
>a1=a2=0 > >def f(x): >if x == a1: >a1 = a1 + 1 >elif x == a2: >a2 = a2 + 1 > > >Now if I call f with f(a2) only a1, of course, is incremented because the >if-clause does only check for the value of the input and the values of a1 >and a2 are identical. > >So how do I define

Re: wxPython Notebook crash when pressing alt key

2005-09-22 Thread Graham Fawcett
Kreedz wrote: > Could Windows version have anything to do with this?? Else I've got > some really weird issue... > > I'm on Windows 2000 Professional Yes, that definitely counts as a wierd issue. I couldn't reproduce the bug either. C:\temp>python ActivePython 2.4.1 Build 247 (ActiveState Corp

Indexed variables

2005-09-22 Thread python-novice
Hello, being an almost complete Python AND programming neophyte I would like to ask the following - very elementary, as I might suspect - question: How do I do the following flawed things right: a1=a2=0 def f(x): if x == a1: a1 = a1 + 1 elif x == a2: a2 = a2 + 1 Now

Re: Calling python scripts from C# programs

2005-09-22 Thread Brett Hoerner
David Wilson wrote: > http://www.ironpython.com/ It should be noted that they (?) don't seem to update that site anymore, you can find 0.9.1 here: http://workspaces.gotdotnet.com/ironpython There is also Boo, which is Python-like (with some differences) but is a .NET Language itself. I never und

Re: NTEventLogHandler not logging `info'?

2005-09-22 Thread Jaime Wyant
BTW - you're suggestion worked. Thanks again! jw On 9/22/05, Jaime Wyant <[EMAIL PROTECTED]> wrote: > I must be missing something. This is what I read from the documentation: > > When a logger is created, the level is set to NOTSET (which causes all > messages to be processed in the root logger,

Re: NTEventLogHandler not logging `info'?

2005-09-22 Thread Jaime Wyant
I must be missing something. This is what I read from the documentation: When a logger is created, the level is set to NOTSET (which causes all messages to be processed in the root logger, or delegation to the parent in non-root loggers). :/ Thanks! jw On 22 Sep 2005 08:21:48 -0700, Vinay Sajip

Re: Calling python scripts from C# programs

2005-09-22 Thread Paul
Another option is to implement the needed python code in COM server and call that from C#. A simple example of python COM server can be seen about halfway down the page here http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html -- http://mail.python.org/mailman/listinfo/python-list

Python installation root directory problem

2005-09-22 Thread Matt Leslie
Hi, I am trying to install python 2.4.1 on a windows XP machine. Whether I choose to install 'for me' or 'for all users, and no matter where I select as the root directory, the installer always puts the python root in C:\, which is obviously a bit messy. I am running this instalaltion as a sli

Re: Open PDF

2005-09-22 Thread Mike Meyer
Dan <[EMAIL PROTECTED]> writes: > Under Linux you can probably use xpdf or gpdf: > > os.system("xpdf /path/to/file.pdf") > > Note that you should check the return code of "system" to see if the > execution was successful. For example, the user might not have xpdf > installed. This is the problem

  1   2   >