Re: who can tell me BASICS of Python

2005-02-04 Thread M.E.Farmer
I guess it depends :) Let us know what works for you. M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Re: EDI x12 --> XML

2005-02-04 Thread Satchidanand Haridas
Hi, In case you weren't aware of the pyx12 project on sourceforge. The project summary on sourceforge.net (http://sourceforge.net/projects/pyx12/) says the following and I quote: "pyx12 is a python based ANSI X.12 to XML EDI translator and validator. It is designed to be a step in the convers

Medical GUI Application With Python

2005-02-04 Thread Evrim Ozcelik
We are developing a medical software about PSG (PolySomnoGraphy) analysis. The application takes signal data from an electronic device and we will show this continious signal function on the interfaces. There are about 20-30 signal channels and the user selected channels are shown. We want

Re: PythonWin and PyWin32

2005-02-04 Thread M.E.Farmer
Chris Lott wrote: >More to the point, do I need to worry >about this as I am learning about Python, since Idle and the Windows >Installer seem to work fine on my XP box? Relax this is Python :) Not sure why you would worry at all about any IDE. Especially when they your current IDE works fine. To a

Re: empty classes as c structs?

2005-02-04 Thread Leif K-Brooks
Alan McIntyre wrote: You could do something like this: blah = type('Struct', (), {})() blah.some_field = x I think I'd only do this if I needed to construct objects at runtime based on information that I don't have at compile time, since the two lines of code for your empty class would probably b

Re: changing local namespace of a function

2005-02-04 Thread M.E.Farmer
>It is ugly, unreadable and error prone. If I have to use this code, I >would write > _z = func(_x + _y + _whatever['as'] + _a[0]) >and use a perl script to generate the real code. (See, I am not lazy :-) Ok laziness is an acceptable answer ;) This is starting to make sense , you've been reading

who can tell me BASICS of Python

2005-02-04 Thread fanweixiao
I want to know which compiler I can use ... thank you -- http://mail.python.org/mailman/listinfo/python-list

PythonWin and PyWin32

2005-02-04 Thread Chris Lott
Can someone elaborate for me what the pywin32 project is exactly? Is PythonWin a replacement for idle? More to the point, do I need to worry about this as I am learning about Python, since Idle and the Windows Installer seem to work fine on my XP box? c -- http://mail.python.org/mailman/listinfo

Re: changing local namespace of a function

2005-02-04 Thread Bo Peng
Maybe it is just my laziness. It is almost intolerable for me to write lines and lines of code like d['z'] = func(d['x']+d['y']+d['whatever']['as']+d[a][0] ) By the way, will 'with statement', like the one in pascal and many other languages, be a good addition to python? For example, with d d

Re: changing local namespace of a function

2005-02-04 Thread Bo Peng
M.E.Farmer wrote: I really don't see your need. Maybe it is just my laziness. It is almost intolerable for me to write lines and lines of code like d['z'] = func(d['x']+d['y']+d['whatever']['as']+d[a][0] ) It is ugly, unreadable and error prone. If I have to use this code, I would write _z

Re: Crashing Python interpreter! (windows XP, python2.3.4, 2.3.5rc1, 2.4.0)

2005-02-04 Thread Nick Coghlan
Christos TZOTZIOY Georgiou wrote: 5. XP really knows better than you and by default does not search in system folders. I killed that oh-so-friendly search dog on day 2 of acquainting myself with Windows XP last September, so I can't readily say where is the setting if your dog is enabled, but if y

Re: WYSIWYG wxPython "IDE"....?

2005-02-04 Thread M.E.Farmer
Yes you can use absolute positioning. You do not need sizers ( but they are very nice ) Most all the widgets have a pos keyword in there constructor. Just use them. M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Re: changing local namespace of a function

2005-02-04 Thread M.E.Farmer
I quote myself : > Also try this stuff out in an interpreter session it is easy and fast > to get your own answers. Sorry I guess I should have added a nudge and a <.5 wink> at the end. Sometimes misinformation is just what we need to get our own answers! The absurdity of what you are doing led me

Re: changing local namespace of a function

