Read-Write Lock vs primitive Lock()

2008-12-29 Thread k3xji
Hi, I am trying to see on which situations does the Read-Write Lock performs better on primitive Lock() itself. Below is the code I am using to test the performance: import threading import locks import time class mylock(object): def __init__(self): self.__notreading = threading.Even

Re: How to display Chinese in a list retrieved from database via python

2008-12-29 Thread Mark Tolonen
"zxo102" wrote in message news:2560a6e0-c103-46d2-aa5a-8604de4d1...@b38g2000prf.googlegroups.com... I have a list in a dictionary and want to insert it into the html file. I test it with following scripts of CASE 1, CASE 2 and CASE 3. I can see "中文" in CASE 1 but that is not what I want. CAS

Re: why cannot assign to function call

2008-12-29 Thread Bruno Desthuilliers
scsoce a écrit : I have a function return a reference, and want to assign to the reference, You have a function that returns an object. You can't "assign" to an object - this makes no sense. I'm afraid you are confusing Python's name/object bindings with C pointers or C++ references. -- h

Re: "return" in def

2008-12-29 Thread Bruno Desthuilliers
John Machin a écrit : On Dec 29, 7:06 am, Roger wrote: Curious. When I see a bare return, the first thing I think is that the author forgot to include the return value and that it's a bug. The second thing I think is that maybe the function is a generator, and so I look for a yield. If I don't

Re: why cannot assign to function call

2008-12-29 Thread John Machin
On Dec 29, 5:01 pm, scsoce wrote: > I have a function return a reference, Stop right there. You don't have (and can't have, in Python) a function which returns a reference that acts like a pointer in C or C+ +. Please tell us what manual, tutorial, book, blog or Usenet posting gave you that idea,

Windows SSH (remote execution of commands) - Python Automation

2008-12-29 Thread Narasimhan Raghu-RBQG84
Hi experts, I am looking for some information on how to automate remote login to a UNIX machine using ssh from a windows XP box. Possible way: 1. Use putty (or any other ssh client from windows XP). -- Can be automated with command line parameters. The problem is that I am able to login - Put

Re: Get a list of functions in a file

2008-12-29 Thread Chris Rebert
On Sun, Dec 28, 2008 at 11:26 PM, member Basu wrote: > I'm putting some utility functions in a file and then building a simple > shell interface to them. Is their some way I can automatically get a list of > all the functions in the file? I could wrap them in a class and then use > attributes, but

Re: Get a list of functions in a file

2008-12-29 Thread Gabriel Genellina
En Mon, 29 Dec 2008 05:26:52 -0200, member Basu escribió: I'm putting some utility functions in a file and then building a simple shell interface to them. Is their some way I can automatically get a list of all the functions in the file? I could wrap them in a class and then use attributes,

Re: Read-Write Lock vs primitive Lock()

