Re: XP rich text cut-n-paste

2006-03-04 Thread Paddy
Thanks Chris, Scintilla does indeed have the feature, and googling for the term "copy as RTF" lead me to http://www.pnotepad.org/ which also has the feature. Now I will have to ask for that feature request as I wuld also like colourized shell input oo! (Hmm, must get that credit card authorized s

Re: how to overload sqrt in a module?

2006-03-04 Thread Michael McNeil Forbes
On Fri, 3 Mar 2006, Steven D'Aprano wrote: > ... you can do this: > > import my_module > my_module.set_environment("math") # or cmath, or numeric, or whatever > > Your my_module will be like this: > > # Warning: untested code. > ENVIRON = None # global variables sometimes have their uses > > def

Re: Passing a method indirectly

2006-03-04 Thread Steve Holden
swisscheese wrote: > I'm trying to write a function that takes an arbitrary object and > method. > The function applies the method to the object (and some other stuff). > I get error "Test instance has no attribute 'method' " > How can I make this work? > > def ObjApply (object,method): > ob

Re: how to overload sqrt in a module?

2006-03-04 Thread Michael McNeil Forbes
On Fri, 3 Mar 2006, david mugnai wrote: [snip] > > If I don't misunderstood the problem, you can define an "init" method for > your module_g > > (code not tested) > > module_g.py > --- > > _functions = {} > def init(mathmodule): > _function['sqrt'] = getattr(mathmodule, 'sqrt', None) > >

Re: The old round off problem?