2005-02-04 Thread Bo Peng
Thank all for your suggestions. I have tried all methods and compared their performance. >>> import profile >>> a = {'x':1, 'y':2} >>> N = 10 >>> # solution one: use dictionary directly ... def fun1(d): ... for i in xrange(0,N): ... d['z'] = d['x'] + d['y'] ... >>> # solution two: use e

Re: returning True, False or None

2005-02-04 Thread Brian van den Broek
Fahri Basegmez said unto the world upon 2005-02-04 23:14: "Mick Krippendorf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Fahri Basegmez wrote: reduce(lambda x, y: x or y, lst) This doesn't solve the OPs problem since reduce(lambda x, y: x or y, [False, None]) returns None instead

dynamic modules

2005-02-04 Thread Grover
What is the best way to add a modules loaded with __import__() to the global namespace? Example: foo = __import__( 'foo', globals(), locals(), ['*'] ) PS: what exactly are the parameters globals and locals used for? -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: why are LAMP sites slow?

2005-02-04 Thread EP
Tim Daneliuk <[EMAIL PROTECTED]> commented: > This has a lot to do with the latency and speed of the connecting > network. Sites like Ebay, Google, and Amazon are connected > to internet backbone nodes (for speed) and are cached throughout > the network using things like Akami (to reduce latency).

Re: how to send an int over a socket

2005-02-04 Thread Pierre Quentel
Use string formatting : msglen = '%16s' %len(testmessage) will return a 16-byte string, beginning with spaces. Send it over your connection and use int() to get the message length Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-04 Thread Fahri Basegmez
"Mick Krippendorf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fahri Basegmez wrote: >> reduce(lambda x, y: x or y, lst) > > This doesn't solve the OPs problem since > > >>> reduce(lambda x, y: x or y, [False, None]) > > returns None instead of False. > > Mick. > You are right.

Re: "Collapsing" a list into a list of changes

2005-02-04 Thread Nick Coghlan
Jack Diederich wrote: Since this is 2.4 you could also return a generator expression. def iter_collapse(myList): ... return (x[0] for (x) in it.groupby([0,0,1,1,1,2,2,3,3,3,2,2,2,4,4,4,5])) ... But why write a function that returns a generator expression, when you could just turn the function

Re: ANN: Frog 1.3 released (python 'blog' application)

2005-02-04 Thread Jorey Bump
Irmen de Jong <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > I've added a 'filemgr' package to the files section; you can > get the file manager separately from there. > Or re-download the Frog-complete package (I've replaced it > with a version where the file manager is included). > > h

Re: "Collapsing" a list into a list of changes

2005-02-04 Thread Nick Coghlan
John J. Lee wrote: Steven Bethard <[EMAIL PROTECTED]> writes: Mike C. Fletcher wrote: [...] >>> def changes( dataset ): ... last = None ... for value in dataset: ... if value != last: ... yield value ... last = value ...>>> print list(changes(data )) whi