2008-12-29 Thread Gabriel Genellina
En Mon, 29 Dec 2008 05:56:10 -0200, k3xji escribió: I am trying to see on which situations does the Read-Write Lock performs better on primitive Lock() itself. Below is the code I am using to test the performance: import threading import locks import time class mylock(object): (I'm not conv

Re: "return" in def

2008-12-29 Thread John Machin
On Dec 29, 8:26 pm, Bruno Desthuilliers wrote: > John Machin a écrit : > > > > > On Dec 29, 7:06 am, Roger wrote: > >>> Curious. When I see a bare return, the first thing I think is that the > >>> author forgot to include the return value and that it's a bug. > >>> The second thing I think is tha

Re: game engine (as in rules not graphics)

2008-12-29 Thread Martin
Hi, 2008/12/29 Phil Runciman : > See: Chris Moss, Prolog++: The Power of Object-Oriented and Logic Programming > (ISBN 0201565072) > > This book is a pretty handy intro to an OO version Prolog produced by Logic > Programming Associates. > From: Aaron Brady [mailto:castiro...@gmail.com] > Sent:

Re: Any equivalent to Ruby's 'hpricot' html/xpath/css selector package?

2008-12-29 Thread Bruno Desthuilliers
Kenneth McDonald a écrit : Ruby has a package called 'hpricot' which can perform limited xpath queries, ElementTree ? (it's in the stdlib now) and CSS selector queries. PyQuery ? http://pypi.python.org/pypi/pyquery However, what makes it really useful is that it does a good job of handlin

poblem regarding opening a html file

2008-12-29 Thread Sibtey Mehdi
Hi I have a GUI application (wxpython) that calls another GUI Application. I m using os.system (cmd) to launch The second GUI, in the second GUI I m trying to open the html file using the os.startfile (filename) function but It takes lots of time to open the html file. If I am run

Re: Read-Write Lock vs primitive Lock()

2008-12-29 Thread k3xji
On 29 Aralık, 11:52, "Gabriel Genellina" wrote: > En Mon, 29 Dec 2008 05:56:10 -0200, k3xji escribió: > > > I  am trying to see on which situations does the Read-Write Lock > > performs better on primitive Lock() itself. Below is the code I am > > using to test the performance: > > import threadi

Re: Windows SSH (remote execution of commands) - Python Automation

2008-12-29 Thread Tino Wildenhain
Hi, Narasimhan Raghu-RBQG84 wrote: Hi experts, I am looking for some information on how to automate remote login to a UNIX machine using ssh from a windows XP box. Possible way: 1. Use putty (or any other ssh client from windows XP). -- Can be automated with command line parameters. The

Unicode encoding - ignoring errors

2008-12-29 Thread Michal Ludvig
Hi, in my script I have sys.stdout and sys.stderr redefined to output unicode strings in the current system encoding: encoding = locale.getpreferredencoding() sys.stdout = codecs.getwriter(encoding)(sys.stdout) However on some systems the locale doesn't let all the unicode chars

AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)

2008-12-29 Thread Tzury Bar Yochay
$ ~/devel/ice/snoip/freespeech$ python Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import logging >>> logging.DatagramHandler Traceback (most recent call last): File "", line 1, in AttributeErro

Re: Unicode encoding - ignoring errors

2008-12-29 Thread Chris Rebert
On Mon, Dec 29, 2008 at 4:06 AM, Michal Ludvig wrote: > Hi, > > in my script I have sys.stdout and sys.stderr redefined to output > unicode strings in the current system encoding: > >encoding = locale.getpreferredencoding() >sys.stdout = codecs.getwriter(encoding)(sys.stdout) > > H

Re: AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)

2008-12-29 Thread Chris Rebert
On Mon, Dec 29, 2008 at 4:08 AM, Tzury Bar Yochay wrote: > $ ~/devel/ice/snoip/freespeech$ python > Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) > [GCC 4.3.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import logging logging.DatagramHandler > T

Re: poblem regarding opening a html file

2008-12-29 Thread Hendrik van Rooyen
Sibtey Mehdi wrote: >Hi >I have a GUI application (wxpython) that calls another GUI Application. I m using os.system (cmd) >to launch >The second GUI, in the second GUI I m trying to open the html file using the os.startfile (filename) function >but >It takes lots of time to open the

Re: AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)

2008-12-29 Thread Bruno Desthuilliers
Tzury Bar Yochay a écrit : $ ~/devel/ice/snoip/freespeech$ python Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. import logging logging.DatagramHandler Traceback (most recent call last): File "", li

Re: "return" in def

2008-12-29 Thread Bruno Desthuilliers
John Machin a écrit : On Dec 29, 8:26 pm, Bruno Desthuilliers wrote: John Machin a écrit : (snip) Please don't. Follow MRAB's advice, with the corollary that a generator is forced by the compiler to be a "procedure" in MRAB's terminology. I fail to see any *practical* difference between MRAB

Re: multiply each element of a list by a number

2008-12-29 Thread skip
> "Colin" == Colin J Williams writes: Colin> s...@pobox.com wrote: >> For extremely short lists, but not for much else: >> >> % for n in 1 10 100 1000 1 10 ; do >> > echo "len:" $n >> > echo -n "numpy: " >> > python -m timeit -s 'import numpy ; a =

Re: setup.py installs modules to a wrong place

2008-12-29 Thread Michal Ludvig
Hi Omer, > I'm seeing this on fc8 with a custom built python2.6. Not happening > with any other packages (e.g. boto). Workaround of course was just to > copy the S3 dir to /usr/local/lib/python2.6/site-packages. I've found it. The culprit was a pre-set install prefix in setup.cfg - I can't reme

Re: Unicode encoding - ignoring errors

2008-12-29 Thread Michal Ludvig
Chris Rebert wrote: > On Mon, Dec 29, 2008 at 4:06 AM, Michal Ludvig wrote: >> Hi, >> >> in my script I have sys.stdout and sys.stderr redefined to output >> unicode strings in the current system encoding: >> >>encoding = locale.getpreferredencoding() >>sys.stdout = codecs.getwrite