2006-03-04 Thread sam
David Treadwell wrote: > exp(x) is implemented by: > > 1. reducing x into the range |r| <= 0.5 * ln(2), such that x = k * > ln(2) + r > 2. approximating exp(r) with a fifth-order polynomial, > 3. re-scaling by multiplying by 2^k: exp(x) = 2^k * exp(r) > > sinh(x) is mathematically ( exp(x) - e

Re: Making a tiny script language using python: I need a string processing lib

2006-03-04 Thread Sullivan WxPyQtKinter
I have gone over the shlex and cmd and so, but none of them are satisfactory. However, I tried to program this this function on my own and found it pretty easy. Thank you so much for the suggestion, after all. -- http://mail.python.org/mailman/listinfo/python-list

Re: question about sys.exc_type and sys.exc_value

2006-03-04 Thread John Salerno
David Wahler wrote: > Are you using the first edition of "Learning Python"? According to > that was published in 1999, > which puts it right around the end of Python 1.5. I'd strongly suggest > you find a much more recent tutorial, as a lot of python has b

Re: how to record how long i use the intenet

2006-03-04 Thread Roger Upole
[EMAIL PROTECTED] wrote: > use python > use ADSL > use windows XP > i want to record the time when i get on the internet and off the > internet > into a txt file > HOW? > You might be able to get that out of the event log. Most types of connections record connect and disconnect events in the Syst

Re: Python advocacy in scientific computation

2006-03-04 Thread Robert Kern
Brian Blais wrote: > here, I've found python to be good, but not great. matplotlib (pylab) is a > really > great thing, but is not as straightforward as plotting in Matlab. Either, > you have a > window which locks the process until you close it, or you do interactive > mode, but > the wind

Re: add an asynchronous exception class

2006-03-04 Thread Christian Stapfer
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > "Christian Stapfer" <[EMAIL PROTECTED]> writes: >> I guess it means the following: >> >> "Terminating exceptions" are exceptions that >> terminate the *thrower* of the exception. > > Are you sure? Am I sure? - Well

Re: A simple question

2006-03-04 Thread Tuvas
Ahh, that make sense! Thanks a ton! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-04 Thread Robert Kern
sturlamolden wrote: > Michael Tobis skrev: > > Being a scientist, I can tell you that your not getting it right. If > you speak computer science or business talk no scientist are going to > listen. Lets just see how you argue: I see we've forgone the standard conventions of politeness and gone st

Re: A simple question

2006-03-04 Thread Ben Cartwright
Tuvas wrote: > Why is the output list [[0, 1], [0, 1]] and not [[0, > 1], [0, 0]]? And how can I make it work right? http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list --Ben -- http://mail.python.org/mailman/listinfo/python-list

Re: A simple question

2006-03-04 Thread [EMAIL PROTECTED]
Skip answered why, but not how to make it work right: >>> x = [[0]*2 for x in range(2)] >>> x [[0, 0], [0, 0]] >>> x[0][1]=1 >>> x [[0, 1], [0, 0]] Cheers, n -- http://mail.python.org/mailman/listinfo/python-list

Re: A simple question

2006-03-04 Thread skip
>>> x=[[0]*2]*2 This replicates the references. It doesn't copy objects. This short transcript demonstrates that concept: >>> x = [[0, 0], [0, 0]] >>> map(id, x) [16988720, 16988160] >>> y = [[0]*2]*2 >>> y [[0, 0], [0, 0]] >>> map(id, y) [16988520, 16988520

Re: question about sys.exc_type and sys.exc_value

2006-03-04 Thread David Wahler
John Salerno wrote: > Here is an exercise from Learning Python that I wrote myself: > > import sys > import traceback > > class MyError: pass > > def oops(): > raise MyError() > > def safe(func, *args): > try: > apply(func, args) > except: > traceback.print_exc() >

A simple question

2006-03-04 Thread Tuvas
I know the answer is probably really simple to this, and I feel bad to even ask, but I can't find the answer anywhere... Let me show what happened, then ask the question. >>> x=[[0]*2]*2 >>> x [[0, 0], [0, 0]] >>> x[0][1]=1 >>> x [[0, 1], [0, 1]] >>> The question now. Why is the output list [[0,

Re: The old round off problem?

2006-03-04 Thread David Treadwell
I wish I knew! So I asked Google. Here's what I learned: Most implementations are based on, or similar to the implementation in the fdlibm package. sinh(x) and cosh(x) are both based on exp(x). See http:// www.netlib.org/cgi-bin/netlibfiles.pl?filename=/fdlibm/e_sinh.c exp(x) is implemented

Re: Python advocacy in scientific computation

2006-03-04 Thread David Treadwell
On Mar 4, 2006, at 11:16 PM, Dennis Lee Bieber wrote: > On Sat, 4 Mar 2006 14:23:10 -0500, David Treadwell > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > >> needed programming, be it CS or chemical engineering, taught it in >> a [EMAIL PROTECTED] >> very linear, bottom-u

Re: XP rich text cut-n-paste

2006-03-04 Thread Chris Mellon
On 4 Mar 2006 11:39:11 -0800, Paddy <[EMAIL PROTECTED]> wrote: > Hi, > Is their a colourized editor/shell that allows you to cut and paste the > colourized text? > > Idle, SPE, Eclipse, and pythonwin all seem to nicely colourize both > command line input as well as editor windows but when I cut and

Re: Python advocacy in scientific computation

2006-03-04 Thread beliavsky
Dennis Lee Bieber wrote: >F90/F95 is scary, isn't it... >F77 wasn't that big a change from FORTRAN-IV (F66) (hmmm, we're due > for another standard, aren't we? 1966, 1977, 1990 [95 was a tweak]...) Fortran 2003 is the latest standard -- see http://www.fortran.com/fortran/fcd_ann

Re: How to except the unexpected?

2006-03-04 Thread Steven D'Aprano
On Sat, 04 Mar 2006 13:19:29 -0800, James Stroud wrote: > Why catch an error only to re-raise it? As a general tactic, you may want to catch an exception, print extra debugging information, then raise the exception again, like this: try: x = somedata() y = someotherdata() z = process

Re: spliting on ":"

2006-03-04 Thread Steven D'Aprano
On Sat, 04 Mar 2006 08:54:33 -0800, ss2003 wrote: > hi > > i have a file with > > xxx.xxx.xxx.xxx:yyy > xxx.xxx.xxx.xxx:yyy > xxx.xxx.xxx.xxx:yyy > xxx.xxx.xxx.xxx > xxx.xxx.xxx.xxx > xxx.xxx.xxx.xxx:yyy > > i wanna split on ":" and get all the "yyy" and print the whole line out > so i

Re: The old round off problem?

2006-03-04 Thread sam
David I beg I beg Can you answer the question? Also thanks for the information on using the Taylor series. Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Re: question about sys.exc_type and sys.exc_value

2006-03-04 Thread John Salerno
John Salerno wrote: > MyError? The sample in the book shows "Got hello world", because hello > is the error name and world is the extra data. But mine doesn't seem to > work that way. (They are also using a string exception in the book, > instead of a class.) My mistake. In the book the except

question about sys.exc_type and sys.exc_value

2006-03-04 Thread John Salerno
Here is an exercise from Learning Python that I wrote myself: import sys import traceback class MyError: pass def oops(): raise MyError() def safe(func, *args): try: apply(func, args) except: traceback.print_exc() print 'Got', sys.exc_type, sys.exc_valu

Re: spliting on ":"

2006-03-04 Thread Peter Hansen
Petr Jakes wrote: >>I think you're getting caught by the classic and/or trap in Python, >>trying to avoid using a simple if statement. > > What do you mean by "the classic and/or trap"? Can you give an example > please? Sure, see my subsequent reply to Cyril, elsewhere in this thread. (In summar

Re: spliting on ":"

2006-03-04 Thread Peter Hansen
Cyril Bazin wrote: > Ok, ok, there was a mistake in the code. > (Of course, it was done on prupose in order to verify if everybody is > aware ;-) > I don't know why it is preferable to compare an object to the object > "None" using "is not". > "==" is, IMHO, more simple. Simple is better than com

Re: Passing a method indirectly

2006-03-04 Thread Farshid Lashkari
You don't need to pass the object along with the method. The method is bound to the object. Simply call the method by itself: def ObjApply(method): method() class Test: def test1 (self): print "Hello" def test2 (self): ObjApply(self.test1) ta = Test () ta

Re: Passing a method indirectly

2006-03-04 Thread André
swisscheese wrote: > I'm trying to write a function that takes an arbitrary object and > method. > The function applies the method to the object (and some other stuff). > I get error "Test instance has no attribute 'method' " > How can I make this work? > > def ObjApply (object,method): > ob

Passing a method indirectly

2006-03-04 Thread swisscheese
I'm trying to write a function that takes an arbitrary object and method. The function applies the method to the object (and some other stuff). I get error "Test instance has no attribute 'method' " How can I make this work? def ObjApply (object,method): object.method () class Test:

Cryptographically random numbers

2006-03-04 Thread Tuvas
Okay, I'm working on devoloping a simple, cryptographically secure number, from a range of numbers (As one might do for finding large numbers, to test if they are prime). My function looks like this: def cran_rand(min,max): if(min>max): x=max max=min min=x range=rou

Re: Suggestions for documentation generation?

2006-03-04 Thread Bo Peng
kpd wrote: > Hello, > > I have written a C++ library that I've then wrapped with Pyrex. > Any suggestions to the best-in-class tool to create documentation for > the libraries? > > I would love to document things in one spot (could be the code) and > generate html and PDF from there. > > Doxygen

Re: How to except the unexpected?

2006-03-04 Thread Paul Rubin
James Stroud <[EMAIL PROTECTED]> writes: > My suggestion was to use some common sense about the source code and > apply it. The common sense to apply is that if the source code says one thing and the documentation says another, then one of them is wrong and should be updated. Usually it's the sou

Re: Advice from distutils experts?

2006-03-04 Thread Robert Kern
[EMAIL PROTECTED] wrote: > I'm doing something a little wierd in one of my projects. I'm > generating a C source file based on information extracted from python's > header files. Although I can just generate the file and check the > result into source control, I'd rather have the file generated d

Re: How to except the unexpected?

2006-03-04 Thread James Stroud
Paul Rubin wrote: > James Stroud <[EMAIL PROTECTED]> writes: > >>>approach. Basically this is reverse engineering the interface from the >>>source at the time of writing the app. >> >>This is using the source as documentation, there is no law against >>that. > > That's completely bogus. Undocume

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
Okay, I don't know if your farmiliar with the miller-rabin primality test, but it's what's called a probabalistic test. Meaning that trying it out once can give fake results. For instance, if you use the number 31 to test if 561 is prime, you will see the results say that it isn't. Mathematically,

CallBack

2006-03-04 Thread Ramkumar Nagabhushanam
Hello All, I am trying to integrate the ftpclient (in ftplib) with an application that has been written I C/C++. I am able to delete,send change working directories etc. When I receive data back from the server i.e. Retrieve files, get a directory listing) I want to pass a callback function to the