Re: bicyclerepairman python24 windows idle :(

2005-02-04 Thread Kim Changjune
EuGeNe wrote: > Hi there, > > I am no expert but wanted to give bicyclerepairman 0.9 a go just to see > what a refactoring browser is and does. Followed every step of the > install, I think, but idle doesn't start with the RepairMan section in > config-extensions.def ... is it incompatible with 2.

Re: Pickling and inheritance are making me hurt

2005-02-04 Thread Christian Dieterich
On Dé hAoine, Feabh 4, 2005, at 15:48 America/Chicago, Kirk Strauser wrote: I have a module that defines a Search class and a SearchResult class. I use these classes by writing other modules that subclass both of them as needed to interface with particular search engines. My problem is that S

Re: returning True, False or None

2005-02-04 Thread Mick Krippendorf
Fahri Basegmez wrote: > reduce(lambda x, y: x or y, lst) This doesn't solve the OPs problem since >>> reduce(lambda x, y: x or y, [False, None]) returns None instead of False. Mick. -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-04 Thread Michael Spencer
Fahri Basegmez wrote: "Michael Spencer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Fahri Basegmez wrote: reduce(lambda x, y: x or y, lst) works but when I tried import operator reduce(operator.or_, lst) this did not work. It pukes Traceback (most recent call last): File "", lin

Re: returning True, False or None

2005-02-04 Thread Fahri Basegmez
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fahri Basegmez wrote: >> reduce(lambda x, y: x or y, lst) >> >> works but when I tried >> >> import operator >> reduce(operator.or_, lst) >> >> this did not work. It pukes >> >> Traceback (most recent call last): >>

Re: string issue

2005-02-04 Thread Nick Coghlan
rbt wrote: Alan McIntyre wrote: I think it's because you're modifying the list as you're iterating over it. One last clarification on this. It's OK to modify the elements of a list, but not the list itself while iterating over it... is that the correct way to think about this? Correct - the i

Re: how to send an int over a socket

2005-02-04 Thread Paul Rubin
Tom Brown <[EMAIL PROTECTED]> writes: > However, in my actual program I will not know the length of testmessage in > advance. So how do I convert msglen into a suitable format for the send > method? >>> str(123) '123' You might also look at http://cr.yp.to/proto/netstrings.txt whi

Re: changing local namespace of a function

2005-02-04 Thread Michael Spencer
Nick Coghlan wrote: Michael Spencer wrote: def fun(dict): # set dict as local namespace # locals() = dict? z = x + y As you no doubt have discovered from the docs and this group, that isn't doable with CPython. Not entirely impossible: Py> def f(d): ... exec "locals().update(d)" ... re

Re: changing local namespace of a function

2005-02-04 Thread Nick Coghlan
Bo Peng wrote: Jeff Shannon wrote: This sounds to me like you're trying to re-implement object orientation. I have no control over the big dictionaries. All I need to do is processing them in situ --- that is to say, go into each map and manipulate numbers. Parameter passing should be avoid whene

Re: returning True, False or None

2005-02-04 Thread Michael Spencer
Fahri Basegmez wrote: reduce(lambda x, y: x or y, lst) works but when I tried import operator reduce(operator.or_, lst) this did not work. It pukes Traceback (most recent call last): File "", line 1, in ? TypeError: unsupported operand type(s) for |: 'NoneType' and 'bool' Any comments? Fahri Ty

Re: OT: why are LAMP sites slow?

2005-02-04 Thread Paul Rubin
Maciej Mróz <[EMAIL PROTECTED]> writes: > Mmcache (which is both optimizer and shared memory caching library for > php) can do _miracles_. One of my company servers uses Apache > 1.3/php/mmcache to serve about 100 GB of dynamic content a day (it > could do more but website does not have enough visi

Re: changing local namespace of a function

2005-02-04 Thread Nick Coghlan
Michael Spencer wrote: def fun(dict): # set dict as local namespace # locals() = dict? z = x + y As you no doubt have discovered from the docs and this group, that isn't doable with CPython. Not entirely impossible: Py> def f(d): ... exec "locals().update(d)" ... return x + y ... Py> f(d

Re: returning True, False or None

2005-02-04 Thread nghoffma
sorry, that should have been: py>>import sets py>>def doit(thelist): ... s = sets.Set(thelist) ... if s == sets.Set([None]): ... return None ... else: ... return max(s - sets.Set([None])) -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-04 Thread Fahri Basegmez
reduce(lambda x, y: x or y, lst) works but when I tried import operator reduce(operator.or_, lst) this did not work. It pukes Traceback (most recent call last): File "", line 1, in ? TypeError: unsupported operand type(s) for |: 'NoneType' and 'bool' Any comments? Fahri -- http://mail.p

Re: how to send an int over a socket

2005-02-04 Thread Paul Rubin
Tom Brown <[EMAIL PROTECTED]> writes: > Ok, I think I've found what I was looking for. The marshal.dumps() > function will convert my integer into a string representation of a > fixed size. This way, on the other side, I know how many bytes to > read to get the size of the string. Think hard about

Re: returning True, False or None

2005-02-04 Thread nghoffma
Is it cheating to use a Set? py>>def doit(thelist): ... s = sets.Set(thelist) ... if s == sets.Set([None]): ... return None ... else: ... return max(s) ... py>>print doit([ True , None , None , False ] ) True py>>print doit([ None , False , False , None ] ) Fals

broke IDLE while defining a key-binding scheme

2005-02-04 Thread Brian van den Broek
Hi all, IDLE refuses to launch, and I believe it is because I attempted to define a custom key-binding that it doesn't like. I was recently defining a custom keybinding in IDLE 1.1 under Python 2.4 on WinMe. (I was using the simpler of the two binding definition interfaces.) When done, I hit th

Re: how to send an int over a socket

2005-02-04 Thread Tom Brown
On Friday 04 February 2005 18:27, Tom Brown wrote: > Hi, > > I have what seems to be a simple problem. But I can not for the life of me > find a way to send an integer over a socket. The send method will only > accept strings. Here is what I am trying to do: > > testmessage = 'test message' > msgle

how to send an int over a socket

2005-02-04 Thread Tom Brown
Hi, I have what seems to be a simple problem. But I can not for the life of me find a way to send an integer over a socket. The send method will only accept strings. Here is what I am trying to do: testmessage = 'test message' msglen = len(testmessage) sock.send(msglen) sock.send(testmessage)

Re: returning True, False or None

2005-02-04 Thread Mick Krippendorf
Daniel Bickett wrote: > > >>> def boolhunt( items ): > ... falseExists = False > ... for item in items: > ... if item is True: > ... return True > ... elif item is False and not falseExists: > ... falseExists = True > ... if falseExists: > ...

Re: CGI and HTTP Header Location redirects

2005-02-04 Thread Paul Rubin
Derek Basch <[EMAIL PROTECTED]> writes: > A... I should have been more specific before. The Apache error > log doesn't produce an error. You are probably correct that it is > most likely an Apache/Unix problem. I thought perhaps someone had > maybe run into this before since it seems like such

Re: EDI x12 --> XML

2005-02-04 Thread Paul Rubin
Greg Lindstrom <[EMAIL PROTECTED]> writes: > I am working on automating a system accepting input data in EDI x12 > format and would like to convert it to XML. Before I start, I thought > I'd ask if anyone has worked on such a beast. I have seen work by > Chris Cioffi on parsing EDI records. Is a

Re: changing local namespace of a function

2005-02-04 Thread Michael Spencer
Bo Peng wrote: Michael Spencer wrote: > There are hundreds of items in the dictionary (that will be needed in the calculation) so passing the whole dictionary is a lot better than passing individual items. ... def fun(d): exec 'z = x + y' in globals(), d seems to be more readable than def fun(

Re: changing local namespace of a function

2005-02-04 Thread Bo Peng
Jeff Shannon wrote: This sounds to me like you're trying to re-implement object orientation. I have no control over the big dictionaries. All I need to do is processing them in situ --- that is to say, go into each map and manipulate numbers. Parameter passing should be avoid whenever possible s

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > whoa, that was quick, looks like it works for me. Thanks a lot! > It would be nice to be able to set the colors in the prefs file, although > its possible to edit the pyColorize file as Claudio mentioned. Yes, I haven't implemented user-definable color schemes. Not impossible, bu

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > One more thing I was wondering about: why not highlight the source code in > the errors since you already have this functionality (with '??' command). > It would be nice to have it highlighed on the prompt as well, but I > imagine this may be more difficult.. I've been using IPython

Re: executing VBScript from Python and vice versa

2005-02-04 Thread Paul Paterson
Valentina Boycheva wrote: Is there a way to make programs written in these two languages communicate with each other? I am pretty sure that VBScript can access a Python script because Python is COM compliant. On the other hand, Python might be able to call a VBScript through WSH. Can somebody provi

Re: changing local namespace of a function

2005-02-04 Thread Bo Peng
Michael Spencer wrote: As you no doubt have discovered from the docs and this group, that isn't doable with CPython. Too bad to know this. >>> a = {'x':1, 'y':2} >>> b = {'x':3, 'y':3} ... >>> def funa(x,y, **kw): ... del kw #Careful of unwanted names in locals with this approach ...

Re: IPython colors in windows

2005-02-04 Thread Ashot
One more thing I was wondering about: why not highlight the source code in the errors since you already have this functionality (with '??' command). It would be nice to have it highlighed on the prompt as well, but I imagine this may be more difficult.. I've been using IPython for about a

Re: IPython colors in windows

2005-02-04 Thread Ashot
whoa, that was quick, looks like it works for me. Thanks a lot! It would be nice to be able to set the colors in the prefs file, although its possible to edit the pyColorize file as Claudio mentioned. .a On Fri, 04 Feb 2005 16:51:26 -0700, Fernando Perez <[EMAIL PROTECTED]> wrote: Fernando P

Re: changing local namespace of a function

2005-02-04 Thread Bo Peng
M.E.Farmer wrote: def fun(d): ... __dict__ = d ... return __dict__ hth, Does not work? >>> a = { 'x':1, 'y':2} >>> b = { 'x':2, 'y':9} >>> def fun(d): ... __dict__ = d ... print locals() ... z = x + y >>> fun(a) {'__dict__': {'y': 2, 'x': 1}, 'd': {'y': 2, 'x': 1}} Traceback (most re

Re: advice needed for simple python web app

2005-02-04 Thread TZOTZIOY
On 03 Feb 2005 22:31:43 -0800, rumours say that Paul Rubin might have written: [Dan Perl thinks about publishing to the web a script that could be misused by spammers, so Paul advises him to watch out.] >There used >to be some similar perl scripts running all over the p

Re: Error!

2005-02-04 Thread John Machin
administrata wrote: > I'm programming Car Salesman Program. > It's been "3 days" learning python... >From whom or what book or what tutorial? > But, i got problem You got problemS. What Jeff & Brian wrote, plus: You have "change" instead of "charge". You forgot to add in the base price -- "ac

Re: Possibly OT: Controlling winamp with Python

2005-02-04 Thread TZOTZIOY
On Fri, 4 Feb 2005 13:10:10 -0700, rumours say that "Brent W. Hughes" <[EMAIL PROTECTED]> might have written: >I'm running Windows XP and I'm using winamp to listen to internet radio >stations. Occasionally, an annoying commercial will come on. I would like >to write a Python program that, whe

Re: Persistence design [was: RE: OT: why are LAMP sites slow?]

2005-02-04 Thread Jack Diederich
On Fri, Feb 04, 2005 at 09:09:46PM -0200, Carlos Ribeiro wrote: > On Fri, 4 Feb 2005 17:46:44 -0500, Jack Diederich <[EMAIL PROTECTED]> wrote: > > On Fri, Feb 04, 2005 at 10:31:19AM -0800, Robert Brewer wrote: > > > Jack Diederich wrote: > > > > If there is interest I'll follow up with some details

Re: [noob] Error!

2005-02-04 Thread Brian van den Broek
administrata said unto the world upon 2005-02-04 17:59: I'm programming Car Salesman Program. It's been "3 days" learning python... But, i got problem Write a Car Salesman program where the user enters the base price of a car. The program should add on a bunch of extra fees such as tax, license, de

Re: [OT] PEP 8j, pythonista naming style

2005-02-04 Thread TZOTZIOY
On Fri, 04 Feb 2005 23:56:44 +1000, rumours say that Steve Coghlan <[EMAIL PROTECTED]> might have written: >A Steve wrote: >> A Steve wrote: >> >>> A Steve wrote: >>> > >There we go, much clearer ;) Indeed. I recall some Dan Perl who was advised to change his name to a more pythonic one, but no

Re: Crashing Python interpreter! (windows XP, python2.3.4, 2.3.5rc1, 2.4.0)

2005-02-04 Thread TZOTZIOY
On 3 Feb 2005 15:58:01 -0800, rumours say that "John Machin" <[EMAIL PROTECTED]> might have written: >> I don't know why searching all drives using windows 'search' did not >find the file! > >Possibilities: >1. You have a virus that renames the drwtsn32.log file for the duration >of a search. >2.

Re: [noob] Error!

2005-02-04 Thread Jeff Shannon
administrata wrote: Write a Car Salesman program [...] This sounds like homework, and we generally try to avoid solving peoples' homework problems for them, but I can offer a suggestion. error occurs, i think the problem is in actual_price. but, I don't know how to comebine percentage and raw_inp

Re: changing local namespace of a function

2005-02-04 Thread Jeff Shannon
Bo Peng wrote: My function and dictionaries are a lot more complicated than these so I would like to set dict as the default namespace of fun. This sounds to me like you're trying to re-implement object orientation. Turn all of those functions into methods on a class, and instead of creating dic

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Fernando Perez wrote: > Ashot wrote: > >> this is what it looks like: >> >> http://www.freshraisins.com/sand/ipythonscreen.PNG >> >> does cygwin have a readline utility in it? Perhaps this is overriding the >> correct one? Thats the only thing I can think of. > > Hi folks, > > could you ple

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-04 Thread Jan Dries
Fredrik Lundh wrote: Markus Wankus wrote: Google his name - he has been banned from Netbeans and Eclipse (and Hibernate, and others...) for good reason. Can you imagine how much of a Troll you need to be to *actually* get "banned" from the newsgroups of open source projects such as those? have P

WYSIWYG wxPython "IDE"....?

2005-02-04 Thread Simon John
I'm writing my 2nd large wxPython program, and after the problems I found doing the first's layout in code, I'd like to look at using a 'WYSIWYG' IDE, like VisualStudio does for MFC. I've tried a few that I found, wxGlade is probably the best, although it seems to be not 100% WYSIWYG (like the wid

Re: returning True, False or None

2005-02-04 Thread Jeff Shannon
Jeremy Bowers wrote: On Fri, 04 Feb 2005 16:44:48 -0500, Daniel Bickett wrote: [ False , False , True , None ] False would be returned upon inspection of the first index, even though True was in fact in the list. The same is true of the code of Jeremy Bowers, Steve Juranich, and Jeff Shannon. As fo

How do I enter/receive webpage information?

2005-02-04 Thread Mudcat
Hi, I'm wondering the best way to do the following. I would like to use a map webpage (like yahoo maps) to find the distance between two places that are pulled in from a text file. I want to accomplish this without displaying the browser. I am looking at several options right now, including urll

Re: advice needed for simple python web app

2005-02-04 Thread Ray Cote
At 8:51 AM -0800 2/4/05, Paul Rubin wrote: "Dan Perl" <[EMAIL PROTECTED]> writes: This matches pretty much what I've decided to do. I'll start with cgi and CGIHTTPServer because I'll learn more from that and then move to a framework, quite likely CherryPy, although by that time I may change my

Re: returning True, False or None

2005-02-04 Thread Mick Krippendorf
Fredrik Lundh wrote: > Steven Bethard wrote: >> Raymond Hettinger wrote: >>> >>> return max(lst) >> >> Very clever! Thanks! > > too clever. boolean > None isn't guaranteed by the language > specification: > > http://docs.python.org/ref/comparisons.html > > "... objects of different

Re: Persistence design [was: RE: OT: why are LAMP sites slow?]

2005-02-04 Thread Carlos Ribeiro
On Fri, 4 Feb 2005 17:46:44 -0500, Jack Diederich <[EMAIL PROTECTED]> wrote: > On Fri, Feb 04, 2005 at 10:31:19AM -0800, Robert Brewer wrote: > > Jack Diederich wrote: > > > If there is interest I'll follow up with some details on my own LAMP > > > software which does live reports on gigs of data a

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Fernando Perez wrote: > Hi folks, > > could you please test under windows the 1.9 version of readline? > > http://sourceforge.net/project/showfiles.php?group_id=82407&package_id=84552&release_id=302513 > > This was just put up a moment ago by the developer, let me know if it fixes > these probl

Re: string issue

2005-02-04 Thread Steven Bethard
rbt wrote: John J. Lee wrote: Steve Holden <[EMAIL PROTECTED]> writes: [...] You are modifying the list as you iterate over it. Instead, iterate over a copy by using: for ip in ips[:]: ... Just to help popularise the alternative idiom, which IMO is significantly less cryptic (sane constructors of

[noob] Error!

2005-02-04 Thread administrata
I'm programming Car Salesman Program. It's been "3 days" learning python... But, i got problem Write a Car Salesman program where the user enters the base price of a car. The program should add on a bunch of extra fees such as tax, license, dealer prep, and destination charge. Make tax and licens

Re: empty classes as c structs?

2005-02-04 Thread Scott David Daniels
Christopher J. Bottaro wrote: I find myself doing the following very often: class Struct: pass ... blah = Struct() blah.some_field = x blah.other_field = y ... Is there a better way to do this? Is this considered bad programming practice? I don't like using tuples (or lists) because I'd r

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > this is what it looks like: > > http://www.freshraisins.com/sand/ipythonscreen.PNG > > does cygwin have a readline utility in it? Perhaps this is overriding the > correct one? Thats the only thing I can think of. Hi folks, could you please test under windows the 1.9 version of

Re: returning True, False or None

2005-02-04 Thread Daniel Bickett
Jeremy Bowers wrote: > The defense rests, your honor. :-) I stand corrected :-) My apologies. -- Daniel Bickett dbickett at gmail.com http://heureusement.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-04 Thread Jeremy Bowers
On Fri, 04 Feb 2005 16:44:48 -0500, Daniel Bickett wrote: > [ False , False , True , None ] > > False would be returned upon inspection of the first index, even > though True was in fact in the list. The same is true of the code of > Jeremy Bowers, Steve Juranich, and Jeff Shannon. As for Raymond

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > this is what it looks like: > > http://www.freshraisins.com/sand/ipythonscreen.PNG > > does cygwin have a readline utility in it? Perhaps this is overriding the > correct one? Thats the only thing I can think of. Thanks for the screenshot. I've contacted the readline author, I

Re: Persistence design [was: RE: OT: why are LAMP sites slow?]

2005-02-04 Thread Jack Diederich
On Fri, Feb 04, 2005 at 10:31:19AM -0800, Robert Brewer wrote: > Jack Diederich wrote: > > *ding*ding*ding* The biggest mistake I've made most > > frequently is using > > a database in applications. YAGNI. Using a database at all has it's > > own overhead. Using a database badly is deadly. Mo

Re: IPython colors in windows

2005-02-04 Thread Ashot
this is what it looks like: http://www.freshraisins.com/sand/ipythonscreen.PNG does cygwin have a readline utility in it? Perhaps this is overriding the correct one? Thats the only thing I can think of. .a On Fri, 4 Feb 2005 22:35:45 -, Claudio Grondi <[EMAIL PROTECTED]> wrote: I have i

Re: [Fwd: [gnu.org #220719] Re: python and gpl]

2005-02-04 Thread Tim Churches
Tim Churches wrote: > Can't get much clearer than that. Whoops! Sorry about all the embedded HTML links, making it most unclear. Here is the relevant Australian law in a clearer form: COPYRIGHT ACT 1968 (as amended by the Copyright Amendment Act 2000) - SECT 47B *Reproduction for normal

Re: Possible additions to the standard library? (WAS: About standardlibrary improvement)

2005-02-04 Thread Kent Johnson
Daniel Bickett wrote: |def reverse( self ): |""" |Return a reversed copy of string. |""" |string = [ x for x in self.__str__() ] |string.reverse() |return ''.join( string ) def reverse(self): return self[::-1] Kent -- http://mail.python.org/ma

Re: string issue

2005-02-04 Thread Steve Holden
Terry Reedy wrote: "Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [ ... ] This seems much more sensible to me than building a new list with everything (a copy), including things you don't want, and then deleting the things you don't want (an O(n**2) operation). Whic

Re: changing local namespace of a function

2005-02-04 Thread Michael Spencer
Bo Peng wrote: Dear list, I have many dictionaries with the same set of keys and I would like to write a function to calculate something based on these values. For example, I have a = {'x':1, 'y':2} b = {'x':3, 'y':3} def fun(dict): dict['z'] = dict['x'] + dict['y'] fun(a) and fun(b) will set

Re: [Fwd: [gnu.org #220719] Re: python and gpl]

2005-02-04 Thread Tim Churches
Richard Brodie wrote: "Tim Churches" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 1) In Australia and Europe at least, loading program code from disc into memory in order to execute it is not considered as making an infringing copy under copyright law. I don't think it's as c

Re: Weekly Python Patch/Bug Summary

2005-02-04 Thread Terry Reedy
"David Fraser" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kurt B. Kaiser wrote: >> Patch / Bug Summary >> ___ >> >> Patches : 284 open ( +4) / 2748 closed ( +1) / 3032 total ( +5) >> Bugs: 804 open ( +1) / 4812 closed (+13) / 5616 total (+14) >> RFE

Pickling and inheritance are making me hurt

2005-02-04 Thread Kirk Strauser
I have a module that defines a Search class and a SearchResult class. I use these classes by writing other modules that subclass both of them as needed to interface with particular search engines. My problem is that Search defines a method (called automatically by __del__) to save its results bet

Re: string issue

2005-02-04 Thread Terry Reedy
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You are modifying the list as you iterate over it. Instead, iterate over > > a copy by using: > for ip in ips[:]: Or if you are only deleting items, you can iterate backwards. You can also build a new list with only

Re: returning True, False or None

2005-02-04 Thread Daniel Bickett
I'm seeing a consistent problem in most of these approaches. Verbalized, the logic of the OP's original code reads as such: If True is in the list *at all*, return True. Otherwise, if False is in the list *at all*, return False. Otherwise, return None. So if we used Alex Martelli's code: > for v

Re: [perl-python] get web page programatically

2005-02-04 Thread Chris Mattern
Xah Lee wrote: Just the standard warnings for any novices unfamiliar with Mr. Lee. Mr. Lee's posts are regularly riddled with severe errors (I found the assertion that LWP::Simple and LWP::UserAgent aren't part of the standard base perl install a particularly amusing one in this particular post

Re: IPython colors in windows

2005-02-04 Thread Claudio Grondi
I have installed version 1.8. It makes is even worse, because now also "In [1]:" gets black background and is unreadable (it had a grey background before). Re-installing 1.7 makes the background again gray. I use German Windows 2000 SP 4 as OS. Claudio P.S. In quote marks the parts with black back

FW: executing VBScript from Python and vice versa

2005-02-04 Thread Valentina Boycheva
Thanks for the reply. I already have "Learning Python" from Mark Lutz and David Ascher, which covers 2.3 (I am in 2.4). However, it seems like heavy artillery to me. What I want is, for instance, run a VBScript to get a function output and feed it to the Python script that called it. The reason is

Re: Possibly OT: Controlling winamp with Python

2005-02-04 Thread Dave Brueck
Brent W. Hughes wrote: I'm running Windows XP and I'm using winamp to listen to internet radio stations. Occasionally, an annoying commercial will come on. I would like to write a Python program that, when run, will, in essence, push on winamp's mute button. Then, after say 20 seconds, it wil

Re: changing local namespace of a function

2005-02-04 Thread M.E.Farmer
Hello Bo, Don't use dict it is a builtin ;) Also try this stuff out in an interpreter session it is easy and fast to get your own answers. >>> def fun(d): ... __dict__ = d ... return __dict__ hth, M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Re: Possibly OT: Controlling winamp with Python

2005-02-04 Thread Josef Meile
Hi Brent, Brent W. Hughes wrote: The Python program won't decide whether a commercial is playing, I will. At that point, I will run my program which will press mute, wait 20 seconds, and then press mute again. Actually, I could leave the program running but minimized to the task bar. When I he

Re: returning True, False or None

2005-02-04 Thread Raymond Hettinger
"Steven Bethard" > For a given list: > * If all values are None, the function should return None. > * If at least one value is True, the function should return True. > * Otherwise, the function should return False. One more approach, just for grins: s = set(lst) return True in s or s == s

Re: ANN: Frog 1.3 released (python 'blog' application)

2005-02-04 Thread Irmen de Jong
Jorey Bump wrote: Irmen de Jong <[EMAIL PROTECTED]> wrote in news:41fcf53b [EMAIL PROTECTED]: I've just uploaded the Frog 1.3 release. Frog is a blog (web log) system written in 100% Python. It is a web application written for Snakelets. It outputs XHTML, is fully unicode compatible, small, and do

Re: string issue

2005-02-04 Thread rbt
Bill Mill wrote: On Fri, 04 Feb 2005 15:25:04 -0500, rbt <[EMAIL PROTECTED]> wrote: John J. Lee wrote: Steve Holden <[EMAIL PROTECTED]> writes: [...] You are modifying the list as you iterate over it. Instead, iterate over a copy by using: for ip in ips[:]: ... Just to help popularise the altern

Re: Thread in python

2005-02-04 Thread Do Re Mi chel La Si Do
Hi ! Look the smart/fun use of threads make by http://candygram.sourceforge.net It's good for to know... @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: How to enable Python Scripts with MS IIS Web Server?

2005-02-04 Thread jb
hi, you should first install win32all : http://starship.python.net/crew/mhammond/ next, 2 ways 2 proceed, but the first is the easier : you make a "test.asp" page in the folder at the top, you write <@Language=Python%> a line below : <%Response.Write("Hello World")%>

  1   2   3   >