Re: AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)

2008-12-29 Thread John Machin
On Dec 29, 11:08 pm, Tzury Bar Yochay wrote: > $ ~/devel/ice/snoip/freespeech$ python > Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49) > [GCC 4.3.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > import logging > >>> logging.DatagramHandler > > Traceback

Re: Any equivalent to Ruby's 'hpricot' html/xpath/css selector package?

2008-12-29 Thread Mark Thomas
On Dec 28, 6:22 pm, Kenneth McDonald wrote: > Ruby has a package called 'hpricot' which can perform limited xpath   > queries, and CSS selector queries. However, what makes it really   > useful is that it does a good job of handling the "broken" html that   > is so commonly found on the web. Does

Re: "return" in def

2008-12-29 Thread Aaron Brady
On Dec 28, 11:56 am, Gerard Flanagan wrote: > On Dec 28, 5:19 pm, Roger wrote: > > > Hi Everyone, > [...] > > When I define a method I always include a return statement out of > > habit even if I don't return anything explicitly: > > > def something(): > >         # do something > >         retur

Re: Get a list of functions in a file

2008-12-29 Thread Aaron Brady
On Dec 29, 3:50 am, "Chris Rebert" wrote: > On Sun, Dec 28, 2008 at 11:26 PM, member Basu wrote: > > I'm putting some utility functions in a file and then building a simple > > shell interface to them. Is their some way I can automatically get a list of > > all the functions in the file? I could

Re: How to display Chinese in a list retrieved from database via python

2008-12-29 Thread zxo102
On 12月29日, 下午5时06分, "Mark Tolonen" wrote: > "zxo102" wrote in message > > news:2560a6e0-c103-46d2-aa5a-8604de4d1...@b38g2000prf.googlegroups.com... > > > I have a list in a dictionary and want to insert it into the html > > file. I test it with following scripts of CASE 1, CASE 2 and CASE 3. I >

Re: Read-Write Lock vs primitive Lock()

2008-12-29 Thread Aaron Brady
On Dec 29, 4:17 am, k3xji wrote: > On 29 Aralýk, 11:52, "Gabriel Genellina" > wrote: > > > En Mon, 29 Dec 2008 05:56:10 -0200, k3xji escribió: > snip > > > class wthread(threading.Thread): > > >     def run(self): > > >             try: > > >                 #GLOBAL_LOCK.acquireWrite() > > >    

Re: poblem regarding opening a html file

2008-12-29 Thread Aaron Brady
On Dec 29, 6:10 am, "Hendrik van Rooyen" wrote: > Sibtey Mehdi  wrote: > >Hi > >            I have a GUI application (wxpython) that calls another GUI > > Application. I m using os.system (cmd) >to launch>The second GUI, in the > second GUI I m trying to open the html file using the > > os.startf

Python-URL! - weekly Python news and links (Dec 29)

2008-12-29 Thread Gabriel Genellina
QOTW: "The fundamental economics of software development leads you to open-source software." David Rivas http://www.ddj.com/linux-open-source/212201757 Python 2.5.4 final released (replaces 2.5.3 due to a critical bug) http://groups.google.com/group/comp.lang.python/t/4042c0

multiprocessing vs thread performance

2008-12-29 Thread mk
Hello everyone, After reading http://www.python.org/dev/peps/pep-0371/ I was under impression that performance of multiprocessing package is similar to that of thread / threading. However, to familiarize myself with both packages I wrote my own test of spawning and returning 100,000 empty thr

Re: game engine (as in rules not graphics)

2008-12-29 Thread Aaron Brady
On Dec 29, 4:14 am, Martin wrote: > Hi, > > 2008/12/29 Phil Runciman : > > > See: Chris Moss, Prolog++: The Power of Object-Oriented and Logic > > Programming (ISBN 0201565072) > > > This book is a pretty handy intro to an OO version Prolog produced by Logic > > Programming Associates. > > From:

Re: multiprocessing vs thread performance

2008-12-29 Thread janislaw
On 29 Gru, 15:52, mk wrote: > Hello everyone, > > After readinghttp://www.python.org/dev/peps/pep-0371/I was under > impression that performance of multiprocessing package is similar to > that of thread / threading. However, to familiarize myself with both > packages I wrote my own test of spawnin

Re: multiply each element of a list by a number

2008-12-29 Thread Colin J. Williams
s...@pobox.com wrote: "Colin" == Colin J Williams writes: Colin> s...@pobox.com wrote: >> For extremely short lists, but not for much else: >> >> % for n in 1 10 100 1000 1 10 ; do >> > echo "len:" $n >> > echo -n "numpy: " >> > python -m timeit -s

Re: Windows SSH (remote execution of commands) - Python Automation

2008-12-29 Thread Cameron Laird
In article , Tino Wildenhain wrote: . . . >> I am looking for some information on how to automate remote login to a >> UNIX machine using ssh from a windows XP box. >> >> Possible way: >> >> 1. Use putty (or any other ss

Re: multiprocessing vs thread performance

2008-12-29 Thread mk
janislaw wrote: Ah, so there are 100 processes at time. 200secs still don't sound strange. I ran the PEP 371 code on my system (Linux) on Python 2.6.1: Linux SLES (9.156.44.174) [15:18] root ~/tmp/src # ./run_benchmarks.py empty_func.py Importing empty_func Starting tests ... non_threaded

Re: multiprocessing vs thread performance

2008-12-29 Thread Christian Heimes
mk wrote: > Am I doing smth wrong in code below? Or do I have to use > multiprocessing.Pool to get any decent results? You have missed an important point. A well designed application does neither create so many threads nor processes. The creation of a thread or forking of a process is an expensive

Re: multiply each element of a list by a number

2008-12-29 Thread skip
Colin> That's interesting but that's not the Colin> way timeit is documented for Python 2.5: Colin> timeit( [number=100]) That's how it works when invoked as a main program using -m. Colin> In spite of the fact that your own data doesn't support the Colin> assertion?

Re: I always wonder ...

2008-12-29 Thread Hyuga
On Dec 22, 1:51 pm, Grant Edwards wrote: > On 2008-12-22, s...@pobox.com wrote: > > > ... shouldn't people who spend all their time trolling be > > doing something else: studying, working, writing patches which > > solve the problems they perceive to exist in the troll > > subject? > > I think yo

Re: multiprocessing vs thread performance

2008-12-29 Thread mk
Christian Heimes wrote: mk wrote: Am I doing smth wrong in code below? Or do I have to use multiprocessing.Pool to get any decent results? You have missed an important point. A well designed application does neither create so many threads nor processes. Except I was not developing "well des

Re: multiprocessing vs thread performance

2008-12-29 Thread Roy Smith
In article , Christian Heimes wrote: > You have missed an important point. A well designed application does > neither create so many threads nor processes. The creation of a thread > or forking of a process is an expensive operation. You should use a pool > of threads or processes. It's worth n

Re: multiprocessing vs thread performance

2008-12-29 Thread Aaron Brady
On Dec 29, 8:52 am, mk wrote: > Hello everyone, > > After readinghttp://www.python.org/dev/peps/pep-0371/I was under > impression that performance of multiprocessing package is similar to > that of thread / threading. However, to familiarize myself with both > packages I wrote my own test of spawn

Re: why cannot assign to function call

2008-12-29 Thread anthony . tolle
On Dec 29, 1:01 am, scsoce wrote: > I have a function return a reference, and want to assign to the > reference, simply like this: >  >>def f(a) >           return a >      b = 0 >     * f( b ) = 1* > but the last line will be refused as "can't assign to function call". > In my thought , the assig

Re: math module for Decimals

2008-12-29 Thread Raymond L. Buvel
Since the interest is more in extended precision than in decimal representation, there is another module that may be of interest. http://calcrpnpy.sourceforge.net/clnum.html It interfaces to the Class Library for Numbers (CLN) library to provide both arbitrary precision floating point and comp

Re: why cannot assign to function call

2008-12-29 Thread Aaron Brady
On Dec 29, 12:01 am, scsoce wrote: > I have a function return a reference, and want to assign to the > reference, simply like this: >  >>def f(a) >           return a >      b = 0 >     * f( b ) = 1* > but the last line will be refused as "can't assign to function call". > In my thought , the assi

Re: Windows SSH (remote execution of commands) - Python Automation

2008-12-29 Thread Robin Becker
Narasimhan Raghu-RBQG84 wrote: Hi experts, I am looking for some information on how to automate remote login to a UNIX machine using ssh from a windows XP box. Possible way: 1. Use putty (or any other ssh client from windows XP). -- Can be automated with command line parameters. The probl

Re: HTML Correctness and Validators

2008-12-29 Thread Aaron Gray
"Xah Lee" wrote in message news:2fb289be-00b3-440a-b153-ca88f0ba1...@d42g2000prb.googlegroups.com... >recently i wrote a blog essay about html correctness and html >validators, with relations to the programing lang communities. I hope >programing lang fans will take more consideration on the corr

Re: math module for Decimals

2008-12-29 Thread Steve Holden
Raymond L. Buvel wrote: > Since the interest is more in extended precision than in decimal > representation, there is another module that may be of interest. > > http://calcrpnpy.sourceforge.net/clnum.html > > It interfaces to the Class Library for Numbers (CLN) library to provide > both arbitrar

Re: multiprocessing vs thread performance

2008-12-29 Thread Jarkko Torppa
On 2008-12-29, mk wrote: > janislaw wrote: > >> Ah, so there are 100 processes at time. 200secs still don't sound >> strange. > > I ran the PEP 371 code on my system (Linux) on Python 2.6.1: > > Linux SLES (9.156.44.174) [15:18] root ~/tmp/src # ./run_benchmarks.py > empty_func.py > > Importing e

Re: 2to3 used in the Shootout

2008-12-29 Thread pruebauno
On Dec 23, 5:21 pm, Isaac Gouy wrote: > On Dec 23, 11:51 am, bearophileh...@lycos.com wrote: > > > They have translated the Python benchmarks of the Shootout site from > > Py2 to Py3 using 2to3: > > >http://shootout.alioth.debian.org/u32/benchmark.php?test=all〈=pyt... > > So please re-write those

Re: math module for Decimals

2008-12-29 Thread rlbuvel
On Dec 29, 10:22 am, Steve Holden wrote: > Raymond L. Buvel wrote: > > Since the interest is more in extended precision than in decimal > > representation, there is another module that may be of interest. > > >http://calcrpnpy.sourceforge.net/clnum.html > > > It interfaces to the Class Library for

Python module import loop issue

2008-12-29 Thread Kottiyath
This might not be pure python question. Sorry about that. I couldnt think of any other place to post the same. I am creating a _medium_complex_ application, and I am facing issues with creating the proper module structure. This is my first application and since this is a run-of-the-mill applicatio

Re: multiprocessing vs thread performance

2008-12-29 Thread mk
Jarkko Torppa wrote: On the PEP371 it says "All benchmarks were run using the following: Python 2.5.2 compiled on Gentoo Linux (kernel 2.6.18.6)" Right... I overlooked that. My tests I quoted above were done on SLES 10, kernel 2.6.5. With python2.5 and pyProcessing-0.52 iTaulu:src torppa$

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread walterbyrd
On Dec 21, 12:28 pm, Bruno Desthuilliers wrote: > > I can see where the new formatting might be helpful in some cases. > > But, I am not sure it's worth the cost. > > Err... _Which_ cost exactly ? Loss of backward compatibility, mainly. -- http://mail.python.org/mailman/listinfo/python-list

SQL, lite lite lite

2008-12-29 Thread Aaron Brady
Hi all, About a year ago, I posted an idea I was having about thread synchronization to the newsgroup. However, I did not explain it well, and I really erred on the side of brevity. (After some finagling, Mr. Bieber and I decided it wasn't exactly anything groundbreaking.) But I think the brevi

Re: SQL, lite lite lite

2008-12-29 Thread Philip Semanchuk
On Dec 29, 2008, at 1:06 PM, Aaron Brady wrote: I don't think relational data can be read and written very easily in Python. There are some options, such as 'sqllite3', but they are not easy. 'sqllite3' statements are valid SQL expressions, which afford the entire power of SQL, but contrary t

Re: SQL, lite lite lite

2008-12-29 Thread Ned Deily
In article , Philip Semanchuk wrote: > On Dec 29, 2008, at 1:06 PM, Aaron Brady wrote: > > I don't think relational data can be read and written very easily in > > Python. There are some options, such as 'sqllite3', but they are not > > easy. 'sqllite3' statements are valid SQL expressions, whi

Re: why cannot assign to function call

2008-12-29 Thread Scott David Daniels
John Machin wrote: On Dec 29, 5:01 pm, scsoce wrote: I have a function return a reference, Stop right there. You don't have (and can't have, in Python) a function which returns a reference that acts like a pointer in C or C+ +. Please tell us what manual, tutorial, book, blog or Usenet postin

Re: SQL, lite lite lite

2008-12-29 Thread Bruno Desthuilliers
Aaron Brady a écrit : Hi all, (snip) > I don't think relational data can be read and written very easily in Python. Did you try SQLAlchemy or Django's ORM ? There are some options, such as 'sqllite3', but they are not easy. 'sqllite3' statements are valid SQL expressions, which afford th

flushing of print statements ending with comma

2008-12-29 Thread Grebekel
I have recently noticed that print statements ending with a comma are not immediately flushed. This is evident when such statement is executed before a very long operation (a big loop for instance). Example: print 'Take a walk, because this will take a while...', i = 0 while i < 10**10: i +=

Re: How to display Chinese in a list retrieved from database via python

2008-12-29 Thread Mark Tolonen
"zxo102" wrote in message news:7e38e76a-d5ee-41d9-9ed5-73a2e2993...@w1g2000prm.googlegroups.com... On 12月29日, 下午5时06分, "Mark Tolonen" wrote: "zxo102" wrote in message news:2560a6e0-c103-46d2-aa5a-8604de4d1...@b38g2000prf.googlegroups.com... [snip] That said, learn to use Unicode string

Re: Get a list of functions in a file

2008-12-29 Thread Terry Reedy
member Basu wrote: I'm putting some utility functions in a file and then building a simple shell interface to them. Is their some way I can automatically get a list of all the functions in the file? I could wrap them in a class and then use attributes, but I'd rather leave them as simple functi

Re: SQL, lite lite lite

2008-12-29 Thread Pierre Quentel
On 29 déc, 19:06, Aaron Brady wrote: > Hi all, > > About a year ago, I posted an idea I was having about thread > synchronization to the newsgroup.  However, I did not explain it well, > and I really erred on the side of brevity.  (After some finagling, Mr. > Bieber and I decided it wasn't exactly

Re: why cannot assign to function call

2008-12-29 Thread Aaron Brady
On Dec 29, 1:05 pm, Scott David Daniels wrote: > John Machin wrote: > > On Dec 29, 5:01 pm, scsoce wrote: > >> I have a function return a reference, > > > Stop right there. You don't have (and can't have, in Python) a > > function which returns a reference that acts like a pointer in C or C+ > >

Re: why cannot assign to function call

2008-12-29 Thread Terry Reedy
John Machin wrote: On Dec 29, 5:01 pm, scsoce wrote: I have a function return a reference, Stop right there. You don't have (and can't have, in Python) a function which returns a reference that acts like a pointer in C or C+ +. Please tell us what manual, tutorial, book, blog or Usenet postin

Re: math module for Decimals

2008-12-29 Thread Tino Wildenhain
jerry.carl...@gmail.com wrote: ... It's really just the goniometric functions that I am missing most at the moment, so maybe I can figure it out with help of what you said plus the already existing imperfect modules. Meantime maybe this discussion will caught Guido's eye... ;-) And btw I do expec