Re: spliting on ":"

2006-03-04 Thread Petr Jakes
> I think you're getting caught by the classic and/or trap in Python, > trying to avoid using a simple if statement. What do you mean by "the classic and/or trap"? Can you give an example please? Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: spliting on ":"

2006-03-04 Thread Cyril Bazin
Ok, ok, there was a mistake in the code. (Of course, it was done on prupose in order to verify if everybody is aware ;-)I don't know why it is preferable to compare an object to the object "None" using "is not". "==" is, IMHO, more simple. Simple is better than complex. So I use "==". The correct p

Re: How to except the unexpected?

2006-03-04 Thread Paul Rubin
James Stroud <[EMAIL PROTECTED]> writes: > > approach. Basically this is reverse engineering the interface from the > > source at the time of writing the app. > > This is using the source as documentation, there is no law against > that. That's completely bogus. Undocumented interfaces in the li

Re: Papers on Dynamic Languages

2006-03-04 Thread Paul Boddie
Jay Parlar wrote: > > Anyway, I want to talk about things like typing disciplines (weak, > strong, etc.),"class vs. prototype, JIT technologies in dynamic > languages, interactive interpreters, etc. There are a few classic papers on a number of these topics, but I'll leave it to the papers mention

Advice from distutils experts?

2006-03-04 Thread olsongt
I'm doing something a little wierd in one of my projects. I'm generating a C source file based on information extracted from python's header files. Although I can just generate the file and check the result into source control, I'd rather have the file generated during the install process instead

