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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<    1   2