Symposium “Image Processing and Analysis” within the ICCES'09 Thailand – Last Announce & Call for Papers

2008-12-29 Thread tava...@fe.up.pt
(Our apologies for cross-posting. We appreciate if you kindly distribute this information by your co- workers and colleagues.) *** Symposium “Image Processing and Analysis” Int. Conf. on Computatio

tkInter constraining the width only

2008-12-29 Thread akineko
Hello everyone, I'm writing a Tkinter program and trying to constraint the window size. I want to set the minimum of the width and the height and the maximum of the width, but not the height. I can use minsize(width=min_width, height=min_height) from Wm method to limit the minimum sizes. Similarly

Re: multiprocessing vs thread performance

2008-12-29 Thread Hrvoje Niksic
Roy Smith writes: > In article , > Christian Heimes wrote: > >> You have missed an important point. A well designed application does >> neither create so many threads nor processes. The creation of a thread >> or forking of a process is an expensive operation. You should use a pool >> of thread

Re: tkInter constraining the width only

2008-12-29 Thread Roger
On Dec 29, 3:23 pm, akineko wrote: > Hello everyone, > > I'm writing a Tkinter program and trying to constraint the window > size. > I want to set the minimum of the width and the height and the maximum > of the width, but not the height. You want to set the max height to 0. I know this is count

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread Luis M . González
On 19 dic, 13:01, walterbyrd wrote: > I have not worked with Python enough to really know. But, it seems to > me that more I look at python 3.0, the more I wonder if it isn't a > step backwards. > > To me, it seems that this: > > print "%s=%d" % ('this',99) > > Is much easier, and faster, to type,