Re: The old round off problem?

2006-03-04 Thread David Treadwell
On Mar 4, 2006, at 4:33 PM, Paul Rubin wrote: > "sam" <[EMAIL PROTECTED]> writes: >> Hello all, I am taking a class in scientific programming at the local >> college. My problem is that the following difference produces >> round off >> errors as the value of x increases. For x >= 19 the diferenc

Re: spliting on ":"

2006-03-04 Thread Peter Hansen
Cyril Bazin wrote: > Your file looks like a list of IP adresses. > You can use the urllib and urllib2 modules to parse IP adresses. > > import urllib2 > for line in open("fileName.txt"): > addr, port = urllib2.splitport(line) > print (port != None) and '' or port Is this what you want to

Re: How to except the unexpected?

2006-03-04 Thread James Stroud
Rene Pijlman wrote: > James Stroud: > >>Which suggests that "try: except HTTPException:" will be specific enough >>as a catchall for this module. >> >>The following, then, should catch everything you mentioned except the >>socket timeout: > > > Your conclusion may be (almost) right in this cas

Re: How to except the unexpected?

2006-03-04 Thread Paul Rubin
James Stroud <[EMAIL PROTECTED]> writes: > > try: > > process_things() > > except Reraise: > > raise > > except: > > log_error() > > > > Why catch an error only to re-raise it? > > This falls under http://c2.com/cgi/wiki?YouReallyArentGonnaNeedThis No, without the reraise, the bare "

Re: The old round off problem?

2006-03-04 Thread Paul Rubin
"sam" <[EMAIL PROTECTED]> writes: > Hello all, I am taking a class in scientific programming at the local > college. My problem is that the following difference produces round off > errors as the value of x increases. For x >= 19 the diference goes to > zero.I understand the problem, but am curious

Re: add an asynchronous exception class

