Re: Can Parallel Python run on a muti-CPU server ?

2007-02-07 Thread Nick Vatamaniuc
>From the www.parallelpython.com , the 'Features' section: Features: *Parallel execution of python code on SMP and clusters --- PP uses processes, and thus it will take advantage of multiple cores for a CPU bound task. -Nick On Feb 6

Re: sgmllib bug in Python 2.5, works in 2.4.

2007-02-07 Thread John Nagle
John Nagle wrote: > (Was prevously posted as a followup to something else by accident.) > >I'm running a website page through BeautifulSoup. It parses OK > with Python 2.4, but Python 2.5 fails with an exception: > > Traceback (most recent call last): >File "./sitetruth/InfoSitePage.py",

Re: How to prevent from race conditions to share data between many process and thread in python

2007-02-07 Thread Laurent Pointal
mars a écrit : > I use TurboGears to do some web service. TurboGears use cherrypy. When > web browser access this site, the cherrypy will call my python > program. So my program looks like a lib. When web browser access the > site, the http server will fock a process or gerenate a thread. I need >

Getting a class name from within main

2007-02-07 Thread bg_ie
Hi, Lets say I have the following class - class MyClass: def __init__(self): print (__name__.split("."))[-1] if __name__ == '__main__': MyClassName = "MyClass" I can print the name of the class from within the class scope as seen above in the init, but is there a

Re: Python compiled on Windows

2007-02-07 Thread Duncan Booth
Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: >>Yes, people have compiled Python with gcc on windows. I believe it is >>slightly slower than the standard release, but I would guess that may >>depend on the exact versions of gcc/msc you choose to compare, and the >>exact compiler options you choos

Re: Getting a class name from within main

2007-02-07 Thread Robin Becker
[EMAIL PROTECTED] wrote: > Hi, > > Lets say I have the following class - > > class MyClass: > def __init__(self): > print (__name__.split("."))[-1] > > if __name__ == '__main__': > MyClassName = "MyClass" > > I can print the name of the class from within the class scop

Re: Getting a class name from within main

2007-02-07 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, bg_ie wrote: > class MyClass: > def __init__(self): > print (__name__.split("."))[-1] > > if __name__ == '__main__': > MyClassName = "MyClass" > > I can print the name of the class from within the class scope as seen > above in the init, but is t

Re: Python compiled on Windows

2007-02-07 Thread Franz Steinhaeusler
On 7 Feb 2007 09:44:32 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: > >>>Yes, people have compiled Python with gcc on windows. I believe it is >>>slightly slower than the standard release, but I would guess that may >>>depend on the exact versions of

Re: Watch folder for new file and execute extern program

2007-02-07 Thread Michael Bo
> BTW-It helps us out here if you let us know what platform you > are running on (e.g. Windows, Linux, Mac, etc.). > > -Larry Sorry... I'm running on windows XP. - Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: huge amounts of pure Python code broken by Python 2.5?

2007-02-07 Thread Robin Becker
[EMAIL PROTECTED] wrote: > John> MySQLdb isn't fully supported for Python 2.5 yet, and there's no > John> tested Windows executable available, although there's an untested > John> version from a World of Warcraft guild available. > > As Andy Dustman has pointed out a number of times, h

Built-in datatypes speed

