Re: deriving from float or int

2006-02-21 Thread Robert Kern
gene tani wrote: > Russ wrote: > >>Does it ever make sense to derive a class from a basic type such as >>float or int? Suppose, for example, that I want to create a class for >>physical scalars with units. I thought about deriving from float, then >>adding the units. I played around with it a bit,

ANN: Extended Python debugger 0.12

2006-02-21 Thread R. Bernstein
This third release of an improved debugger also probably about as great as the last release. Download from http://sourceforge.net/project/showfiles.php?group_id=61395&package_id=175827 On-line documentation is at http://bashdb.sourceforge.net/pydb/pydb/lib/index.html Along with this release is a

Re: Basic coin flipper program - logical error help

2006-02-21 Thread DannyB
Thanks everyone for your insight. I'm coming from C++ - I'm used to formatting code with {} instead of whitespaces. @Larry - this isn't my homework :P I'm actually taking a VB.NET class in school. I was teaching myself C++ but decided to scale back to Python. I've heard it was a bit easier to

Re: Python vs. Lisp -- please explain

2006-02-21 Thread Carl Friedrich Bolz
Chris Mellon wrote: [snip] > I don't think it does, though. Firstly, as a definition it relies on > the environment the application will be running under and therefore > can't be considered to describe just a language. Secondly, by that > definition Java is an interpreted language which is at odds

Re: number ranges

2006-02-21 Thread Colin J. Williams
Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >... > >>>Reread the part I quoted above: at least some of the proponents of this >>>syntax appear to be totally ignorant of 30 years of literature and >>>practice of programming, "it will be tough to convince" them that closed

Re: odt -> pdf

2006-02-21 Thread Colin J. Williams
Katja Suess wrote: > Hi > Cause Google didn't find the Info I was trying to find her my post. > Is PyUNO still _the_ Tool to create PDFs out of OpenOffice docs (odt, > not swx) ? > Do other tools exist? > Do you prefer generatingp PDFs using the XML-Strukture of odt files? > Regards, > Katja > Op

Re: a little more help with python server-side scripting

2006-02-21 Thread Ben Cartwright
John Salerno wrote: > I contacted my domain host about how Python is implemented on their > server, and got this response: > > --- > Hello John, > > Please be informed that the implementation of python in our server is > through mod_python integration with the apache. > > These are

Re: Basic coin flipper program - logical error help