2006-03-04 Thread Paul Rubin
"Christian Stapfer" <[EMAIL PROTECTED]> writes: > I guess it means the following: > > "Terminating exceptions" are exceptions that > terminate the *thrower* of the exception. Are you sure? I didn't read it that way. I'm not aware of there ever having been a detailed proposal for resumable excep

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Paul Rubin
"Tuvas" <[EMAIL PROTECTED]> writes: > I have made and recently posted a libary I made to do Modular > Arithmetic and Prime numbers on my website at > http://www.geocities.com/brp13/Python/index.html . I am currently in a > crypotology class, and am working on building a RSA public key > cryptology

Re: How to except the unexpected?

2006-03-04 Thread Alex Martelli
James Stroud <[EMAIL PROTECTED]> wrote: > > Reraise = (LookupError, ArithmeticError, AssertionError) # And then some > > > > try: > > process_things() > > except Reraise: > > raise > > except: > > log_error() > > > > Why catch an error only to re-raise it? To avoid the following ha

Open source reliability study

2006-03-04 Thread bearophileHUGS
They have used a lot of time and money to find bugs in Python too: http://www.theregister.co.uk/2006/03/03/open_source_safety_report/print.html 0.32 defects per 1,000 lines of code in LAMP, it says. I hope they will show such Python bugs, so Python developers can try to remove them. From the botto

Re: How to except the unexpected?

2006-03-04 Thread James Stroud
Rene Pijlman wrote: > Steven D'Aprano: > >>ExpectedErrors = (URLError, IOError) >>ErrorsThatCantHappen = >> >>try: >> process_things() >>except ExpectedErrors: >> recover_from_error_gracefully() >>except ErrorsThatCantHappen: >> print "Congratulations! You have found a program bug!" >> pri

Re: Python advocacy in scientific computation

2006-03-04 Thread Terry Hancock
On Sat, 4 Mar 2006 14:23:10 -0500 David Treadwell <[EMAIL PROTECTED]> wrote: > On Mar 4, 2006, at 5:55 AM, Dennis Lee Bieber wrote: > > On Fri, 3 Mar 2006 22:05:19 -0500, David Treadwell > > <[EMAIL PROTECTED]> declaimed the following > > in comp.lang.python: > >> 3. I demand a general-purpose tool

Re: how to record how long i use the intenet

2006-03-04 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > use python > use ADSL > use windows XP > i want to record the time when i get on the internet and off the > internet > into a txt file > HOW? http://en.wikipedia.org/wiki/Water_clock HTH Gerard -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy immutability in python?

2006-03-04 Thread Alex Martelli
Terry Hancock <[EMAIL PROTECTED]> wrote: ... > I also am not trying to alter the Python language. I am > trying to figure out how to most easily fix __setattr__ etc > to act immutably, *using* the existing features. > > I can already do what I want with some 25-30 lines of code > repeated each

Re: Easy immutability in python?

2006-03-04 Thread jess . austin
I guess we think a bit differently, and we think about different problems. When I hear, "immutable container", I think "tuple". When I hear, "my own class that is an immutable container", I think, "subclass tuple, and probably override __new__ because otherwise tuple would be good enough as is".

Re: spliting on ":"

2006-03-04 Thread Cyril Bazin
Your file looks like a list of IP adresses. You can use the urllib and urllib2 modules to parse IP adresses.import urllib2for line in open("fileName.txt"):    addr, port  = urllib2.splitport(line)     print (port != None) and '' or portCyril -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy immutability in python?

2006-03-04 Thread Terry Hancock
On 4 Mar 2006 10:14:56 -0800 [EMAIL PROTECTED] wrote: > Since this is a container that needs to be "immutable, > like a tuple", why not just inherit from tuple? You'll > need to override the __new__ method, rather than the > __init__, since tuples are immutable: > > class a(tuple): > def __ne

XP rich text cut-n-paste

2006-03-04 Thread Paddy
Hi, Is their a colourized editor/shell that allows you to cut and paste the colourized text? Idle, SPE, Eclipse, and pythonwin all seem to nicely colourize both command line input as well as editor windows but when I cut and paste (in this case, into OpenOffice Writer), even the paste-special menu