2007-02-07 Thread Maël Benjamin Mettler
Hello Python-List I hope somebody can help me with this. I spent some time googling for an answer, but due to the nature of the problem lots of unrelevant stuff shows up. Anyway, I reimplemented parts of TigerSearch ( http://www.ims.uni-stuttgart.de/projekte/TIGER/TIGERSearch/ ) in Python. I am c

Re: division by 7 efficiently ???

2007-02-07 Thread Roel Schroeven
[EMAIL PROTECTED] schreef: > On Feb 6, 4:54 pm, "John Machin" <[EMAIL PROTECTED]> wrote: >> Recursive? Bzzzt! >> Might it not be better to halve the interval at each iteration instead >> of calling a random number function? mid = (lo + hi) >> 1 looks >> permitted and cheap to me. Also you don't run

Re: division by 7 efficiently ???

2007-02-07 Thread Roel Schroeven
Roel Schroeven schreef: > [EMAIL PROTECTED] schreef: >> I had considered this, but to halve, you need to divide by 2. Using >> random, while potentially increasing the number of iterations, removes >> the dependency of language tricks and division. > > It's possible to use Fibonacci numbers instea

Vim search under cursor

2007-02-07 Thread [EMAIL PROTECTED]
Hi, I am using gvim to edit python source files. When I press "*" or "#", I would want to search for the attribute name under the cursor and not the entire string. For example, If I have os.error and pressing * on top of error searches for os.error rather than error. How to set this, any Idea? th

Re: Graphs, bar charts, etc

2007-02-07 Thread [EMAIL PROTECTED]
On Feb 7, 4:46 am, "Joshua J. Kugler" <[EMAIL PROTECTED]> wrote: > Jan Danielsson wrote: > > Hello all, > > >I have some data in a postgresql table which I view through a web > > interface (the web interface is written in python -- using mod_python > > under apache 2.2). Now I would like to rep

mplayer bug or python bug?

2007-02-07 Thread Marco
The following code is my test program for control mplayer. in movies/ there are about 20 movies, the code plays them in circle, but mplayer will crash silently after a circle, the "sliently" means I can handle popen2 without except, but no movie. I have no idea about it... Can you help me? class

Re: Python editor

2007-02-07 Thread stani . vsvv
On Feb 6, 11:01 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > BBands wrote: > > No, no, no, this is not an invitation to the editor wars. > > I have been using José Cláudio Faria's superb > > Tinn-R,http://www.sciviews.org/Tinn-R/, > > with the R language,http://www.r-project.org/. This editor al

outlook bar

2007-02-07 Thread yvesd
Hello, I'm trying to make an outlook bar like in python but i'm not at all familiar with ms-outlook and i'm a bit too weak and in early stage of python learning. Has somebody already made or seen the code IN TKINTER(/)PMW for a bar like that ? Thanks very much for all help. Yves -- http://mail.

ps tkinter

2007-02-07 Thread yvesd
For a bit more help about my previous message (outlook bar) does anybody know how to reparent or change a widget(button)'s owner in tkinter ? here's my code that doesn't work : def inverse(self): if (self.texte=="top"): self.texte="bottom" btn = self

Re: Vim search under cursor

2007-02-07 Thread Neil Cerutti
On 2007-02-07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, I am using gvim to edit python source files. When I press "*" or > "#", I would want to search for the attribute name under the cursor > and not the entire string. > For example, If I have os.error and pressing * on top of error > s

Re: Vim search under cursor

2007-02-07 Thread Wojciech Muła
[EMAIL PROTECTED] wrote: > Hi, I am using gvim to edit python source files. When I press "*" or > "#", I would want to search for the attribute name under the cursor > and not the entire string. > For example, If I have os.error and pressing * on top of error > searches for os.error rather than er

Re: Python editor

2007-02-07 Thread Stef Mientki
[EMAIL PROTECTED] wrote: > On Feb 6, 11:01 pm, Stef Mientki <[EMAIL PROTECTED]> > wrote: >> BBands wrote: >>> No, no, no, this is not an invitation to the editor wars. > >>> I have been using José Cláudio Faria's superb >>> Tinn-R,http://www.sciviews.org/Tinn-R/, >>> with the R language,http://ww

Re: Python editor

2007-02-07 Thread limodou
Maybe you can try ulipad. -- I like python! UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I use __setitem__ method of dict object?

2007-02-07 Thread jeremito
On Feb 6, 5:10 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > jeremito a écrit : > > On Feb 6, 2:36 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > > > > (snip) > > >>Here's an alternative implementation, so you get the idea. > >> > >>class Xs(dict): > > oops ! I meant: > class

Re: ps tkinter

2007-02-07 Thread Eric Brunel
On Wed, 07 Feb 2007 13:40:33 +0100, yvesd <[EMAIL PROTECTED]> wrote: > For a bit more help about my previous message (outlook bar) > does anybody know how to reparent or change a widget(button)'s owner > in tkinter ? > here's my code that doesn't work : > def inverse(self): > if (self.

Re: python for web programming

2007-02-07 Thread JStoneGT
Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Parallel Python run on a muti-CPU server ?

2007-02-07 Thread Martin P. Hellwig
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: >> Hi all, >> >> I'm interested in Parallel Python and I learned from the website of >> Parallel Python >> that it can run on SMP and clusters. But can it run on a our muti-CPU >> server ? >> We are running an origin3800 server with 128 CPUs. >>

http://www.freeanything4you.com/

2007-02-07 Thread Janak
http://www.freeanything4you.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: outlook bar

2007-02-07 Thread Diez B. Roggisch
yvesd wrote: > Hello, > I'm trying to make an outlook bar like in python but i'm not at all > familiar with ms-outlook and i'm > a bit too weak and in early stage of python learning. > Has somebody already made or seen the code IN TKINTER(/)PMW for a bar > like that ? I've not done such a thing,

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Thomas Heller
Martin v. Löwis schrieb: > I'm happy to announce partial 1.0; a module to implement > partial classes in Python. It is available from > > http://cheeseshop.python.org/pypi/partial/1.0 > > A partial class is a fragment of a class definition; > partial classes allow to spread the definition of > a

Re: Graphs, bar charts, etc

2007-02-07 Thread Sean Davis
On Feb 6, 7:57 am, Jan Danielsson <[EMAIL PROTECTED]> wrote: > Hello all, > >I have some data in a postgresql table which I view through a web > interface (the web interface is written in python -- using mod_python > under apache 2.2). Now I would like to represent this data as graphs, > bar ch

Group Membership in Active Directory Query

2007-02-07 Thread kooch54
I am trying to write a script to simply query the group members in an active directory group. I need to use LDAP to make sure I capture any global > global group nestings that may occur. I already have a function that uses WinNT provider to capture this info from NT4 or AD domains and it works be

Running Application Within Emacs

2007-02-07 Thread rshepard
My editor is emacs in linux, and I have the python mode enabled. The two menus -- IM-Python and Python -- allow me to navigate within the loaded module and open execute buffers, among other things. But, I don't see a way to run a wxPython application from within the editor as I would from the com

wxPython running other applications or console

2007-02-07 Thread stumblecrab
Is it possible to run another application like vim or a terminal window from within a wxPython frame? -- http://mail.python.org/mailman/listinfo/python-list

Re: Group Membership in Active Directory Query

2007-02-07 Thread kooch54
On Feb 7, 9:22 am, [EMAIL PROTECTED] wrote: > I am trying to write a script to simply query the group members in an > active directory group. I need to use LDAP to make sure I capture any > global > global group nestings that may occur. I already have a > function that uses WinNT provider to capt

Re: How can I use __setitem__ method of dict object?

2007-02-07 Thread jeremito
On Feb 7, 8:28 am, "jeremito" <[EMAIL PROTECTED]> wrote: > On Feb 6, 5:10 pm, Bruno Desthuilliers > > > > <[EMAIL PROTECTED]> wrote: > > jeremito a écrit : > > > On Feb 6, 2:36 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > > > (snip) > > > >>Here's an alternative implementation, so you g

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Carl Banks
On Feb 7, 8:51 am, Thomas Heller <[EMAIL PROTECTED]> wrote: > Martin v. Löwis schrieb: > > > I'm happy to announce partial 1.0; a module to implement > > partial classes in Python. It is available from > > >http://cheeseshop.python.org/pypi/partial/1.0 > > > A partial class is a fragment of a class

python sub interpreter

2007-02-07 Thread Thomas Pollet
Hello, I want to have a python interpreter shell spawn from a python class member function. atm I use exec but I want something more flexible (i.e. syntax checking while typing) E.g.: class blah: def start_shell(self): import sys dbg=self str="" while str != 'exi

Re: Calling J from Python

2007-02-07 Thread Gosi
On Feb 6, 9:08 pm, [EMAIL PROTECTED] wrote: > Gosi: > > > There are a number of graphics examples, utilities and demos you can > > use in J and combine it with Python. > > Some of those graphic examples are very nice, I have seen a big site > filled with complex fractals, chaotic attractors, etc. >

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Carl Banks
On Feb 7, 10:17 am, "Carl Banks" <[EMAIL PROTECTED]> wrote: > On Feb 7, 8:51 am, Thomas Heller <[EMAIL PROTECTED]> wrote: > > > > > Martin v. Löwis schrieb: > > > > I'm happy to announce partial 1.0; a module to implement > > > partial classes in Python. It is available from > > > >http://cheesesho

Re: Calling J from Python

2007-02-07 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Gosi wrote: > I like to use J for many things and I think that combining Python and > J is a hell of a good mixture. I was able to follow this sentence up to and including the word "hell"… :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/list

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Michele Simionato
> Martin v. Löwis schrieb: > > > > > I'm happy to announce partial 1.0; a module to implement > > partial classes in Python. It is available from > > >http://cheeseshop.python.org/pypi/partial/1.0 > > > A partial class is a fragment of a class definition; > > partial classes allow to spread the def

Socket and array

2007-02-07 Thread JStoneGT
Hello, How to send an array via socket to the other end?Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Object type check

2007-02-07 Thread king kikapu
Hi to all, in statically-types languages, let's say C# for example, we use polymorphism through interfaces. So we define an interface I with method M and then a class C that implements I interface and write code for the M method. So, if we have a function that takes a parameter of type I, we know

Re: multithreading concept

2007-02-07 Thread sturlamolden
On Feb 7, 2:53 am, "S.Mohideen" <[EMAIL PROTECTED]> wrote: > Python is praised about - me too. But at one instance it fails. It fails to > behave as a true multi-threaded application. That means utilizing all the > CPUs parallely in the SMP efficiently stays as a dream for a Python > Programmer.

Re: Object type check

2007-02-07 Thread Calvin Spealman
The answer is to do nothing at all. Use the interfaces of the objects that you expect. Treat them like numbers if you expect them to be, or stirngs, or iterables. Call methods and access attributes you expect to be there. If the caller passes sometihng bad, and something doesn't work, they'll find

Re: multithreading concept

2007-02-07 Thread Paul Boddie
On 7 Feb, 02:53, "S.Mohideen" <[EMAIL PROTECTED]> wrote: > > Python is praised about - me too. But at one instance it fails. It fails to > behave as a true multi-threaded application. That means utilizing all the > CPUs parallely in the SMP efficiently stays as a dream for a Python > Programmer. T

(n)curses or tcl/tk?

2007-02-07 Thread magnate
Hi All, Just learning Python - my first new language for about 18 years (I'm not a programmer ...). I'm writing a small utility to manipulate some text files (for the game VGA Planets, if you're interested: http:// www.phost.de). It's currently working, but it looks a bit ugly with raw_input and j

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Carl Banks
On Feb 7, 10:48 am, "Michele Simionato" <[EMAIL PROTECTED]> wrote: > > Martin v. Löwis schrieb: > > > > I'm happy to announce partial 1.0; a module to implement > > > partial classes in Python. It is available from > > > >http://cheeseshop.python.org/pypi/partial/1.0 > > > > A partial class is a fr

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Thomas Heller
Carl Banks schrieb: > On Feb 7, 10:17 am, "Carl Banks" <[EMAIL PROTECTED]> wrote: >> On Feb 7, 8:51 am, Thomas Heller <[EMAIL PROTECTED]> wrote: >> >> >> >> > Martin v. Löwis schrieb: >> >> > > I'm happy to announce partial 1.0; a module to implement >> > > partial classes in Python. It is availabl

Re: Object type check

2007-02-07 Thread Michele Simionato
On Feb 7, 5:17 pm, "king kikapu" <[EMAIL PROTECTED]> wrote: > Hi to all, > > in statically-types languages, let's say C# for example, we use > polymorphism through interfaces. So we define an interface I with > method M and then a class C that implements I interface and write code > for the M metho

Re: Group Membership in Active Directory Query

2007-02-07 Thread Uwe Hoffmann
[EMAIL PROTECTED] schrieb: > ldap_obj = ldap_obj.simple_bind_s('[EMAIL PROTECTED]', > 'password') > > > AttributeError: 'NoneType' object has no attribute 'search_Ext_s' > dummy = ldap_obj.simple_bind_s('[EMAIL PROTECTED]', 'pa

Re: Object type check

2007-02-07 Thread king kikapu
> Dont restrict them to particular types. You would > not restrict them to a particular class in C#. Instead, you define the > interfaces simply by how you use the objects. Of cource i restrict them to particular types! In C# you cannot pass something bad this way because the compiler will just ca

Re: Object type check

2007-02-07 Thread Calvin Spealman
On 7 Feb 2007 08:59:12 -0800, king kikapu <[EMAIL PROTECTED]> wrote: > > Dont restrict them to particular types. You would > > not restrict them to a particular class in C#. Instead, you define the > > interfaces simply by how you use the objects. > > Of cource i restrict them to particular types!

Re: Object type check

2007-02-07 Thread Eduardo \"EdCrypt\" O. Padoan
> Of cource i restrict them to particular types! In C# you cannot pass > something bad > this way because the compiler will just catch it! And you cant pass something 'good' that immitates another object interface (a file-like object for example) > I see what you mean by "duck typing". So you sug

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Ziga Seilnacht
Thomas Heller wrote: > > Do you have a pointer to that post? > I think that he was refering to this post: http://mail.python.org/pipermail/python-list/2006-December/416241.html If you are interested in various implementations there is also this: http://mail.python.org/pipermail/python-list/2006-A

Re: (n)curses or tcl/tk?

2007-02-07 Thread Maël Benjamin Mettler
As far as I know Windows does not support ncurses natively (using CygWin probably changes that). So go with Tkinter. Looks crappy but at least it should run on all major platforms... > Hi All, > > Just learning Python - my first new language for about 18 years (I'm > not a programmer ...). I'm writ

Re: (n)curses or tcl/tk?

2007-02-07 Thread Thomas Pollet
Hi, you could try wxpython and the wxglade toolkit for building gui Regards, Thomas On 7 Feb 2007 08:35:41 -0800, magnate <[EMAIL PROTECTED]> wrote: Hi All, Just learning Python - my first new language for about 18 years (I'm not a programmer ...). I'm writing a small utility to manipulate s

Re: (n)curses or tcl/tk?

2007-02-07 Thread Ido Yehieli
On Feb 7, 5:35 pm, "magnate" <[EMAIL PROTECTED]> wrote: > So my question is, should I go to the trouble of learning how to make > boxes and stuff using tcl/tk, or just go with ncurses as I imagined? If you want to use curses on windows with python you need to install WCurses first. Other then that

Re: multithreading concept

2007-02-07 Thread John Nagle
sturlamolden wrote: > On Feb 7, 2:53 am, "S.Mohideen" <[EMAIL PROTECTED]> > wrote: > This has been discussed to death before. Win32 threads and pthreads > (which is what Python normally uses, depending on the platform) are > designed to stay idle most of the time. They are therefore not a tool > fo

Re: Socket and array

2007-02-07 Thread Sam
On 07/02/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How to send an array via socket to the other end?Thanks. What you want is a serialisation solution - turning objects into a string format, and vice versa. Python provides a system for this in its standard library, in the pickle module. So

what is wrong with my python code?

2007-02-07 Thread Dongsheng Ruan
I got feed back saying" list object is not callable". But I can't figure out what is wrong with my code. A=[3,5,4,9,6,7] l=len(A)-1 for i in range(l): print A(i) -- http://mail.python.org/mailman/listinfo/python-list

Re: Running long script in the background

2007-02-07 Thread Jordan
On Feb 6, 8:26 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to write a python cgi that calls a script over ssh, the > problem is the script takes a very long time to execute so Apache > makes the CGI time out and I never see any output. The script is set > to print a

Re: what is wrong with my python code?

2007-02-07 Thread Paul Rubin
"Dongsheng Ruan" <[EMAIL PROTECTED]> writes: > for i in range(l): > print A(i) Use square brackets, A[i]. Usually we'd write such a loop like this: for x in A: print x -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I use __setitem__ method of dict object?

2007-02-07 Thread Jussi Salmela
jeremito kirjoitti: > On Feb 7, 8:28 am, "jeremito" <[EMAIL PROTECTED]> wrote: >> On Feb 6, 5:10 pm, Bruno Desthuilliers >> >> >> >> <[EMAIL PROTECTED]> wrote: >>> jeremito a écrit : >>> > On Feb 6, 2:36 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >>> (snip) >>> >>Here's an alternative i

Re: what is wrong with my python code?

2007-02-07 Thread Pierre GM
On Wednesday 07 February 2007 12:43:34 Dongsheng Ruan wrote: > I got feed back saying" list object is not callable". But I can't figure > out what is wrong with my code. > for i in range(l): > print A(i) You're calling A, when you want to access one of its elements: use the straight bracket

Why doesn't my heapify work?

2007-02-07 Thread Dongsheng Ruan
I want to turn an Array into a heap, but my code just doesn't work: no change after execution. A=[3,5,4,9,6,7] m=len(A)-1 for i in range(m,1): t=(i-1)/2 if A[i]>A[t]: A[i],A[t]=A[t],A[i] -- http://mail.python.org/mailman/listinfo/python-list

Re: multithreading concept

2007-02-07 Thread Steve Holden
John Nagle wrote: > sturlamolden wrote: >> On Feb 7, 2:53 am, "S.Mohideen" <[EMAIL PROTECTED]> >> wrote: >> This has been discussed to death before. Win32 threads and pthreads >> (which is what Python normally uses, depending on the platform) are >> designed to stay idle most of the time. They are

Re: IOError: [Errno 4] Interrupted system call

2007-02-07 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Marco <[EMAIL PROTECTED]> wrote: > Hello,every one, I meet a question: > > in my old script, I usually use os.popen2() to get info from standard > unix(LinuX) program like ps,ifconfig... > > Now, I write a OO-based programme, I still use os.popen2( check > whethe

Re: Why doesn't my heapify work?

2007-02-07 Thread Diez B. Roggisch
Dongsheng Ruan wrote: > I want to turn an Array into a heap, but my code just doesn't work: no > change after execution. > > A=[3,5,4,9,6,7] > m=len(A)-1 > > > > for i in range(m,1): > t=(i-1)/2 > if A[i]>A[t]: > A[i],A[t]=A[t],A[i] First of all, there is the module heapq that

Suggestions on Starting Python Project on P2P streaming

2007-02-07 Thread Krypto
I am 3 months old to python and I have done some small projects. I want to build a Peer to Peer streaming client ..something like BitTorrent. I know it is daunting but I got to start somewhere. Please come easy on me. What I want in my client program is that client software logs on to some P2P str

Re: Why doesn't my heapify work?

2007-02-07 Thread Ruan
Can't range go from larger to smaller? "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dongsheng Ruan wrote: > >> I want to turn an Array into a heap, but my code just doesn't work: no >> change after execution. >> >> A=[3,5,4,9,6,7] >> m=len(A)-1 >> >> >> >> for

Re: Why doesn't my heapify work?

2007-02-07 Thread Ruan
I found out what is wrong. You must give it a negative step, like range(10,1,-1) But my code is not good enought for heapify. I will try again. "Ruan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can't range go from larger to smaller? > > > "Diez B. Roggisch" <[EMAIL PROTECTE

Re: Why doesn't my heapify work?

2007-02-07 Thread skip
ruan> Can't range go from larger to smaller? Yes. Read the doc: range(...) range([start,] stop[, step]) -> list of integers Return a list containing an arithmetic progression of integers. range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.

Re: multithreading concept

2007-02-07 Thread sturlamolden
On Feb 7, 6:17 pm, John Nagle <[EMAIL PROTECTED]> wrote: > Multithread compute-bound programs on multiple CPUs are > how you get heavy number-crunching work done on multiprocessors. In the scientific community, heavy CPU-bound tasks are either parallelized using MPI and/or written in Fortran

Re: Group Membership in Active Directory Query

2007-02-07 Thread kooch54
On Feb 7, 11:56 am, Uwe Hoffmann <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > ldap_obj = ldap_obj.simple_bind_s('[EMAIL PROTECTED]', > > 'password') > > > AttributeError: 'NoneType' object has no attribute 'search_Ext_s' > > dummy = ldap_obj.simple

distutils: renaming setup.py ok?

2007-02-07 Thread Anastasios Hatzis
I want to distribute Python site-packages. Is it okay to use other setup file names than setup.py, which is mentioned in any place I read in the doc? E.g., setupMySDK.py, setupMyLib.py It seems that it works with distutils at least - but probably doing so has side-effects with other tools which

Re: Why doesn't my heapify work?

2007-02-07 Thread BJörn Lindqvist
You do know about the heapq module? http://docs.python.org/dev/lib/module-heapq.html -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils: renaming setup.py ok?

2007-02-07 Thread Benjamin Niemann
Hello, Anastasios Hatzis wrote: > I want to distribute Python site-packages. Is it okay to use other setup > file names than setup.py, which is mentioned in any place I read in the > doc? > > E.g., setupMySDK.py, setupMyLib.py > > It seems that it works with distutils at least - but probably do

Re: Two mappings inverse to each other: f, g = biject()

2007-02-07 Thread Jonathan Fine
[EMAIL PROTECTED] wrote: >>A google search for biject.py and bijection.py >>produced no hits, so I suspect that this may not >>have been done before. > > > There are few (good too) implementations around, but they are called > bidict or bidirectional dicts. Sometimes I use this implementation, >

Re: How can I use __setitem__ method of dict object?

2007-02-07 Thread jeremito
On Feb 7, 12:48 pm, Jussi Salmela <[EMAIL PROTECTED]> wrote: > jeremito kirjoitti: > > > On Feb 7, 8:28 am, "jeremito" <[EMAIL PROTECTED]> wrote: > >> On Feb 6, 5:10 pm, Bruno Desthuilliers > > >> <[EMAIL PROTECTED]> wrote: > >>> jeremito a écrit : > >>> > On Feb 6, 2:36 pm, Bruno Desthuilliers >

Re: Calling J from Python

2007-02-07 Thread Gosi
On Feb 7, 3:46 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Gosi wrote: > > I like to use J for many things and I think that combining Python and > > J is a hell of a good mixture. > > I was able to follow this sentence up to and including the word "hell"... :-

Re: multithreading concept

2007-02-07 Thread Sergei Organov
"sturlamolden" <[EMAIL PROTECTED]> writes: > On Feb 7, 6:17 pm, John Nagle <[EMAIL PROTECTED]> wrote: [...] > MPI does not use threads on SMPs because it performs worse than using > multiple processes. I fail to see how threads in general could perform worse than processes. I do understand that pr

Pyserial example program error: win32file.SetupComm reports 'Incorrect function.'

2007-02-07 Thread Ron Jackson
I am using Python 2.5 on Windows XP. I have installed Pyserial and win32all extensions. When I try to run the example program scan.py (included below), or any other program using pyserial, as soon as it hits the statement: s = serial.Serial(i) I get the error: Traceback (most recent call last)

Can somebody give me a python code for this?

2007-02-07 Thread John
Given an array of elements, look at it as a binary tree. Start at the last interior node, and downheap it. Then downheap the previous interior node, and continue in this fashion, up to the root. -- http://mail.python.org/mailman/listinfo/python-list

Python new user question - file writeline error

2007-02-07 Thread James
Hello, I'm a newbie to Python & wondering someone can help me with this... I have this code: -- #! /usr/bin/python import sys month ={'JAN':1,'FEB':2,'MAR':3,'APR':4,'MAY':5,'JUN':6,'JUL':7,'AUG': 8,'SEP':9,'OCT':10,'NOV':11,'DEC':12} infile=file('TVA-0316','r') outfile=

Re: mplayer bug or python bug?

2007-02-07 Thread MRAB
On Feb 7, 11:40 am, Marco <[EMAIL PROTECTED]> wrote: > The following code is my test program for control mplayer. > in movies/ there are about 20 movies, the code plays them in circle, > but mplayer will crash silently after a circle, the "sliently" means I > can handle popen2 without except, but n

Re: need help to kill a process

2007-02-07 Thread elrondrules
On Feb 6, 8:24 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 06 Feb 2007 22:59:40 -0300, <[EMAIL PROTECTED]> escribió: > > > > > > > this is my code snip. > > within my python script I have the following commands.. > > > > > > import os > > ... > > os.system ("cd /home; ./TestTool &

calling python from msc.adams

2007-02-07 Thread boris . smirnov
Hello all, i need to call python from msc.adams. the syntax is "mdi -c python exit" I have created a linux script called "run_python" with this content: mdi -c python $* exit then a call this script with a command: run_python script.py param1 param2 paramN Everything looks OK, but the prob

Re: Python new user question - file writeline error

2007-02-07 Thread Bruno Desthuilliers
James a écrit : > Hello, > > I'm a newbie to Python & wondering someone can help me with this... > > I have this code: > -- > #! /usr/bin/python > > import sys > > month ={'JAN':1,'FEB':2,'MAR':3,'APR':4,'MAY':5,'JUN':6,'JUL':7,'AUG': > 8,'SEP':9,'OCT':10,'NOV':11,'DEC':

Re: Can somebody give me a python code for this?

2007-02-07 Thread Bruno Desthuilliers
John a écrit : > Given an array of elements, look at it as a binary tree. Start at the last > interior node, and downheap it. Then downheap the previous interior node, > and continue in this fashion, up to the root. > > http://www.catb.org/~esr/faqs/smart-questions.html#homework -- http://mai

Re: distutils: renaming setup.py ok?

2007-02-07 Thread Anastasios Hatzis
Hello Benjamin Niemann wrote: > Hello, > > Anastasios Hatzis wrote: > >> I want to distribute Python site-packages. Is it okay to use other setup >> file names than setup.py, which is mentioned in any place I read in the >> doc? >> >> E.g., setupMySDK.py, setupMyLib.py >> >> It seems that it wor

Re: what is wrong with my python code?

2007-02-07 Thread Bruno Desthuilliers
Dongsheng Ruan a écrit : > I got feed back saying" list object is not callable". But I can't figure out > what is wrong with my code. > > A=[3,5,4,9,6,7] > l=len(A)-1 > > for i in range(l): > print A(i) > The error message is quite clear when you remember that () is the call operator. Fo

Re: Python editor

2007-02-07 Thread Stef Mientki
limodou wrote: > Maybe you can try ulipad. > thanks, although it doesn't look bad, and it certainly must have been a huge job doing this with Tcl/Tk, I don't think it can compete with PyScripter, except on Linux ;-) succes, cheers, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-l

Re: multithreading concept

2007-02-07 Thread sturlamolden
On Feb 7, 8:03 pm, Sergei Organov <[EMAIL PROTECTED]> wrote: > I fail to see how threads in general could perform worse than > processes. I do understand that processes are inherently more > safe/secure, but when it comes to speed I really can't imagine why it > could happen that threads perform w

Re: Object type check

2007-02-07 Thread Bruno Desthuilliers
king kikapu a écrit : > Hi to all, > > in statically-types languages, let's say C# for example, we use > polymorphism through interfaces. So we define an interface I with > method M and then a class C that implements I interface and write code > for the M method. > So, if we have a function that t

Re: Object type check

2007-02-07 Thread Bruno Desthuilliers
king kikapu a écrit : >>Dont restrict them to particular types. You would >>not restrict them to a particular class in C#. Instead, you define the >>interfaces simply by how you use the objects. > > > Of cource i restrict them to particular types! In C# you cannot pass > something bad > this way

Re: Can somebody give me a python code for this?

2007-02-07 Thread hg
John wrote: > Given an array of elements, look at it as a binary tree. Start at the last > interior node, and downheap it. Then downheap the previous interior node, > and continue in this fashion, up to the root. Your teacher ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Object type check

2007-02-07 Thread king kikapu
at first, thanks you all for your help! So, i will follow your advice.In a moment though, i thought that "ok, do not check anything of the parameter's type but do a try/catch at the calls inside the function" But this way, i would rather defeat the purpose because i have to try/ catch in *every*

Simple SVN/CVS-like library in Python?

2007-02-07 Thread Andrea Gavana
Hi All, in our office we work with quite complex input files for a reservoir simulator. Those files have thousands of keywords, switches, sub-keywords and whatever. Every time a modification is requested, we modify the input file and re-run the simulator. Obviously, the possible modifications

  1   2   >