Re: Request for feedback on API design

2010-12-09 Thread Steven D'Aprano
On Thu, 09 Dec 2010 18:48:10 -0600, Tim Chase wrote: > On 12/09/2010 05:44 PM, Steven D'Aprano wrote: >> (1) Multivariate statistics such as covariance have two obvious APIs: >> >> A pass the X and Y values as two separate iterable arguments, >> e.g.: >>cov([1, 2, 3], [4, 5, 6])

Re: printing error message from an Exception

2010-12-09 Thread Steven D'Aprano
On Thu, 09 Dec 2010 22:16:17 -0800, mark jason wrote: > hi > I was trying out some file operations and was trying to open a non > existing file as below > > def do_work(filename): > try: > f = open(filename,"r"); > print 'opened' > except IOError, e: > print 'faile

Re: dns library

2010-12-09 Thread Paulo da Silva
Em 10-12-2010 02:59, Jean-Paul Calderone escreveu: > On Dec 9, 8:15 pm, Paulo da Silva > wrote: >> Hi. >> >> Is there a python library/module to handle both the server and client >> sides of dns protocol? >> >> I have googled for it but I only found client side ones (at least from >> the superfici

printing error message from an Exception

2010-12-09 Thread mark jason
hi I was trying out some file operations and was trying to open a non existing file as below def do_work(filename): try: f = open(filename,"r"); print 'opened' except IOError, e: print 'failed',e.message finally: f.close() print 'closed' if __na

Re: Deprecation warnings (2.7 -> 3 )

2010-12-09 Thread Terry Reedy
On 12/9/2010 10:15 PM, rusi wrote: In trying to get from 2.x to 3 Terry suggested I use 2.7 with deprecation warnings Heres the (first) set DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x DeprecationWarning: callable() not supported in 3.x; use isinstance(x, collect

Re: little emacs lisp tutorial on turning a url into a link

2010-12-09 Thread small Pox
On Dec 9, 7:32 pm, small Pox wrote: > On Dec 4, 1:38 am, Xah Lee wrote: > > > > > > > > On Dec 3, 8:20 pm, duckblue wrote: > > > > why is xah lee posting this information? > > > > > sites with more external links pointing to them are given a higher > > > > ranking by search engines such as googl

Re: little emacs lisp tutorial on turning a url into a link

2010-12-09 Thread small Pox
On Dec 9, 7:32 pm, small Pox wrote: > On Dec 4, 1:38 am, Xah Lee wrote: > > > > > > > > On Dec 3, 8:20 pm, duckblue wrote: > > > > why is xah lee posting this information? > > > > > sites with more external links pointing to them are given a higher > > > > ranking by search engines such as googl

Re: little emacs lisp tutorial on turning a url into a link

2010-12-09 Thread small Pox
On Dec 4, 1:38 am, Xah Lee wrote: > > On Dec 3, 8:20 pm, duckblue wrote: > > > why is xah lee posting this information? > > > > sites with more external links pointing to them are given a higher > > > ranking by search engines such as google. as a result they appear > > > closer to the top of the

Deprecation warnings (2.7 -> 3 )

2010-12-09 Thread rusi
In trying to get from 2.x to 3 Terry suggested I use 2.7 with deprecation warnings Heres the (first) set DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x DeprecationWarning: callable() not supported in 3.x; use isinstance(x, collections.Callable) Is there one place/si

Re: dns library

2010-12-09 Thread Jean-Paul Calderone
On Dec 9, 8:15 pm, Paulo da Silva wrote: > Hi. > > Is there a python library/module to handle both the server and client > sides of dns protocol? > > I have googled for it but I only found client side ones (at least from > the superficial readings I did). > > Thanks. Twisted Names is one such lib

Re: Proposed changes to logging defaults

2010-12-09 Thread Vinay Sajip
On Dec 10, 12:48 am, Ethan Furman wrote: > > I like the changes proposed. > > Question about the "handler of last resort":  is there only one of them, > or will each library have its own so it can decide what the minimum > severity should be for itself? Libraries decide their severities different

dns library

2010-12-09 Thread Paulo da Silva
Hi. Is there a python library/module to handle both the server and client sides of dns protocol? I have googled for it but I only found client side ones (at least from the superficial readings I did). Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: win32 design pattern: COM localserver?

2010-12-09 Thread Mark Hammond
If you are implementing a COM object using win32com, then Python will never be unloaded from the host process, which works in your favour. Just have the COM object use a thread and a queue for this processing. The 'report' method would just stick the params and filenames in the queue and return

Re: Request for feedback on API design

2010-12-09 Thread Tim Chase
On 12/09/2010 05:44 PM, Steven D'Aprano wrote: (1) Multivariate statistics such as covariance have two obvious APIs: A pass the X and Y values as two separate iterable arguments, e.g.: cov([1, 2, 3], [4, 5, 6]) B pass the X and Y values as a single iterable of tuples, e.g.:

Re: Proposed changes to logging defaults

2010-12-09 Thread Ethan Furman
Vinay Sajip wrote: Some changes are being proposed to how logging works in default configurations. I like the changes proposed. Question about the "handler of last resort": is there only one of them, or will each library have its own so it can decide what the minimum severity should be for

Proposed changes to logging defaults

2010-12-09 Thread Vinay Sajip
Some changes are being proposed to how logging works in default configurations. Briefly - when a logging event occurs which needs to be output to some log, the behaviour of the logging package when no explicit logging configuration is provided will change, most likely to log those events to sys.st

Re: ***locale.Error: unsupported locale setting***

2010-12-09 Thread Vlastimil Brom
2010/12/9 Anurag Chourasia : > Hi All, > When i try to set a locale manually, i get this error. import locale locale.setlocale(locale.LC_ALL, 'es_cl.iso88591') > Traceback (most recent call last): >   File "", line 1, in >   File "/usr/local/lib/python2.7/locale.py", line 531, in setloca

Re: Reference counting problems?

2010-12-09 Thread MRAB
On 09/12/2010 20:23, Eric Frederich wrote: I am attempting to automate the building of binding for a 3rd party library. The functions I'm wrapping all return an integer of whether they failed and output are passed as pointers. There can be multiple return values. So the code that I generate has a

Request for feedback on API design

2010-12-09 Thread Steven D'Aprano
I am soliciting feedback regarding the API of my statistics module: http://code.google.com/p/pycalcstats/ Specifically the following couple of issues: (1) Multivariate statistics such as covariance have two obvious APIs: A pass the X and Y values as two separate iterable arguments, e.g.:

Re: Comparisons of incompatible types

2010-12-09 Thread Steven D'Aprano
On Thu, 09 Dec 2010 09:34:19 -0800, John Nagle wrote: > (The best coverage of this whole topic was the Apple Numerics Manual > for the original Mac. Apple hired the floating point expert from > Berkeley to get this right. Then Apple went from the M68xxx series to > the IBM PowerPC, and 80-bit

Re: Comparisons of incompatible types

2010-12-09 Thread Steven D'Aprano
On Thu, 09 Dec 2010 12:21:45 +, Mark Wooding wrote: > John Nagle writes: >> "sort" has failed because it assumes that a < b and b < c implies a < >> c. But that's not a valid assumption here. >> >> It's not good to break trichotomy. > > You're confused. The property > > a < b and

Re: 64 bit memory usage

2010-12-09 Thread John Nagle
On 12/8/2010 10:42 PM, Dennis Lee Bieber wrote: On Wed, 8 Dec 2010 14:44:30 +, Rob Randall declaimed the following in gmane.comp.python.general: I am trying to understand how much memory is available to a 64 bit python process running under Windows XP 64 bit. When I run tests just creating

***locale.Error: unsupported locale setting***

2010-12-09 Thread Anurag Chourasia
Hi All, When i try to set a locale manually, i get this error. >>> import locale >>> locale.setlocale(locale.LC_ALL, 'es_cl.iso88591') Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/locale.py", line 531, in setlocale return _setlocale(category, loca

Re: completely implicit interpolation based on a frame object (nn)

2010-12-09 Thread Edward Peschko
>> a bit closer here, but I'm not sure if they are >> workable (or usable) with 2.5... which is where I need to work. >> >> Ed > > One of the solutions from here might work for you: > > http://wiki.python.org/moin/Templating > Ok, cool. A couple of followups - I'd be interested in knowing which of

Added Python, WSGI to XAMPP

2010-12-09 Thread Gerry Reno
If you have any need of a portable LAMP stack, I just finished writing some How-To's for getting Python, VirtualEnv and WSGI frameworks running with XAMPP: How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP How-To: Add VirtualEn

Reference counting problems?

2010-12-09 Thread Eric Frederich
I am attempting to automate the building of binding for a 3rd party library. The functions I'm wrapping all return an integer of whether they failed and output are passed as pointers. There can be multiple return values. So the code that I generate has a PyObject* called python__return_val that I u

Re: 64 bit memory usage

2010-12-09 Thread Antoine Pitrou
On Thu, 9 Dec 2010 17:18:58 + Rob Randall wrote: > Basically the process runs at around 1% and it never seems to grow in size > again. > When running the C++ with python app the process slows when a new 'page' is > required but then goes back to 'full' speed. It does this until basically > all

Re: 64 bit memory usage

2010-12-09 Thread Rob Randall
I will give it a try with the garbage collector disabled. On 9 December 2010 17:29, Benjamin Kaplan wrote: > On Thursday, December 9, 2010, Rob Randall wrote: > > But the C++ program using up memory does not slow up. > > It has gone to 40GB without much trouble. > > > > Your C++ program probabl

Condition signals and restarts, resumable exceptions (was: Comparison with False - something I don't understand)

2010-12-09 Thread Teemu Likonen
* 2010-12-06 00:14 (-0800), Paul Rubin wrote: > You know, I've heard the story from language designers several times > over, that they tried putting resumable exceptions into their > languages and it turned out to be a big mess, so they went to > termination exceptions that fixed the issue. Are th

Re: trace cmd line args

2010-12-09 Thread rusi
On Dec 9, 10:37 pm, rusi wrote: > On Dec 9, 9:03 pm, Terry Reedy wrote: > > > > > On 12/9/2010 7:12 AM, rusi wrote: > > > > On Dec 9, 1:39 pm, Terry Reedy  wrote: > > >> On 12/9/2010 1:10 AM, rusi wrote: > > > >>> I am unable to get trace to not trace system modules. > > > >> Try it with 3.2b1, j

Re: trace cmd line args

2010-12-09 Thread rusi
On Dec 9, 9:03 pm, Terry Reedy wrote: > On 12/9/2010 7:12 AM, rusi wrote: > > > On Dec 9, 1:39 pm, Terry Reedy  wrote: > >> On 12/9/2010 1:10 AM, rusi wrote: > > >>> I am unable to get trace to not trace system modules. > > >> Try it with 3.2b1, just released. Multiple bugs were fixed in trace. >

Re: Comparisons of incompatible types

2010-12-09 Thread John Nagle
On 12/9/2010 12:36 AM, Terry Reedy wrote: On 12/9/2010 2:58 AM, Steven D'Aprano wrote: On Wed, 08 Dec 2010 20:16:57 -0800, John Nagle wrote: I believe that is that exactly one of <,=.> are true. Not for NaNs. >>> NaN = float('nan') >>> NaN == NaN False >>> NaN > NaN False >>> NaN < NaN False

Re: 64 bit memory usage

2010-12-09 Thread Benjamin Kaplan
On Thursday, December 9, 2010, Rob Randall wrote: > But the C++ program using up memory does not slow up. > It has gone to 40GB without much trouble. > Your C++ program probably doesn't have a garbage collector traversing the entire allocated memory looking for reference cycles. > Does anyone ha

Re: 64 bit memory usage

2010-12-09 Thread John Nagle
On 12/8/2010 11:40 PM, Ian Kelly wrote: Since a process need not have all its pages in physical memory simultaneously, there is no reason to suppose that a single process could not consume the entirety of the available virtual memory (minus what is used by the operating system) on a 64-bit system

Re: 64 bit memory usage

2010-12-09 Thread Rob Randall
Basically the process runs at around 1% and it never seems to grow in size again. When running the C++ with python app the process slows when a new 'page' is required but then goes back to 'full' speed. It does this until basically all the virtual memory is used. I have had memory exceptions when

Re: 64 bit memory usage

2010-12-09 Thread Rob Randall
But the C++ program using up memory does not slow up. It has gone to 40GB without much trouble. Does anyone have a 64 bit python application that uses more the 2GB? On 9 December 2010 16:54, Antoine Pitrou wrote: > On Wed, 8 Dec 2010 14:44:30 + > Rob Randall wrote: > > I am trying to under

Re: run a function in another processor in python

2010-12-09 Thread geremy condra
On Thu, Dec 9, 2010 at 5:03 AM, Astan Chee wrote: > Thanks but I'm having trouble with that module too. Currently what I > have is something like this: > > import sys > import os > import multiprocessing > > import time > > def functionTester(num): >    return ((num+2)/(num-2))**2 > > num_args = [

Re: Using a window style in a Toplevel window

2010-12-09 Thread Eric Brunel
In article , pyt...@bdurham.com wrote: > Eric, > > Besides style support, what are the advantages of ttk.Frame vs. > Tkinter.Frame? I'd say none. They are both just containers for other widgets, support the same layout managers, and so on. For me, using a ttk.Frame is really just for getting

Re: 64 bit memory usage

2010-12-09 Thread Antoine Pitrou
On Wed, 8 Dec 2010 14:44:30 + Rob Randall wrote: > I am trying to understand how much memory is available to a 64 bit python > process running under Windows XP 64 bit. > > When I run tests just creating a series of large dictionaries containing > string keys and float values I do not seem to

Re: 64 bit memory usage

2010-12-09 Thread Nobody
Rob Randall wrote: > I am trying to understand how much memory is available to a 64 bit python > process running under Windows XP 64 bit. > > When I run tests just creating a series of large dictionaries containing > string keys and float values I do not seem to be able to grow the process > bey

Re: trace cmd line args

2010-12-09 Thread Terry Reedy
On 12/9/2010 7:12 AM, rusi wrote: On Dec 9, 1:39 pm, Terry Reedy wrote: On 12/9/2010 1:10 AM, rusi wrote: I am unable to get trace to not trace system modules. Try it with 3.2b1, just released. Multiple bugs were fixed in trace. Some fixes might also be in recent 2.7.1 and 3.1.3. Not sure.

Re: Can't deepcopy bytes-derived class

2010-12-09 Thread Terry Reedy
On 12/9/2010 9:19 AM, Dan wrote: I tested the 4 line change anyway...removing it from 3.2 had no detrimental effect, adding it to 3.1 had no effect. It must be something else. Then there must have been a change in the bytes object, which is deeper than I want to go. 3.2 has a LOT of little i

Re: completely implicit interpolation based on a frame object

2010-12-09 Thread nn
On Dec 9, 2:29 am, Edward Peschko wrote: > >> Any ideas would be great on this, including pitfalls that people see > >> in implementing it. > > >http://docs.python.org/library/string.html#template-strings > > > regards > >  Steve > > Steve, > > Thanks for the tip, I did look at templates and decid

Re: run a function in another processor in python

2010-12-09 Thread Peter Otten
Astan Chee wrote: > Thanks but I'm having trouble with that module too. Currently what I > have is something like this: > > import sys > import os > import multiprocessing > > import time > > def functionTester(num): > return ((num+2)/(num-2))**2 > > num_args = [61,62,33,7,12,16,19,35,36,3

Re: Can't deepcopy bytes-derived class

2010-12-09 Thread Dan
On Dec 8, 9:05 pm, Terry Reedy wrote: > On 12/8/2010 7:11 PM, Ned Deily wrote: > > > > > > > > > > > In article, Terry > > Reedy  wrote: > >> On 12/8/2010 2:42 PM, Dan wrote: > >>> I have a simple type derived from bytes... > > >>> class atom(bytes): pass > > >>> ... that I cannot deepcopy().  The

Re: kinterbasdb error connection

2010-12-09 Thread Uwe Grauer
On 12/07/2010 04:35 PM, Ale Ghelfi wrote: > (i'm under Ubuntu 10.10 amd64 and python 2.6 and kinterbasdb 3.2 ) > I try to connect my database of firebird 2.5 by kinterbasdb. > But python return this error : You are not using the current kinterbasdb version. See: http://firebirdsql.org/index.php?o

Re: Replacing globals in exec by custom class

2010-12-09 Thread Jonathan S
Thanks for your response! (And sorry about the syntax error, I forgot to test my code after cleaning up some debug statements before posting, the else should have been elif indeed.) It's very interesing, how Python works internally. According to a thread on the Python mailing list in 2002, it seem

Re: Re: 64 bit memory usage

2010-12-09 Thread Heather Brown
On 01/-10/-28163 02:59 PM, Dennis Lee Bieber wrote: On Wed, 8 Dec 2010 14:44:30 +, Rob Randall declaimed the following in gmane.comp.python.general: I am trying to understand how much memory is available to a 64 bit python process running under Windows XP 64 bit. When I run tests just crea

Re: packaging python code in zip file

2010-12-09 Thread Peter Otten
mark jason wrote: > hi, > I have created a python app in eclipse pydev .The app is structured as > below.. > > mypackage > |__ __init__.py > |__ driver.py > |__ helper.py > |__ utils.py > > The driver.py has the main program.I have added if > __name__=="__main__" block in

Re: run a function in another processor in python

2010-12-09 Thread Astan Chee
Thanks but I'm having trouble with that module too. Currently what I have is something like this: import sys import os import multiprocessing import time def functionTester(num): return ((num+2)/(num-2))**2 num_args = [61,62,33,7,12,16,19,35,36,37,38,55,56,57,63] max_result = 0 start = ti

Re: Comparisons of incompatible types

2010-12-09 Thread Mark Wooding
John Nagle writes: > >>> NaN = float("nan") > >>> arr = [1.0, 4.0, 3.0, 2.0, 5.0, NaN, 6.0, 3.0, NaN, 0.0, 1.0, 4.0, > 3.0, 2.0, 5.0, NaN, 6.0, 3.0, NaN, 0.0] > >>> sorted(arr) > [0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 5.0, nan, 5.0, 6.0, > nan, 4.0, nan, 6.0, nan] > > The sorted

Re: A web site using Python

2010-12-09 Thread Stefaan Himpe
1. Pick a web framework, I'd suggest looking at: web2py: http://web2py.com - probably the easiest to install (no configuration needed) and learn. Suitable for both small and big projects. No worries when upgrading to a newer version as backward compatibility is an explicit design goal. -- h

Re: Using a window style in a Toplevel window

2010-12-09 Thread python
Eric, Besides style support, what are the advantages of ttk.Frame vs. Tkinter.Frame? Thanks, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: trace cmd line args

2010-12-09 Thread rusi
On Dec 9, 1:39 pm, Terry Reedy wrote: > On 12/9/2010 1:10 AM, rusi wrote: > > > I am unable to get trace to not trace system modules. > > Try it with 3.2b1, just released. Multiple bugs were fixed in trace. > Some fixes might also be in recent 2.7.1 and 3.1.3. Not sure. > > -- > Terry Jan Reedy I

[Fwd: Re: Using a window style in a Toplevel window]

2010-12-09 Thread craf
- Mensaje reenviado > De: Eric Brunel > Para: python-list@python.org > Asunto: Re: Using a window style in a Toplevel window > Fecha: Thu, 09 Dec 2010 10:00:39 +0100 > Grupos de noticias: comp.lang.python > > In article , > craf wrote: > > > Hi. > > > > I use Python 3.1 and T

Re: packaging python code in zip file

2010-12-09 Thread Nitin Pawar
have u tried using setuptools and distutils they are used for python package distributions On Thu, Dec 9, 2010 at 5:02 PM, mark jason wrote: > hi, > I have created a python app in eclipse pydev .The app is structured as > below.. > > mypackage > |__ __init__.py > |__ driver.py > |___

packaging python code in zip file

2010-12-09 Thread mark jason
hi, I have created a python app in eclipse pydev .The app is structured as below.. mypackage |__ __init__.py |__ driver.py |__ helper.py |__ utils.py The driver.py has the main program.I have added if __name__=="__main__" block in the driver.py and pydev's run configurat

Re: run a function in another processor in python

2010-12-09 Thread Jean-Michel Pichavant
Astan Chee wrote: Hi, I've got a python script that calls a function many times with various arguments and returns a result. What I'm trying to do is run this function each on different processors and compile the result at the end based on the function result. The script looks something like this

run a function in another processor in python

2010-12-09 Thread Astan Chee
Hi, I've got a python script that calls a function many times with various arguments and returns a result. What I'm trying to do is run this function each on different processors and compile the result at the end based on the function result. The script looks something like this: import time def

Re: Using a window style in a Toplevel window

2010-12-09 Thread Eric Brunel
In article , craf wrote: > Hi. > > I use Python 3.1 and Tkinter.ttk 8.5 on Ubuntu 9.10. > > CODE: > > module:FMain.py > > from tkinter import ttk > from FSecondWindow import * > > class App: > def __init__(self,master): > > bu

Re: is py2exe still active ?

2010-12-09 Thread Octavian Rasnita
Hi Philip, I thought that pypi works like cpan for Perl, but now I understand. Thank you for clarifications. -- Octavian --- From: "Philip Semanchuk" > > On Dec 8, 2010, at 5:09 AM, Octavian Rasnita wrote: > >> Hi Steve, >> >> I may put some stupid questions because I am very new to Pytho

Re: trace cmd line args

2010-12-09 Thread Terry Reedy
On 12/9/2010 1:10 AM, rusi wrote: I am unable to get trace to not trace system modules. Try it with 3.2b1, just released. Multiple bugs were fixed in trace. Some fixes might also be in recent 2.7.1 and 3.1.3. Not sure. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparisons of incompatible types

2010-12-09 Thread Terry Reedy
On 12/9/2010 2:58 AM, Steven D'Aprano wrote: On Wed, 08 Dec 2010 20:16:57 -0800, John Nagle wrote: Here's an example where this issue produces invalid results in Python. >>> NaN = float("nan") >>> arr = [1.0, 4.0, 3.0, 2.0, 5.0, NaN, 6.0, 3.0, NaN, 0.0, 1.0, 4.0, 3.0, 2.0, 5.0,

Re: Comparisons of incompatible types

2010-12-09 Thread Steven D'Aprano
On Wed, 08 Dec 2010 20:16:57 -0800, John Nagle wrote: > Here's an example where this issue produces invalid results in > Python. > > >>> NaN = float("nan") > >>> arr = [1.0, 4.0, 3.0, 2.0, 5.0, NaN, 6.0, 3.0, NaN, 0.0, 1.0, 4.0, > 3.0, 2.0, 5.0, NaN, 6.0, 3.0, NaN, 0.0] > >>> sorted(ar