Papers on Dynamic Languages

2006-03-04 Thread Jay Parlar
For one of my grad school classes, I'm writing a paper on "Dynamic Languages". What a wonderfully vague topic (but at least it'll let me write about Python). Anyway, I want to talk about things like typing disciplines (weak, strong, etc.),"class vs. prototype, JIT technologies in dynamic langu

how to record how long i use the intenet

2006-03-04 Thread b53444
use python use ADSL use windows XP i want to record the time when i get on the internet and off the internet into a txt file HOW? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-04 Thread David Treadwell
On Mar 4, 2006, at 5:55 AM, Dennis Lee Bieber wrote: > On Fri, 3 Mar 2006 22:05:19 -0500, David Treadwell > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > > >> My ability to think of data structures was stunted BECAUSE of >> Fortran and BASIC. It's very difficult for me to

Re: Easy immutability in python?

2006-03-04 Thread Terry Hancock
Whoops I forgot to list the reference. Also, I just finished reading the old thread, so I see some damage-control may be needed. On Sat, 4 Mar 2006 11:52:59 -0600 Terry Hancock <[EMAIL PROTECTED]> wrote: > [1] > http://news.hping.org/comp.lang.python.archive/28916.html And more specifically, I'm

Re: generators shared among threads

2006-03-04 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > hi, > > This seems like a difficult question to answer through testing, so I'm > hoping that someone will just know... Suppose I have the following > generator, g: > > def f() > i = 0 > while True: > yield i > i += 1 > g=f() > > If I pass g

Re: PyQt issue

2006-03-04 Thread Damjan
> Because you wrote curentText - note the missing t. :) You mean the missing 'r' :) -- http://mail.python.org/mailman/listinfo/python-list

Is there a WSGI sollutions repository somewhere

2006-03-04 Thread Damjan
It seems that WSGI support starts to flourish is there some document or a web site that tracks what's out there, some place to pick and choose WSGI components? -- http://mail.python.org/mailman/listinfo/python-list

The old round off problem?

2006-03-04 Thread sam
Hello all, I am taking a class in scientific programming at the local college. My problem is that the following difference produces round off errors as the value of x increases. For x >= 19 the diference goes to zero.I understand the problem, but am curious as to whether their exists a solution. I

Re: do design patterns still apply with Python?

2006-03-04 Thread jess . austin
msoulier wrote: > I find that DP junkies don't tend to keep things simple. +1 QOTW. There's something about these "political" threads that seems to bring out the best quotes. b^) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to except the unexpected?

2006-03-04 Thread Bruno Desthuilliers
Rene Pijlman a écrit : > Jorge Godoy: > >>Rene Pijlman: >> >>>my app was surprised by an >>>httplib.InvalidURL since I hadn't noticed this could be raised by >>>robotparser (this is undocumented). >> >>It isn't undocumented in my module. From 'pydoc httplib': > > > That's cheating: pydoc is rea

generators shared among threads

2006-03-04 Thread jess . austin
hi, This seems like a difficult question to answer through testing, so I'm hoping that someone will just know... Suppose I have the following generator, g: def f() i = 0 while True: yield i i += 1 g=f() If I pass g around to various threads and I want them to always be y

Re: Easy immutability in python?

2006-03-04 Thread jess . austin
To be clear, in this simple example I gave you don't have to override anything. However, if you want to process the values you place in the container in some way before turning on immutability (which I assume you must want to do because otherwise why not just use a tuple to begin with?), then that

license preamble template

2006-03-04 Thread Xah Lee
I noticed, that in just about all emacs programs on the web (elisp code), it comes with this template text as its preamble: ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundatio

Re: How to except the unexpected?

2006-03-04 Thread Roman Susi
Rene Pijlman wrote: > Paul Rubin : > >>We have to get Knuth using Python. > > > Perhaps a MIX emulator and running TeXDoctest on his books will convince > him.. Or maybe Python written for MIX... -Roman -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy immutability in python?