Re: Python module import loop issue

2008-12-29 Thread Carl Banks
On Dec 29, 10:51 am, Kottiyath wrote: > This might not be  pure python question. Sorry about that. I couldnt > think of any other place to post the same. > I am creating a _medium_complex_ application, and I am facing issues > with creating the proper module structure. > This is my first applicati

Re: SQL, lite lite lite

2008-12-29 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aaron Brady wrote: > Python. There are some options, such as 'sqllite3', but they are not > easy. 'sqllite3' statements are valid SQL expressions, which afford > the entire power of SQL, but contrary to its name, it is not that > 'lite'. Have you c

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread ajaksu
On Dec 29, 7:37 pm, Luis M. González wrote: > I still can't get used to add the parenthesis to "print", and this is > the only thing I don't like, but I'm sure there's a good reason for > this change... I should know better than to post such an awful hack: __past__.py: from sys import excepthoo

Re: flushing of print statements ending with comma

2008-12-29 Thread Cameron Simpson
On 29Dec2008 11:11, Grebekel wrote: | I have recently noticed that print statements ending with a comma are | not immediately flushed. I will warn you that neither are the more common uncommaed print statements, except on a terminal. | [...] Example: | | print 'Take a walk, because this will ta

Re: multiprocessing vs thread performance

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 12:52 AM, mk wrote: > Hello everyone, > > After reading http://www.python.org/dev/peps/pep-0371/ I was under > impression that performance of multiprocessing package is similar to that of > thread / threading. However, to familiarize myself with both packages I > wrote my o