2006-02-21 Thread John Zenger
wes weston wrote: >Looping is easier with: > for x in range(100): >if random.randint(0,1) == 0: > heads += 1 >else: > tails += 1 Also, with the functional programming tools of map, filter, and lambda, this code can be reduced to just six lines: import random flips = map(

Re: Python vs. Lisp -- please explain

2006-02-21 Thread Peter Mayne
Torsten Bronger wrote: > > My definiton would be that an interpreted language has in its > typical implementation an interpreting layer necessary for typical > hardware. Of couse, now we could discuss what is "typical", > however, in practice one would know it, I think. In case of Python: > CPyt

Weekly Python Patch/Bug Summary

2006-02-21 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 385 open (-14) / 3067 closed (+25) / 3452 total (+11) Bugs: 864 open (-59) / 5621 closed (+68) / 6485 total ( +9) RFE : 211 open ( +2) / 200 closed ( +2) / 411 total ( +4) New / Reopened Patches __ GNU uses

May i customize basic operator (such as 1==3)?

2006-02-21 Thread kanchy kang
Hi,all as we know, we can override the operator of one object(for example __eq__). my question is, how to override the basic operator? for example, for any object comparison operator(including litterals), for example, a = "123" b = "321" the boolean equation a == b, i need override "==" operator

What are COM-enabled applications?

2006-02-21 Thread Tempo
As the subject of this post suggests, I have one question; what are COM-enabled applications? I believe Microsoft Word is one of these apps, but what else? Is a web browser, Paint, Solitare, games, etc? I'm not sure if it varies from operating system to operating system, but I am talking about COM

Re: a little more help with python server-side scripting

2006-02-21 Thread Steve Holden
John Salerno wrote: > I contacted my domain host about how Python is implemented on their > server, and got this response: > > --- > Hello John, > > Please be informed that the implementation of python in our server is > through mod_python integration with the apache. > > These

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread Casey Hawthorne
I believe you are asking for a side effect from the "==" operator. Add print statements to the __eq__ method. "kanchy kang" <[EMAIL PROTECTED]> wrote: >Hi,all >as we know, we can override the operator of one object(for example __eq__). >my question is, how to override the basic operator? >for ex

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread Robert Kern
Casey Hawthorne wrote: > I believe you are asking for a side effect from the "==" operator. > > Add print statements to the __eq__ method. The things is, he wants to make those modifications to builtin types, which he can't do. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the

Re: a little more help with python server-side scripting

2006-02-21 Thread John Salerno
Ben Cartwright wrote: >> The script can be given a executable mode, or permission, using the >> chmod command: >> >> $ chmod +x myscript.py > > And this answers your second. Your host needs to know the path to your > script so they can use chmod to make it executable. Where does this line go?

Re: a little more help with python server-side scripting

2006-02-21 Thread John Salerno
Steve Holden wrote: > Fortunately they've given you the information you need to run CGI > scripts. Try installing this script in your cgi-bin directory as test.py > (you may have to set it executable): Thank you! I desperately needed to test it, and that seemed to work. I didn't have to make it

Re: a little more help with python server-side scripting

2006-02-21 Thread Steve Holden
John Salerno wrote: > Ben Cartwright wrote: > > >>>The script can be given a executable mode, or permission, using the >>>chmod command: >>> >>> $ chmod +x myscript.py >> >>And this answers your second. Your host needs to know the path to your >>script so they can use chmod to make it executabl

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread Steve Holden
kanchy kang wrote: > Hi,all > as we know, we can override the operator of one object(for example __eq__). > my question is, how to override the basic operator? > for example, > > for any object comparison operator(including litterals), > for example, > a = "123" > b = "321" > > the boolean equati

Re: Basic coin flipper program - logical error help

2006-02-21 Thread bonono
John Zenger wrote: > Also, with the functional programming tools of map, filter, and lambda, > this code can be reduced to just six lines: > > import random > > flips = map(lambda x: random.randrange(2), xrange(100)) > heads = len(filter(lambda x: x is 0, flips)) > tails = len(filter(lambda x: x i

Re: Basic coin flipper program - logical error help

2006-02-21 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > John Zenger wrote: > > Also, with the functional programming tools of map, filter, and lambda, > > this code can be reduced to just six lines: > > > > import random > > > > flips = map(lambda x: random.randrange(2), xrange(100)) > > he

Re: What are COM-enabled applications?

2006-02-21 Thread Ravi Teja
COM is Windows only. (Actually there is DCOM for Linux, but that's another story). Read about it here. http://en.wikipedia.org/wiki/Component_object_model -- http://mail.python.org/mailman/listinfo/python-list

Re: a little more help with python server-side scripting

2006-02-21 Thread Steve Holden
John Salerno wrote: > Steve Holden wrote: > > >>Fortunately they've given you the information you need to run CGI >>scripts. Try installing this script in your cgi-bin directory as test.py >>(you may have to set it executable): > > > Thank you! I desperately needed to test it, and that seemed

Re: a little more help with python server-side scripting

2006-02-21 Thread John Salerno
Steve Holden wrote: >> Where does this line go? Just at the top as well? > > Nope. I presume you can log in to your web server using ssh or telnet or > similar. In which case you do so. Then use the commands > > cd {wherever}/cgi-bin > chmod +x test.py > > to make the script executable, and th

Re: a little more help with python server-side scripting

2006-02-21 Thread John Salerno
Steve Holden wrote: > If the script ran, you will now know waht version of Apaceh you're > running with! Well, the script did seem to run, but I'm still not sure if this is what I'm ultimately after. This allows me to run Python script files, which is good, but what I really want to do is writ

Re: a little more help with python server-side scripting

2006-02-21 Thread Steve Holden
John Salerno wrote: > Steve Holden wrote: > > >>If the script ran, you will now know waht version of Apaceh you're >>running with! > > > Well, the script did seem to run, but I'm still not sure if this is what > I'm ultimately after. This allows me to run Python script files, which > is good

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread kanchy kang
many people write test cases with python scripts. in these test scripts, there are many validation statements, for example, in unittest, failUnless(a == b),(a/b may be stringType or intType...) during running test scripts, if there is one exception raised from failUnless, i still do not know a

Re: Pyserial never read

2006-02-21 Thread Nick Craig-Wood
Peter Hansen <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > luca72 <[EMAIL PROTECTED]> wrote: > > > >> Thanks for your help, but it don't solve the problem. > >> I receive only the echo and full stop. > > > > Try swapping pins 2 and 3 in the lead. > > Anything's possible, but given th

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread Robert Kern
kanchy kang wrote: > many people write test cases with python scripts. > in these test scripts, there are many validation statements, > for example, in unittest, failUnless(a == b),(a/b may be stringType or > intType...) > > during running test scripts, if there is one exception raised from > fail

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread kanchy kang
__eq__ method can resolve this problem only for class object. what can i do in the following case? a = somefuction(...) #a is stringType a == "1234"? my simple requirement is: in some validation statments, such as, failUnless(a == "1234") if the result is true, it's OK. otherwise, it prints a au

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread kanchy kang
Thank you for your suggestions! From: Steve Holden <[EMAIL PROTECTED]> To: kanchy kang <[EMAIL PROTECTED]> CC: python-list@python.org Subject: Re: May i customize basic operator (such as 1==3)? Date: Wed, 22 Feb 2006 01:44:26 -0500 kanchy kang wrote: many people write test cases with python s

RE: [Numpy-discussion] algorithm, optimization, or other problem?

2006-02-21 Thread Nadav Horesh
You may get a significant boost by replacing the line: w=w+ eta * (y*x - y**2*w) with w *= 1.0 - eta*y*y w += eta*y*x I ran a test on a similar expression and got 5 fold speed increase. The dot() function runs faster if you compile with dotblas. Nadav. -Original Message- From:

Re: May i customize basic operator (such as 1==3)?

2006-02-21 Thread Steve Holden
kanchy kang wrote: > many people write test cases with python scripts. > in these test scripts, there are many validation statements, > for example, in unittest, failUnless(a == b),(a/b may be stringType or > intType...) > > during running test scripts, if there is one exception raised from > fa

<    1   2   3