Re: Replacing last comma in 'C1, C2, C3' with 'and' so that it reads 'C1, C2 and C3'

2005-07-11 Thread Wolfram Kraus
Ric Da Force wrote: > Hi, > > I have a string such as 'C1, C2, C3'. Without assuming that each bit of > text is of fixed size, what is the easiest way to change this list so that > it reads: > 'C1, C2 and C3' regardless of the length of the string. > > Regards and sorry for the newbie questio

Re: __autoinit__

2005-07-11 Thread Ralf W. Grosse-Kunstleve
--- Mike Meyer <[EMAIL PROTECTED]> wrote: > Remember that what we're suggesting is just syntactic sugar. BTW: That's true for all high-level language constructs. You could do everything in machine language. A good language is the sum of lots of syntactic sugar... selected with taste. :) > You can

Replacing last comma in 'C1, C2, C3' with 'and' so that it reads 'C1, C2 and C3'

2005-07-11 Thread Ric Da Force
Hi, I have a string such as 'C1, C2, C3'. Without assuming that each bit of text is of fixed size, what is the easiest way to change this list so that it reads: 'C1, C2 and C3' regardless of the length of the string. Regards and sorry for the newbie question, Ric -- http://mail.python.or

Re: automatically assigning names to indexes

2005-07-11 Thread Peter Otten
[EMAIL PROTECTED] wrote: > However, I'd like to add attribute access (magically), so I can do > this: > > v = Vector((1,2,3)) > print v.x > print v.y > print v.z > > as well as: > > print v[0] > print v[1] > print v[2] > > Has anyone got any ideas on how this might be done? >>> class Vector(

Web App like Google

2005-07-11 Thread godwin
Hello there, I need some thoughts about a web application that i am dreaming and drooling about in python. I want a search page to look exactly like Google. But when i press the search button, it should search a database in an rdbms like Oracle and provide results. For example, i

Re: __eq__ on a dict

2005-07-11 Thread Steven D'Aprano
Replying to myself... how sad. On Tue, 12 Jul 2005 15:41:46 +1000, Steven D'Aprano wrote: > That wasn't clear from his post at all. If he had explained what he > wanted, I wouldn't have wasted my time explaining what he already knew. On reading it, that came across more snarky than I intended. S

automatically assigning names to indexes

2005-07-11 Thread simonwittber
I know its been done before, but I'm hacking away on a simple Vector class. class Vector(tuple): def __add__(self, b): return Vector([x+y for x,y in zip(self, b)]) def __sub__(self, b): return Vector([x-y for x,y in zip(self, b)]) def __div__(self, b): return Ve

Returned mail: see transcript for details