Re: why cannot assign to function call

2008-12-29 Thread Miles
On Mon, Dec 29, 2008 at 1:01 AM, scsoce wrote: > I have a function return a reference, and want to assign to the reference, > simply like this: >>>def f(a) > return a >b = 0 > * f( b ) = 1* > but the last line will be refused as "can't assign to function call". > In my thought , the

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread Steven D'Aprano
On Mon, 29 Dec 2008 09:50:14 -0800, walterbyrd wrote: > On Dec 21, 12:28 pm, Bruno Desthuilliers > wrote: > >> > I can see where the new formatting might be helpful in some cases. >> > But, I am not sure it's worth the cost. >> >> Err... _Which_ cost exactly ? > > Loss of backward compatibility

Of console I/O, characters, strings & dogs

2008-12-29 Thread David
I am trying getch() from msvcrt. The following module has been run with 3 different concatination statements and none yield a satisfactory result.Python 3.0 # script12 import msvcrt shortstr1 = 'd' + 'o' + 'g' print(shortstr1) char1 = msvcrt.getch() char2 = msvcrt.getch() char3 = msvcrt.getch

get method

2008-12-29 Thread Ross
I am teaching myself Python by going through Allen Downing's "Think Python." I have come across what should be a simple exercise, but I am not getting the correct answer. Here's the exercise: Given: def histogram(s): d = dict() for c in s: if c not in d: d[c] = 1