2006-03-04 Thread jess . austin
Since this is a container that needs to be "immutable, like a tuple", why not just inherit from tuple? You'll need to override the __new__ method, rather than the __init__, since tuples are immutable: class a(tuple): def __new__(cls, t): return tuple.__new__(cls, t) cheers, Jess --

Re: Write a GUI for a python script?

2006-03-04 Thread Peter Decker
On 3/4/06, Bill Maxwell <[EMAIL PROTECTED]> wrote: > Dabo does look really nice, but seems like it has a ways to go yet. > > I downloaded it a couple of weeks ago, and the very first thing I wanted > to do doesn't seem to be supported. I tried to create a simple > application with a Notebook cont

Re: re-posting: web.py, incomplete

2006-03-04 Thread _wolf
ok, that does it! [EMAIL PROTECTED] a lot! sorry first of all for my adding to the confusion when i jumped to comment on that ``-u`` option thing---of course, **no -u option** means **buffered**, positively, so there is buffering and buffering problems, **with -u option** there is **no buffer**, s

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
Okay, the bug in my code has been fixed, it should work alot better now... I thought I had tested the power function, but I appearently wasn't even close... But now it works just fine. I guess you are right, I will have to work on a better system to be cryptologically secure. But, at least I have

Re: Python advocacy in scientific computation

2006-03-04 Thread Brian Blais
sturlamolden wrote: > > Typically a scientist need to: > > 1. do a lot of experiments > > 2. analyse the data from experiments > > 3. run a simulation now and then > unless you are a theorist! in that case, I would order this list backwards. > > 1. Time is money. Time is the only thing th

Re: spliting on ":"

2006-03-04 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > hi > > i have a file with > > xxx.xxx.xxx.xxx:yyy > xxx.xxx.xxx.xxx:yyy > xxx.xxx.xxx.xxx:yyy > xxx.xxx.xxx.xxx > xxx.xxx.xxx.xxx > xxx.xxx.xxx.xxx:yyy > > i wanna split on ":" and get all the "yyy" and print the whole line out > so i did > > print line.split(":")[-1]

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
Well, the RSA element's never going to encrypt more than a small, 1 block system except under rare occasions, the primary encryption will be AES128. Thanks for the help though! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-04 Thread Michael Tobis
There is a range of folks doing scientific programming. Not all of them are described correctly by your summary, but many are. The article is aimed not at them, but rather at institutions that develop engineered Fortran models using multipuurpose teams and formal methods. I appreciate your comments

Easy immutability in python?

2006-03-04 Thread Terry Hancock
Is there an *easy* way to make an object immutable in python? Or perhaps I should say "one obvious way to do it"? Oughtn't there to be one? I've found a thread on how to do this[1], which essentially says something like "redefine __setattr__, __delattr__, __hash__, __eq__, __setitem__, delitem__

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Alex Martelli
Tuvas <[EMAIL PROTECTED]> wrote: ... > to make sure. For simpler than going to the website, I used the ranint I assume you mean random.randint here. > function to pick a random prime number, then ran it through the miller > rabin primality test. It's a probabalistic test, which means it isn't

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
I have discoved that the mod function isn't quite right in dealing with powers, but, I'll have it fixed shortly. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-04 Thread Alex Martelli
Terry Hancock <[EMAIL PROTECTED]> wrote: > In fact, if I had one complaint about Python, it was the > "with a suitable array of add-ons" caveat. The proprietary > alternative had all of that rolled into one package (abeit > it glopped into one massive and arcane namespace), whereas > there was no

Re: add an asynchronous exception class

2006-03-04 Thread Christian Stapfer
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > "Fredrik Lundh" <[EMAIL PROTECTED]> writes: >> PEP 348 addresses this by moving special exceptions out of the >> Exception hierarchy: >> >> http://www.python.org/peps/pep-0348.html > > I see that suggestion was r

Re: Write a GUI for a python script?