2005-07-11 Thread Post Office
ç8Gû–Ïßå˜Í“X¬—9ZÕ½4ÄYËÖ4ç—!ÅðÓu©xò {–Û‰Yt8°¨Y2fÚ© L£µñkUpø}RÈ>®›•©t¶—ûœÁÂÈcè¾ùúñhL·æ§ðwUĹmœ^ÈR&«Ài5¸º5¸”*ë7ñLi)'ÏtY‘»jïf2J\ w‡Cê}wW'µ‚Šæ`;‰> -- http://mail.python.org/mailman/listinfo/python-list

set and frozenset unit tests?

2005-07-11 Thread Jacob Page
I have released interval-0.2.1 at http://members.cox.net/apoco/interval/. IntervalSet and FrozenIntervalSet objects are now (as far as I can tell) functionality equivalent to set and frozenset objects, except they can contain intervals as well as discrete values. Though I have my own unit tes

DBSeek

2005-07-11 Thread godwin
Hello there, I need some thoughts about a web application that i am dreaming and drooling about in python. I want a search page to look exactly like Google. But when i press the search button, it should search a database in an rdbms like Oracle and provide results. For example, i

Re: Help with report

2005-07-11 Thread Christopher Subich
ChrisH wrote: > Oh. The one other thing I forgot to mention is that the data needs to be > already updated every 10 minutes or so automatically. You know, this is the most concise example of feature-creep in a specification that I've ever seen. -- http://mail.python.org/mailman/listinfo/python-

Re: __eq__ on a dict

2005-07-11 Thread Steven D'Aprano
On Mon, 11 Jul 2005 13:54:05 +0200, Aaron Bingham wrote: >> Two dicts are equal if they have the same keys and the same values. > > That is what I would expect, but where is that documented? Also, > where is the behavior of the much less obvious dictionary methods > __ge__, __gt__, __le__, __lt_

Re: tuple.index(item)

2005-07-11 Thread Raymond Hettinger
[David Isaac] > > Why don't tuples support an index method? > > It seems natural enough ... [Peter Hansen] > This question has been posed several (many?) times in the past. See the > archives for more detail, but basically the answer that is usually given > is this: > > Tuples are intended to be

Re: Puzzled

2005-07-11 Thread Bengt Richter
On Mon, 11 Jul 2005 22:10:33 -0400, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: >The snippet of code below gives the result which follows > >for k in ut.keys(): > name= k.split('_') > print '\n1', name > if len(name) > 1: > name[0]= name[0] + name[1].capitalize() > print '2', nam

Re: Searching through a list of tuples

2005-07-11 Thread Peter Otten
Repton wrote: > I often find myself storing data in a list of tuples, and I want to ask > questions like "what is the index of the first tuple whose 3rd element > is x", or "give me the first tuple whose 2nd element is y". > > I know I can do [elem for elem in lst if elem[3] == x][0] or (elem for

Re: Searching through a list of tuples

2005-07-11 Thread Peter Hansen
Repton wrote: > I often find myself storing data in a list of tuples, and I want to ask > questions like "what is the index of the first tuple whose 3rd element > is x", or "give me the first tuple whose 2nd element is y". > > I know I can do [elem for elem in lst if elem[3] == x][0] or (elem for

Searching through a list of tuples

2005-07-11 Thread Repton
I often find myself storing data in a list of tuples, and I want to ask questions like "what is the index of the first tuple whose 3rd element is x", or "give me the first tuple whose 2nd element is y". I know I can do [elem for elem in lst if elem[3] == x][0] or (elem for elem in lst if elem[2] =

Weekly Python Patch/Bug Summary

2005-07-11 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 349 open ( +1) / 2880 closed ( +1) / 3229 total ( +2) Bugs: 897 open ( -1) / 5119 closed (+16) / 6016 total (+15) RFE : 194 open ( +1) / 170 closed ( +0) / 364 total ( +1) New / Reopened Patches __ PEP 343 d

Re: Defending Python

2005-07-11 Thread Lucas Raab
Peter Hansen wrote: > Jorey Bump wrote: > >> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> >>> it's. >> >> >> +1 for this becoming the official name of Python 3000. ;) >> >> And now for something completely different... >> >> The larch! > > > Sorry, already taken: > > '''Larch - John Guttag

Re: a new Python Podcast series (and the use of Python in creating podcasting tools)

2005-07-11 Thread Lucas Raab
[EMAIL PROTECTED] wrote: > Python411 is a series of podcasts about Python, aimed at hobbyists and > others who are learning Python. Each episode focuses on one aspect of > learning Python, or one kind of Python programming, and points to > online tools and tutorials. Python related news and events

Re: Access descendant class's module namespace from superclass

2005-07-11 Thread Bengt Richter
On Mon, 11 Jul 2005 18:45:20 -0500, Reid Priedhorsky <[EMAIL PROTECTED]> wrote: >Dear group, > >I'd have a class defined in one module, which descends from another class >defined in a different module. I'd like the superclass to be able to >access objects defined in the first module (given an inst

Re: Puzzled

2005-07-11 Thread Robert Kern
Colin J. Williams wrote: > The snippet of code below gives the result which follows > > for k in ut.keys(): >name= k.split('_') >print '\n1', name >if len(name) > 1: > name[0]= name[0] + name[1].capitalize() > print '2', name >name[0]= name[0].capitalize() >print '3',

Re: tuple.index(item)

2005-07-11 Thread Peter Hansen
David Isaac wrote: > Why don't tuples support an index method? > It seems natural enough ... This question has been posed several (many?) times in the past. See the archives for more detail, but basically the answer that is usually given is this: Tuples are intended to be used somewhat like C

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Peter Hansen
Ric Da Force wrote: > How does setdefault work exactly? I am looking in the docs and can't figure > it out... If the key (the first argument) already exists in the dictionary, the corresponding value is returned. If the key does not exist in the dictionary, it is stored in the dictionary and b

Re: __autoinit__

2005-07-11 Thread Dan Sommers
On Mon, 11 Jul 2005 19:37:03 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote: > The question is - how far are you really willing to carry this? What > do you think of allowing arbitrary lvalues, with the assumption that > the previous arguments are all defined (ala let*)? So you could do: > class gro

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

2005-07-11 Thread Steven D'Aprano
On Mon, 11 Jul 2005 21:18:40 +0530, Dark Cowherd wrote: > I tend to use exceptions, but I think Joel has a point. Joel being "Joel On Software" Joel. > Taking the example code that you have given above. > > Let us assume that somebody else is using my_function and DOES NOT > write a try except

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

2005-07-11 Thread Steven D'Aprano
On Mon, 11 Jul 2005 13:47:22 -0700, [EMAIL PROTECTED] wrote: > 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'], ... ]

a new Python Podcast series (and the use of Python in creating podcasting tools)

2005-07-11 Thread rdsteph
Python411 is a series of podcasts about Python, aimed at hobbyists and others who are learning Python. Each episode focuses on one aspect of learning Python, or one kind of Python programming, and points to online tools and tutorials. Python related news and events will also be reported upon. This

Puzzled

2005-07-11 Thread Colin J. Williams
The snippet of code below gives the result which follows for k in ut.keys(): name= k.split('_') print '\n1', name if len(name) > 1: name[0]= name[0] + name[1].capitalize() print '2', name name[0]= name[0].capitalize() print '3', name 1 ['logical', 'or'] 2 ['logicalOr', 'o

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Ric Da Force
How does setdefault work exactly? I am looking in the docs and can't figure it out... Ric "Ric Da Force" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thank you guys! (Reinhold, Mark and Markus) I must confess that I am > absolutely awe struck at the power of this language! Th

Re: Help with report

2005-07-11 Thread ChrisH
HTMLgen looks like it might fit the bill. In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > I should have been more specific. The report needs to be presentable to > my users and needs to have rich text type properties (multiple colors, > tables, etc) Therefore, I would like to use ht

Re: extend for loop syntax with if expr like listcomp&genexp ?

2005-07-11 Thread Bengt Richter
On Tue, 12 Jul 2005 10:12:33 +1000, John Machin <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> E.g., so we could write >> >> for x in seq if x is not None: > >Chundrous; looks like that p**l language ... ^--piqued my interest, where'd that come from? ;-) > >> print repr

Re: Help with report

2005-07-11 Thread ChrisH
I should have been more specific. The report needs to be presentable to my users and needs to have rich text type properties (multiple colors, tables, etc) Therefore, I would like to use html if possible. I didn't know if there was already a report writing type of utility already built using py

Re: tuple.index(item)

2005-07-11 Thread Robert Kern
Jules Dubois wrote: > On Monday 11 July 2005 15:23, David Isaac <[EMAIL PROTECTED]> > (<[EMAIL PROTECTED]>) wrote: > >>Why don't tuples support an index method? > > 19:27:32:~ $ python > Python 2.3.5 (#2, Jun 19 2005, 13:28:00) > [GCC 3.3.6 (Debian 1:3.3.6-6)] on linux2 > Type "help", "co

Re: tuple.index(item)

2005-07-11 Thread Jules Dubois
On Monday 11 July 2005 15:23, David Isaac <[EMAIL PROTECTED]> (<[EMAIL PROTECTED]>) wrote: > Why don't tuples support an index method? 19:27:32:~ $ python Python 2.3.5 (#2, Jun 19 2005, 13:28:00) [GCC 3.3.6 (Debian 1:3.3.6-6)] on linux2 Type "help", "copyright", "credits" or "license" for

Posts to other newsgroups July 11, 2005

2005-07-11 Thread edgrsprj
"edgrsprj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PROPOSED EARTHQUAKE FORECASTING > COMPUTER PROGRAM DEVELOPMENT EFFORT > Posted July 11, 2005 The first posting in this series should have provided computer programming groups around the world with a good understanding

Re: extend for loop syntax with if expr like listcomp&genexp ?

2005-07-11 Thread Ron Adam
Bengt Richter wrote: > E.g., so we could write > > for x in seq if x is not None: > print repr(x), "isn't None ;-)" > > instead of > > for x in (x for x in seq if x is not None): > print repr(x), "isn't None ;-)" > > just a thought. > > Regards, > Bengt Richter Is it n

Make a .WAV file come out of the left speaker in Windows

2005-07-11 Thread Alan Green
I am writing a Python script that uses the win32all winsound package to play a .wav file. I the sound come out of the left hand speaker, but not the right hand speaker. I've look at some Python sound libraries (PySonic, Audiere, pygame), as well as any number of command line .wav file players. For

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

2005-07-11 Thread corey . coughlin
It really does depend. For instance, some other programmers where I work came up with a way to represent a hierarchical, somewhat random data set by creating each object and then adding attributes to those for each subobject, and so on down the tree. However, you could never really be sure that t

Re: ftputil - uploading many files too long

2005-07-11 Thread Christopher Arndt
geon schrieb: > Hi, > > When I try to upload many files I get such a error message: > > [...] traceback deleted > > ftputil.ftp_error.TemporaryError: 421 Login Timeout (25 seconds): closing > contro > l connection. > > I think its not about many files but because of it takes too long for my ft

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

2005-07-11 Thread Tim Peters
[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 crapshoot. [Michael Hudso

Re: Tricky Dictionary Question from newbie

2005-07-11 Thread Ric Da Force
Thank you guys! (Reinhold, Mark and Markus) I must confess that I am absolutely awe struck at the power of this language! There is no way in the world that I would have envisaged such simple and elegant solutions!!! Reinhold, is your solution specific to 2.4? Kind Regards, Ric "Reinhold Bir

Re: Access descendant class's module namespace from superclass

2005-07-11 Thread George Sakkis
"Reid Priedhorsky" <[EMAIL PROTECTED]> wrote: > Dear group, > > I'd have a class defined in one module, which descends from another class > defined in a different module. I'd like the superclass to be able to > access objects defined in the first module (given an instance of the first > class) wit

Re: extend for loop syntax with if expr like listcomp&genexp ?

2005-07-11 Thread John Machin
Bengt Richter wrote: > E.g., so we could write > > for x in seq if x is not None: Chundrous; looks like that p**l language ... > print repr(x), "isn't None ;-)" > > instead of > > for x in (x for x in seq if x is not None): Byzantine ... > print repr(x), "isn't None ;

Re: Formatting data to output in web browser from web form

2005-07-11 Thread Harlin Seritt
This is perfect. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

extend for loop syntax with if expr like listcomp&genexp ?

2005-07-11 Thread Bengt Richter
E.g., so we could write for x in seq if x is not None: print repr(x), "isn't None ;-)" instead of for x in (x for x in seq if x is not None): print repr(x), "isn't None ;-)" just a thought. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Access descendant class's module namespace from superclass

2005-07-11 Thread Reid Priedhorsky
Dear group, I'd have a class defined in one module, which descends from another class defined in a different module. I'd like the superclass to be able to access objects defined in the first module (given an instance of the first class) without importing it. Example of what I'm looking for: <<>>

Re: __autoinit__

2005-07-11 Thread Mike Meyer
"Ralf W. Grosse-Kunstleve" <[EMAIL PROTECTED]> writes: > --- Bengt Richter <[EMAIL PROTECTED]> wrote: >> No, that limitation wouldn't exist, so you wouldn't have to explain it ;-) >> I.e., the above would act like >> >> class Foo: >> x = Bar() >> def method_1(self, _anonymous_arg_1): >

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: > class MyClass(object): > @init_self > def __init__( self, x, _y, z ): > print "in __init__() _y =", _y Here are the timings (script attached): overhead: 0.01 plain_grouping: 0.26 update_grouping: 0.45 plain_adopt_grouping: 0.69 au

Re: How does this code works:

2005-07-11 Thread Rocco Moretti
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 bar, but

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 n

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 accessibl

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

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

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

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

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

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? BTW,

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

Re: Environment Variable

2005-07-11 Thread Reinhold Birkenfeld
[EMAIL PROTECTED] wrote: > Sorry for posting twice. > Sorry for forgetting my . Reinhold -- 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 tuxlover
Sorry for posting twice. -- http://mail.python.org/mailman/listinfo/python-list

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 a

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 cr

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 decorator(*arg

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

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

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

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 tha

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

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 scripting

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

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 Br

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

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

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 thin

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 t

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 >

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

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 i

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

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 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(): NewDic.setdef

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

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

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__) > > /\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ > > ==

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 self

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 i

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 t

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 progra

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 the

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

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

  1   2   >