Re: "return" in def

2008-12-29 Thread Steven D'Aprano
On Mon, 29 Dec 2008 05:31:17 -0800, Aaron Brady wrote: > One style of coding I heard about once only permits returns at the end > of a function. It claims it makes it easier to see the function as a > mathematical object. That's silly. You treat the function as a black box: input comes in, and

Re: get method

2008-12-29 Thread Steven D'Aprano
On Mon, 29 Dec 2008 17:00:31 -0800, Ross wrote: > Here's my code: > > def histogram(s): > d = dict() > for c in s: > d[c]= d.get(c,0) > return d > > This code returns a dictionary of all the letters to any string s I give > it but each corresponding value is incor

Re: get method

2008-12-29 Thread Scott David Daniels
Ross wrote: ... Use get to write histogram more concisely. You should be able to eliminate the if statement. def histogram(s): d = dict() for c in s: d[c]= d.get(c,0) return d This code returns a dictionary of all the letters to any string s I give it but

Python in C

2008-12-29 Thread thmpsn . m . k
I've just downloaded Python's mainstream implementation (CPython), which is written in C. Not to my surprise, I feel like I'm looking at unstructured spaghetti, and I'm having trouble figuring out how it all works together. (Please bear with me; I'm just going through the usual frustration that any

Re: Python in C

2008-12-29 Thread Chris Rebert
On Mon, Dec 29, 2008 at 5:22 PM, wrote: > 2. Have there been any suggestions in the past to rewrite Python's > mainstream implementation in C++ (or why wasn't it done this way from > the beginning)? I'm not a CPython dev (I bet one will pipe in), but I would speculate it's because C++ is so muc