2006-03-04 Thread Bill Maxwell
On Fri, 3 Mar 2006 07:19:34 -0500, "Peter Decker" <[EMAIL PROTECTED]> wrote: >I started with wxPython and struggled with it for a long time. I was >able to get the job done, but using it never seemed natural. Then I >found the Dabo project, whose ui module wraps wxPython into a much >more Pythonic

Re: spliting on ":"

2006-03-04 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > print line.split(":")[-1] > > but line 4 and 5 are not printed as there is no ":" to split. It should > print a "blank" at least. > how to print out lines 4 and 5 ? > eg output is > > yyy > yyy > yyy > > > yyy if ":" in line: print line.split(":")[-1] else: pr

spliting on ":"

2006-03-04 Thread s99999999s2003
hi i have a file with xxx.xxx.xxx.xxx:yyy xxx.xxx.xxx.xxx:yyy xxx.xxx.xxx.xxx:yyy xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx:yyy i wanna split on ":" and get all the "yyy" and print the whole line out so i did print line.split(":")[-1] but line 4 and 5 are not printed as there is no ":" t

Re: Python advocacy in scientific computation

2006-03-04 Thread Terry Hancock
On 3 Mar 2006 17:33:31 -0800 "sturlamolden" <[EMAIL PROTECTED]> wrote: > 1. Time is money. Time is the only thing that a scientist > cannot afford to lose. Licensing fees for Matlab is not an > issue. If we can spend $1,000,000 on specialised equipment > we can pay whatever Mathworks or Lahey charg

Re: socket freezes

2006-03-04 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thank you all for your suggestions. Luis P. Mendes -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFECb5AHn4UHCY8rB8RAmeLAKCmSVfTvgQ94NPnJlD2QqdbMwVFXACdGFAh 8

Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
I have made and recently posted a libary I made to do Modular Arithmetic and Prime numbers on my website at http://www.geocities.com/brp13/Python/index.html . I am currently in a crypotology class, and am working on building a RSA public key cryptology system for a class project. I am building the

Re: do design patterns still apply with Python?

2006-03-04 Thread Bo Yang
Paul Novak : > A lot of the complexity of design patterns in Java falls away in > Python, mainly because of the flexibility you get with dynamic typing. > I agree with this very much ! In java or C++ or all such static typing and compiled languages , the type is fixed on in the compile phrase ,

Re: do design patterns still apply with Python?

2006-03-04 Thread Bo Yang
Paul Novak 写道: > A lot of the complexity of design patterns in Java falls away in > Python, mainly because of the flexibility you get with dynamic typing. > I agree with this very much ! In java or C++ or all such static typing and compiled languages , the type is fixed on in the compile phrase ,

Re: How to except the unexpected?

2006-03-04 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Rene Pijlman <[EMAIL PROTECTED]> wrote: > Roy Smith: > >In theory, all exceptions which represent problems with the external > >environment (rather than programming mistakes) should derive from > >Exception, but not from StandardError. > > Are you sure? > > """

Re: do design patterns still apply with Python?

2006-03-04 Thread Paul Novak
A lot of the complexity of design patterns in Java falls away in Python, mainly because of the flexibility you get with dynamic typing.  For a Pythonic Perspective on Patterns, "Python Programming Patterns" by Thomas W. Christopher is definitely worth tracking down.  It looks like it is out of pr

Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting

2006-03-04 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Is there a way to hide a python instance from the Task Manager process > list? Try sony's rootkit. Or any other. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing an OPC client with Python ?

2006-03-04 Thread F. GEIGER
About a year ago I dev'ed a host app in Python (2.3 at that time) to control a KUKA KR16 robot. Comm was over OPC. The OPC 2.0 server was inst'ed on the KRC2. What I was needed to do, was to install the appropriate (i.e. delivere together w/ the server) client software and to take Mark Hammonds

Re: Package organization: where to put 'common' modules?

2006-03-04 Thread Jorge Godoy
Kent Johnson <[EMAIL PROTECTED]> writes: > What I do is run always from the base directory (violates your first > requirement). I make a util package to hold commonly used code. Then B and D > both use > from util import foo > > In Python 2.5 you will be able to say (in D, for example) > from

  1   2   >