BayPIGgies: July 14, 7:30pm (Google)

2005-07-11 Thread Aahz
The next meeting of BayPIGgies will be Thurs, July 14 at 7:30pm at Google, building 40, room Temp Tech Talk. Alex Martelli will be doing his Black Magic talk on descriptors, decorators, and metaclasses. Prepare to have your head exploded! BayPIGgies meetings alternate between IronPort (San

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Reinhold Birkenfeld
Kay Schluehr wrote: Dan Sommers schrieb: How about this: def __init__(self, self.x, y, self.z): # self.x, self.z from first and third explicit parameters do_something_with_y() Can you tell me in which way it is anyhow better than the original proposal def

C/API importing a module as __main__

2005-07-11 Thread Miki Tebeka
Hello All, Is there a way to import module as __main__? Say hw.py is: if __name__ == __main__: print Hello And the C code is (error handling omitted): int main(int argc, char *argv[]) { Py_Initialize(); PySys_SetArgv(argc, argv); atexit(Py_Finalize);

Re: What is Expresiveness in a Computer Language?

2005-07-11 Thread CBFalconer
Paul Bilnoski wrote: The barbar generals will just grunt while the French generals will inspire with some poetic invocation. For auction: One authentic French army-issued rifle. Only dropped once. What has that got to do with the king of the elephants? -- If you want to post a followup

Re: Legacy data parsing

2005-07-11 Thread Terry Hancock
On Friday 08 July 2005 01:31 pm, gov wrote: Where I work, we receive large quantities of data which is currently all printed on large, obsolete, dot matrix printers. This is a problem because the replacement parts will not be available for much longer. So I'm trying to create a program

Re: ZipFile and file rigths

2005-07-11 Thread Sybren Stuvel
Robert Kern enlightened us with: Yes, the .zip file format does store file permissions appropriate to the platform that generates the file. I never knew that! Thanks for correcting me ;-) Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for

Earthquake Forecasting Program July 11, 2005

2005-07-11 Thread edgrsprj
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html Newsgroup Readers: If you circulate copies of this report to groups of computer programmers at different

Re: ZipFile and file rigths

2005-07-11 Thread perchef
OTOH, I don't know if this has any relevance to the problem that you are seeing. not really, i have used the 'os.chmod' trick, but it's still interesting. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Forum

2005-07-11 Thread bruno modulix
Throne Software wrote: Throne Software has opened up a Python Forum at: http://www.thronesoftware.com/forum/ Join us! Why should we ? -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')]) --

gettext and disambiguating comments

2005-07-11 Thread Terry Hancock
I'm looking at the gettext module for the first time and learning how to write internationalized code in Python. Naturally, I also looked at the original Gnu gettext manual, which mentions that comments can be captured into the .po (.pot?) file for translators' benefit: /* Comment right before

__eq__ on a dict

2005-07-11 Thread Neil Benn
Hello, I can't find the docs for __eq__ on a dict and I can't find a description on what the eq does (strangely it does implement and but I have no idea what that does). Does anyone know (definitively) what the __eq__, __gt__, __lt__ methods do. BTW, google is not my friend

Re: Cat and Mouse (wes Re: Efficiency of using long integers to hold bitmaps)

2005-07-11 Thread Steven D'Aprano
On Mon, 11 Jul 2005 02:58:29 +, Bengt Richter wrote: I think you are right about some game happening, but I'm not sure it's cat and mouse. To me, an incomplete question feels like an invitation to play 20 questions regarding what the real problem is. So I get a little annoyed, and

Re: __eq__ on a dict

2005-07-11 Thread [EMAIL PROTECTED]
These methods are documanted here: http://docs.python.org/ref/customization.html -- http://mail.python.org/mailman/listinfo/python-list

Re: __eq__ on a dict

2005-07-11 Thread Steven D'Aprano
On Mon, 11 Jul 2005 12:42:55 +0200, Neil Benn wrote: Hello, I can't find the docs for __eq__ on a dict and I can't find a description on what the eq does (strangely it does implement and but I have no idea what that does). Does anyone know (definitively) what the __eq__,

Re: __eq__ on a dict

2005-07-11 Thread Neil Benn
[EMAIL PROTECTED] wrote: These methods are documanted here: http://docs.python.org/ref/customization.html Hmm, can't see anything about implementation of python dict methods __eq__, __lt__ or __gt__ there - general docs but not specific to the dict here - at least not as far as I can see

Re: __eq__ on a dict

2005-07-11 Thread Aaron Bingham
Steven D'Aprano [EMAIL PROTECTED] writes: On Mon, 11 Jul 2005 12:42:55 +0200, Neil Benn wrote: Hello, I can't find the docs for __eq__ on a dict and I can't find a description on what the eq does (strangely it does implement and but I have no idea what that does). Does

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Kay Schluehr
Reinhold Birkenfeld schrieb: Kay Schluehr wrote: Dan Sommers schrieb: How about this: def __init__(self, self.x, y, self.z): # self.x, self.z from first and third explicit parameters do_something_with_y() Can you tell me in which way it is anyhow better than

Re: math.nroot [was Re: A brief question.]

2005-07-11 Thread Michael Hudson
Tim Peters [EMAIL PROTECTED] writes: [Tim Peters] All Python behavior in the presence of infinities, NaNs, and signed zeroes is a platform-dependent accident, mostly inherited from that all C89 behavior in the presence of infinities, NaNs, and signed zeroes is a platform-dependent

Re: __eq__ on a dict

2005-07-11 Thread Neil Benn
Steven D'Aprano wrote: On Mon, 11 Jul 2005 12:42:55 +0200, Neil Benn wrote: Hello, I can't find the docs for __eq__ on a dict and I can't find a description on what the eq does (strangely it does implement and but I have no idea what that does). Does anyone know

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Dan Sommers
On Mon, 11 Jul 2005 08:34:45 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Kay Schluehr wrote: Dan Sommers schrieb: How about this: def __init__(self, self.x, y, self.z): # self.x, self.z from first and third explicit parameters do_something_with_y() Can you tell me in which

Re: decorators as generalized pre-binding hooks

2005-07-11 Thread Kay Schluehr
George Sakkis schrieb: 1. classes have metaclasses, functions don't have metafunctions. No one gave an example for classes not handled at least as well with a metaclass. Would something like the following count ? @abstractclass class AbstractFrame(object): @abstractclass

Re: __eq__ on a dict

2005-07-11 Thread [EMAIL PROTECTED]
Use the source, Luke dict_richcompare: http://fisheye.cenqua.com/viewrep/python/python/dist/src/Objects/dictobject.c?r=2.165#l1510 dict_compare: http://fisheye.cenqua.com/viewrep/python/python/dist/src/Objects/dictobject.c?r=2.165#l1425 /Simon --

Re: decorators as generalized pre-binding hooks

2005-07-11 Thread Christopher Subich
Kay Schluehr wrote: I think it would be a good idea to pronounce the similarity between function decorators and metaclasses. Metaclasses were once introduced as an arcane art of fuzzy bearded hackers or supersmart 'enterprise architects' that plan at least products of Zope size but not as a

Re: pyo contains absolute paths

2005-07-11 Thread David Siroky
V Sat, 09 Jul 2005 10:22:06 -0400, Peter Hansen napsal(a): David Siroky wrote: When I compile my python files with python -OO into pyo files then they still contain absolute paths of the source files which is undesirable for me. How can I deal with that? Don't do that? Delete the

Re: pyo contains absolute paths

2005-07-11 Thread David Siroky
V Sat, 09 Jul 2005 11:48:51 -0700, ncf napsal(a): Python is compiling the files with absolute paths because it is much faster to load a file when you know where it is, than to have to find it and then load it. I'm guessing you're wondering this so you can distribute it compiled or such? If

cursor positioning

2005-07-11 Thread Mage
Dear All, I am writing a database import script in python and I would like to print the percentage of the process to the last line. I would like to update the last line at every percent. You know what I mean. How can the cursor be positioned to the last line or somewhere else on the

Re: PPC floating equality vs. byte compilation

2005-07-11 Thread Michael Hudson
Terry Reedy [EMAIL PROTECTED] writes: Tim Peters [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [Donn Cave] I ran into a phenomenon that seemed odd to me, while testing a build of Python 2.4.1 on BeOS 5.04, on PowerPC 603e. test_builtin.py, for example, fails a couple of

httplib/HTTPS Post Problem

2005-07-11 Thread michaelparkin
Hi, Sorry to post what might seem like a trivial problem here, but its driving me mad! I have a simple https client that uses httplib to post data to a web server. When I post over http https using curl the data is recieved by the web server with no problems. When I post using my python

Re: pyo contains absolute paths

2005-07-11 Thread Michael Hudson
David Siroky [EMAIL PROTECTED] writes: Hi! When I compile my python files with python -OO into pyo files then they still contain absolute paths of the source files which is undesirable for me. How can I deal with that? Are you trying to save space? In 2.4 and later each code object

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Reinhold Birkenfeld
Dan Sommers wrote: Without thinking it all the way through, I suppose these: def method_1(self, *self.l): pass def method_2(self, **self.d): pass could act as if they were these: def method_1(self, *args): self.l = args del args def

Re: importing files from a directory

2005-07-11 Thread Thomas Guettler
Am Sat, 09 Jul 2005 20:30:04 -0700 schrieb spike grobstein: I'm a total Python newbie, so bear with me here... I'm writing a program that has a user-configurable, module-based architecture. it's got a directory where modules are stored (.py files) which subclass one of several master

Re: httplib/HTTPS Post Problem

2005-07-11 Thread Thomas Guettler
Am Mon, 11 Jul 2005 06:29:23 -0700 schrieb michaelparkin: Hi, Sorry to post what might seem like a trivial problem here, but its driving me mad! I have a simple https client that uses httplib to post data to a web server. When I post over http https using curl the data is recieved by

Re: pyo contains absolute paths

2005-07-11 Thread Daniel Dittmar
David Siroky wrote: When I compile my python files with python -OO into pyo files then they still contain absolute paths of the source files which is undesirable for me. How can I deal with that? Use the script compileall.py (in Lib) to compile all the files. This script has an option -d

ImportError: No module named numarray

2005-07-11 Thread enas khalil
when i write a code to import some module like the following : from nltk.probability import ConditionalFreqDist I got the error : Traceback (most recent call last): File "C:\Python24\toky.py", line 1, in -toplevel- from nltk.probability import ConditionalFreqDist File

Re: Lisp development with macros faster than Python development?..

2005-07-11 Thread Thomas Bartkus
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Well, his Viaweb company was founded in about '95, right? So he probably just used Lisp because Python wasn't as well known yet. ;-) David That is what I thought too. It makes sense but I wasn't sure. Still ain't. The problem

Re: cursor positioning

2005-07-11 Thread Larry Bates
While not curses based this class will update screen as you want. You could use it as a basis upon which to do a curses version with your cursor positioning. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207 -Larry Bates Mage wrote: Dear All, I am writing a database

relative import packages/modules workaround

2005-07-11 Thread peter
Hello all, I've read all the posts concerning relative imports of modules and I am glad I saw some consensus on a syntax. At this moment I am however bound to python 2.3. Does anyone know a good workaround (or a library) which can achieve a relative import for this python version kind regards

Re: cursor positioning

2005-07-11 Thread Mage
Larry Bates wrote: While not curses based this class will update screen as you want. You could use it as a basis upon which to do a curses version with your cursor positioning. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207 Thank you. This is good for displaying the

RE: cursor positioning

2005-07-11 Thread Albert Leibbrandt
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mage Sent: 11 July 2005 04:28 PM To: python-list@python.org Subject: Re: cursor positioning Larry Bates wrote: While not curses based this class will update screen as you want. You could use it as a basis

Re: Python exception hook simple example needed

2005-07-11 Thread Fuzzyman
Ed Leafe wrote: On Jul 7, 2005, at 7:27 AM, Fuzzyman wrote: Do you have an exception handling dialog ? Not per se, as there hasn't been a request for one; we have several dialogs ranging from simple messages to alerts to interactive dialogs, much as wxPython offers. But I'll make

Re: cursor positioning

2005-07-11 Thread James Carroll
I haven't tried this myself, but I think the secret to displaying a continuously updating %done on the command line is to print file 100, 1% done then send exactly 7 backspaces to the terminal, then print 2% done... so the backspaces will write over the previous text. Backspace is a \x08

Re: cursor positioning

2005-07-11 Thread Mage
James Carroll wrote: I haven't tried this myself, but I think the secret to displaying a continuously updating %done on the command line is to print file 100, 1% done then send exactly 7 backspaces to the terminal, then print 2% done... so the backspaces will write over the previous text.

Re: importing files from a directory

2005-07-11 Thread spike grobstein
my reason for loading both the .py and .pyc files was just in case compiled files were supplied as modules... but I'm gonna disallow that, so yeah. I also got a response in email and I've been dabbling with my code since I posted this and found a slightly better way of handling this plugin

Re: Read-only class properties

2005-07-11 Thread Bengt Richter
On Sun, 10 Jul 2005 21:10:36 -0700, Michael Spencer [EMAIL PROTECTED] wrote: Bengt Richter wrote: ... class Foo(object): class __metaclass__(type): def __setattr__(cls, name, value): if type(cls.__dict__.get(name)).__name__ == 'Descriptor': raise

Re: cursor positioning

2005-07-11 Thread Jeff Epler
Here's a simple module for doing progress reporting. On systems without curses, it simply uses \r to return the cursor to the first column. On systems with curses, it also clears to the end of the line. This means that when the progress message gets shorter, there aren't droppings left from the

Getting files in a subdirectory in a zip

2005-07-11 Thread Echo
What would the best way to get a list of files in a subdirectory in a zip? The only thing I can come up with is to extract the zip into a temp directory and then just grab the list of files in the subdirectory that I need. This way seems very messy to me and I was wondering if there are any

regular expression questions in Python

2005-07-11 Thread Jeremy
I am (very) new top regular expressions and I am having a difficult time understanding how to do them. I have the following in my script: zaidsearch = r'''^ {5,}([\d]{4,5})(.\d{2,2}c)''' ZAIDSearch = re.compile(search, re.IGNORECASE) When I do: ZAID.search(...) then this works fine. I would

Re: Should I use if or try (as a matter of speed)?

2005-07-11 Thread Dark Cowherd
def joels_function(args): error_result = 0 good_result = None process(args) if error_condition(): error_result = -1 # flag for an error elif different_error_conditon(): error_result = -2 else: more_processing() if

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Bengt Richter
On Mon, 11 Jul 2005 01:44:07 -0400, Terry Reedy [EMAIL PROTECTED] wrote: Bengt Richter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Me too. I liked the leading _, but on second thought it is a weird language change re names in a special context. Probably not so good. To

Re: Yet Another Python Web Programming Question

2005-07-11 Thread Bill Mill
Python using CGI, for example, was enough for him until he started getting 500 errors that he wasn't sure how to fix. A common error is that python cgi files need line endings to be in unix text file format, not windows text file format (\n instead of \r\n) [1]. Why this is, I don't know, but

Re: regular expression questions in Python

2005-07-11 Thread Reinhold Birkenfeld
Jeremy wrote: I am (very) new top regular expressions and I am having a difficult time understanding how to do them. I have the following in my script: zaidsearch = r'''^ {5,}([\d]{4,5})(.\d{2,2}c)''' ZAIDSearch = re.compile(search, re.IGNORECASE) When I do: ZAID.search(...) then this

Re: decorators as generalized pre-binding hooks

2005-07-11 Thread Kay Schluehr
Christopher Subich schrieb: Kay Schluehr wrote: I think it would be a good idea to pronounce the similarity between function decorators and metaclasses. Metaclasses were once introduced as an arcane art of fuzzy bearded hackers or supersmart 'enterprise architects' that plan at least

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Bengt Richter
On Mon, 11 Jul 2005 15:37:35 +0200, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Dan Sommers wrote: Without thinking it all the way through, I suppose these: def method_1(self, *self.l): pass def method_2(self, **self.d): pass could act as if they were these:

Re: Legacy data parsing

2005-07-11 Thread gov
Actually, we receive the data in the form of a text file. The original data is sent from an IBM mainframe then to Ottawa where it is captured by an SNA Print Server that receives the VPS print jobs, writes them to disk and then runs a PERL script program on the disk file. This PERL script

C API : Creating a Py_Method object from a C function.

2005-07-11 Thread Hugh Macdonald
I've got a pure python module that parses a certain type of file. It has a load() function that allows a callback function to be passed for getting progress information. In straight python, this works fine. However, I'm now trying to use this from a C++ program. The current flow that I'm trying

Re: Getting files in a subdirectory in a zip

2005-07-11 Thread Scott David Daniels
Echo wrote: What would the best way to get a list of files in a subdirectory in a zip? The only thing I can come up with is to extract the zip into a temp directory and then just grab the list of files in the subdirectory that I need. This way seems very messy to me and I was wondering if

ftputil - uploading many files too long

2005-07-11 Thread geon
Hi, When I try to upload many files I get such a error message: Traceback (most recent call last): File I:\Python\my_py\wwwzaci\xcopy_ftp.py, line 51, in ? except: x=host.upload(zdroj, cilFTP,'b') File C:\prg\python24\Lib\site-packages\ftputil\ftputil.py, line 463, in uplo ad

Re: What is Expresiveness in a Computer Language?

2005-07-11 Thread Default User
Randy Howard wrote: Keith Thompson wrote (in article [EMAIL PROTECTED]): \/| |\| __\,,\ /,,/__ \||/ | | | jgs (__Y__) /\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Tricky Dictionary Question from newbie

2005-07-11 Thread Ric Da Force
Hi all, I have a dictionary containing about 300 items, some of the values being repeated. Both keys and values are strings. How can I turn this thing on its head so that we create a key based on each unique value and build the values based on the keys corresponding to the repeated values?

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Cyril Bazin
Hello, Try that, it may not be the better solution, but it seems to work: #def invertDict(d): # d2 = {} # for k, v in d.iteritems(): # d2.setdefault(v, []).append(k) # return d2 Cyril On 7/11/05, Ric Da Force [EMAIL PROTECTED] wrote: Hi all,I have a dictionary containing about 300 items, some

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Markus Weihs
Hi! Dict = {'rt': 'repeated', 'sr':'repeated', 'gf':'not repeated'} NewDic = {} for k,v in Dict.items(): NewDic.setdefault(v, []).append(k) Regards, mawe -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Cyril Bazin
Hum... I think an iteritems is better, this way, python don't need to create in memory a complete list of couple key, value.On 7/11/05, Markus Weihs [EMAIL PROTECTED] wrote: Hi! Dict = {'rt': 'repeated', 'sr':'repeated', 'gf':'not repeated'} NewDic = {} for k,v in Dict.items():

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Mark Jackson
Ric Da Force [EMAIL PROTECTED] writes: It is hard to explain but this is what I mean: Dict = {'rt': 'This is repeated', 'sr': 'This is repeated', 'gf': 'This is not'} I want this to return a new dict with string keys and lists containing the previous keys for repeated values.

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Reinhold Birkenfeld
Mark Jackson wrote: Ric Da Force [EMAIL PROTECTED] writes: It is hard to explain but this is what I mean: Dict = {'rt': 'This is repeated', 'sr': 'This is repeated', 'gf': 'This is not'} I want this to return a new dict with string keys and lists containing the previous keys for

Re: cursor positioning

2005-07-11 Thread Danny Milosavljevic
Hi, On Mon, 11 Jul 2005 15:29:41 +0200, Mage wrote: Dear All, I am writing a database import script in python and I would like to print the percentage of the process to the last line. I would like to update the last line at every percent. You know what I mean. How can the

Re: relative import packages/modules workaround

2005-07-11 Thread Terry Hancock
On Monday 11 July 2005 09:19 am, peter wrote: I've read all the posts concerning relative imports of modules and I am glad I saw some consensus on a syntax. At this moment I am however bound to python 2.3. Does anyone know a good workaround (or a library) which can achieve a relative import

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Ralf W. Grosse-Kunstleve
--- Bengt Richter [EMAIL PROTECTED] wrote: I still think it's too specialized. What would, hypothetically, this do? class Bar: pass class Foo: x = Bar() def method_1(self, x.y): pass It's hard to explain that you can autoassign self.y but not x.y. No, that

Re: ImportError: No module named numarray

2005-07-11 Thread Robert Kern
enas khalil wrote: when i write a code to import some module like the following : from nltk.probability import ConditionalFreqDist I got the error : Traceback (most recent call last): File C:\Python24\toky.py, line 1, in -toplevel-

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Ralf W. Grosse-Kunstleve
--- Robert Williscroft [EMAIL PROTECTED] wrote: My apologies for having to resort to email but for some reason I can't post this message to comp.lang.python. I've tried about 4 times including starting a new thread, but for some reason it doesn't turn up, though I've followed up on

Environment Variable

2005-07-11 Thread Vivek Chaudhary
Is it possible to set an environment variable in python script whose value is retained even after the script exits. Doing the following creates an environment variable name which is visible to only subprocesses created by os.system() and os.popen(). os.putvar(name, vivek) Is it possible to

Re: Environment Variable

2005-07-11 Thread Grant Edwards
On 2005-07-11, Vivek Chaudhary [EMAIL PROTECTED] wrote: Is it possible to set an environment variable in python script whose value is retained even after the script exits. No, not in Unix/Linux. In VMS I think there is. -- Grant Edwards grante Yow! I think

Re: computer algebra packages

2005-07-11 Thread Florian Diesch
François Pinard [EMAIL PROTECTED] wrote: Mascyma is (trying to be) a user-friendly graphical frontend for the Computer Algebra System GNU MAXIMA. I was not successful googling for this one. Would you have an URL handy? Oops, OK! Found it at http://cens.ioc.ee/~pearu/misc/maxima/ .

Parsing Data, Storing into an array, Infinite Backslashes

2005-07-11 Thread [EMAIL PROTECTED]
I am using this function to parse data I have stored in an array. This is what the array looks like: [['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed', 'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0', 'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory',

BayPIGgies: July 14, 7:30pm (Google)

2005-07-11 Thread Aahz
The next meeting of BayPIGgies will be Thurs, July 14 at 7:30pm at Google, building 40, room Temp Tech Talk. Alex Martelli will be doing his Black Magic talk on descriptors, decorators, and metaclasses. Prepare to have your head exploded! BayPIGgies meetings alternate between IronPort (San

Re: Environment Variable

2005-07-11 Thread Sybren Stuvel
Vivek Chaudhary enlightened us with: Is it possible to set an environment variable in python script whose value is retained even after the script exits. It is, if you have absolute control over the calling environment. Is it possible to somehow create this environment variable inside python

Extending and embedding Python

2005-07-11 Thread Tommy Nordgren
I want to write an application that embeds and extends (at least) the Python and Perl interpreters. Now i want to find as much as possible about the Python tools used for extending and embedding Python. To be more specific: My app should: 1. Parse an input file. 2. Call a script in some

Environment Variable

2005-07-11 Thread tuxlover
Is it possible to set an environment variable from inside the python script which will be retained after the script exits. If I use the following code: import os os.putvar(name, tuxlover) the enivironment variable name is visible to only the sub-process created by os.system and os.popen. But as

Re: Parsing Data, Storing into an array, Infinite Backslashes

2005-07-11 Thread Jeff Epler
Your code is needlessly complicated. Instead of this business while 1: try: i = fetch.next() except stopIteration: break simply write: for i in fetch: (if there's an explicit 'fetch = iter(somethingelse)' in code you did not show, then get rid of

Minor correction July 11, 2005

2005-07-11 Thread edgrsprj
edgrsprj [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT it jumps strait to the display routine and uses the entered command to begin Should be the word straight instead of strait. --

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Rob Williscroft
Ralf W. Grosse-Kunstleve wrote in news:[EMAIL PROTECTED] in comp.lang.python: --- Robert Williscroft [EMAIL PROTECTED] wrote: My apologies for having to resort to email but for some reason I can't post this message to comp.lang.python. I've tried about 4 times including starting a new

tuple.index(item)

2005-07-11 Thread David Isaac
Why don't tuples support an index method? It seems natural enough ... Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Environment Variable

2005-07-11 Thread Reinhold Birkenfeld
[EMAIL PROTECTED] wrote: Is it possible to set an environment variable from inside the python script which will be retained after the script exits. If I use the following code: import os os.putvar(name, tuxlover) the enivironment variable name is visible to only the sub-process

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Lonnie Princehouse
IIRC, the self.__dict__.update(locals()) trick confuses psyco. But you can make a decorator to achieve the same result. There's not really a convincing case for extending python syntax. def attribute_decorator(f): import inspect argnames = inspect.getargspec(f)[0] def

read output and store in file

2005-07-11 Thread [EMAIL PROTECTED]
Hi, I'm a beginner, and what I want to accomplish is this: 1. For all files under several folders, do some processing (using an existing program). The program will output one line of text for each file. 2. Store the output of all files in one file. It would be great if someone can give me a

Re: read output and store in file

2005-07-11 Thread Grant Edwards
On 2005-07-11, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm a beginner, and what I want to accomplish is this: 1. For all files under several folders, do some processing (using an existing program). The program will output one line of text for each file. 2. Store the output of all files

Re: Environment Variable

2005-07-11 Thread tuxlover
Sorry for posting twice. -- http://mail.python.org/mailman/listinfo/python-list

Re: read output and store in file

2005-07-11 Thread tuxlover
use os.path.walk() or os.walk() Tuxlover -- http://mail.python.org/mailman/listinfo/python-list

Re: Environment Variable

2005-07-11 Thread Reinhold Birkenfeld
[EMAIL PROTECTED] wrote: Sorry for posting twice. Sorry for forgetting my wink. wink Reinhold -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Ralf W. Grosse-Kunstleve
--- Lonnie Princehouse [EMAIL PROTECTED] wrote: IIRC, the self.__dict__.update(locals()) trick confuses psyco. But you can make a decorator to achieve the same result. There's not really a convincing case for extending python syntax. Not if you have (enough memory for) psyco. :) I am

Help with report

2005-07-11 Thread ChrisH
I have some data in the following format: Fred Flintstone,445553454,47634565 Wilma Flintstone,74857346,27576847 Barney Rubble,73487346,27576435 I need to convert this data into a report with the user's name and difference between the 2 numbers. Can someone recommend a good way to do this?

Re: [Baypiggies] BayPIGgies: July 14, 7:30pm (Google)

2005-07-11 Thread tpc247
I'd like to proffer the suggestion we meet for dinner at 6pm at Mei Long in Mountain View, although it's probably best to run it past our dinner coordinator first to make sure it gets his OK. What say you Brian ? On 7/11/05, Aahz [EMAIL PROTECTED] wrote: Before the meeting, we may meet at

Re: Help with report

2005-07-11 Thread Grant Edwards
On 2005-07-11, ChrisH [EMAIL PROTECTED] wrote: I have some data in the following format: Fred Flintstone,445553454,47634565 Wilma Flintstone,74857346,27576847 Barney Rubble,73487346,27576435 I need to convert this data into a report with the user's name and difference between the 2

Re: gettext and disambiguating comments

2005-07-11 Thread Martin v. Löwis
Terry Hancock wrote: /* Comment right before the gettext call, obviously in C */ printf(_(Apparently ambiguous string to translate)); This will get captured into the .po file, according to the gettext manual and appear as a comment right before the msgid (i.e. next to the line number

How does this code works:

2005-07-11 Thread vch
Here's an example from some book: def foo(n): s = [n] def bar(i): s[0] += i return s[0] return bar what I don't understand is how this example works, taking into account the LGB rule. I thought that s is not accessible from bar, but it is,

Re: C API : Creating a Py_Method object from a C function.

2005-07-11 Thread Martin v. Löwis
Hugh Macdonald wrote: The problem in this workflow is taking the C python function that I've defined (using the standard static PyObject *someFunction(PyObject *self, PyObject *args) method) and converting this into a Py_Object. Any ideas? You should use PyCFunction_New(Ex), passing a static

Re: Extending and embedding Python

2005-07-11 Thread Martin v. Löwis
Tommy Nordgren wrote: In order to correctly compile and link my Application, I need a OS independent way to find compiler options and linker options necessary to find header files and libraries. What methods should I use from DistUtils for this purpose. I don't think distutils supports

Re: How long is a piece of string? How big's a unit?

2005-07-11 Thread Chuck E. Cheese
The correct answer to the above question How long is a piece of string? is 2 times half it's length CEC -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Rob Williscroft
Ralf W. Grosse-Kunstleve wrote in news:[EMAIL PROTECTED] in comp.lang.python: Does anyone know if there is a way to hide the _ or self_ from the user of the class, i.e. given: class foo(object): @attribute_decorator def __init__(self, x, _y, z): pass can we

Re: How does this code works:

2005-07-11 Thread Robert Kern
vch wrote: Here's an example from some book: def foo(n): s = [n] def bar(i): s[0] += i return s[0] return bar what I don't understand is how this example works, taking into account the LGB rule. I thought that s is not accessible from

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Ralf W. Grosse-Kunstleve
--- Rob Williscroft [EMAIL PROTECTED] wrote: def init_self( init ): class KeywordArgumentError(Exception): pass vn = init.func_code.co_varnames[ 1 : init.func_code.co_argcount ] def decorated_init(self, *args, **kw): off = 0 for name in vn: if not

  1   2   >