Re: get method

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:00 AM, Ross wrote: > I am teaching myself Python by going through Allen Downing's "Think > Python." I have come across what should be a simple exercise, but I am > not getting the correct answer. Here's the exercise: > > Given: > > def histogram(s): >d = dict() >

Re: multiprocessing vs thread performance

2008-12-29 Thread Aaron Brady
On Dec 29, 6:05 pm, "James Mills" wrote: > On Tue, Dec 30, 2008 at 12:52 AM, mk wrote: > > Hello everyone, > > > After readinghttp://www.python.org/dev/peps/pep-0371/I was under > > impression that performance of multiprocessing package is similar to that of > > thread / threading. However, to fa

Re: get method

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:32 AM, James Mills wrote: > Ross, the others have informed you that you are not > actually incrementing the count. I'll assume you've > fixed your function now :) ... I want to show you a far > simpler way to do this which takes advantage of > Python's list comprehension

Re: get method

2008-12-29 Thread Ross
On Dec 29, 8:07 pm, Scott David Daniels wrote: > Ross wrote: > > ... Use get to write histogram more concisely. You should be able to > > eliminate the if statement. > > > def histogram(s): > >    d = dict() > >    for c in s: > >            d[c]= d.get(c,0) > >    return d > > > This code returns

Re: multiprocessing vs thread performance

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:34 AM, Aaron Brady wrote: > The OP may be interested in Erlang, which Wikipedia (end-all, be-all) > claims is a 'distribution oriented language'. I would suggest to the OP that he take a look at circuits (1) an event framework with a focus on component architectures and

Re: get method

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:38 AM, Ross wrote: > I realize the code isn't counting, but how am I to do this without > using an if statement as the problem instructs? I just gave you a hint :) cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Of console I/O, characters, strings & dogs

2008-12-29 Thread Steven D'Aprano
On Mon, 29 Dec 2008 18:53:45 -0600, David Lemper wrote: > I am trying getch() from msvcrt. The following module has been run with > 3 different concatination statements and none yield a satisfactory > result.Python 3.0 Your first problem is that you've run into the future of computing: str

Re: Python in C

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:32 AM, Chris Rebert wrote: > On Mon, Dec 29, 2008 at 5:22 PM, wrote: > >> 2. Have there been any suggestions in the past to rewrite Python's >> mainstream implementation in C++ (or why wasn't it done this way from >> the beginning)? > > I'm not a CPython dev (I bet on

Re: why cannot assign to function call

2008-12-29 Thread Aaron Brady
On Dec 29, 6:06 pm, Miles wrote: > On Mon, Dec 29, 2008 at 1:01 AM, scsoce wrote: > > I have a function return a reference, and want to assign to the reference, > > simply like this: > >>>def f(a) > >         return a > >    b = 0 > >   * f( b ) = 1* > > but the last line will be refused as "can'

Re: get method

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:43 AM, James Mills wrote: > On Tue, Dec 30, 2008 at 11:38 AM, Ross wrote: >> I realize the code isn't counting, but how am I to do this without >> using an if statement as the problem instructs? > > I just gave you a hint :) Ross: This exercise is a simple exercise de

Re: Python in C

2008-12-29 Thread Paul Rubin
thmpsn@gmail.com writes: > 1. Can anyone explain to me what kind of program structuring technique > (which paradigm, etc) CPython uses? How do modules interact together? > What conventions does it use? There are a bunch of docs about this, you could read them. The program is written about the

Re: get method

2008-12-29 Thread Steven D'Aprano
On Mon, 29 Dec 2008 17:38:36 -0800, Ross wrote: > On Dec 29, 8:07 pm, Scott David Daniels wrote: >> Ross wrote: >> > ... Use get to write histogram more concisely. You should be able to >> > eliminate the if statement. >> >> > def histogram(s): >> >    d = dict() >> >    for c in s: >> >        

  1   2   >