Fast list traversal

2008-11-02 Thread dineshv
I want to see if there is an alternative method for fast list traversal. The code is very simple: dict_long_lists = defaultdict(list) for long_list in dict_long_lists.itervalues() for element in long_list: array_a[element] = m + n + p# m,n,p are variable nu

Re: Ping monitor - monitor ip in the background?

2008-11-02 Thread Andrey Balaguta
Hi, ScottZ. I I have to write such a thing, I'll wrap the whole thing into some class, say Pinger. It will have "do" method, which will perform one particular pinging action. It'll also have a start/stop mechanism, which will start a thread to continuously pinging a host. To notify environment (sa

Re: Fast list traversal

2008-11-02 Thread dineshv
On Nov 2, 1:00 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 2 Nov 2008 00:25:13 -0700 (PDT), dineshv > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > I want to see if there is an alternative method for fast list > > traversal.  The code is very simple: > > > di

Re: Fast list traversal

2008-11-02 Thread bearophileHUGS
dineshv: > What is the fastest way to traverse these long_list's sequentially > from the beginning to the end?  Maybe there is another data structure > that can be used instead of a list. Psyco can help a lot in that kind of code. >The elements of long_list are immutable (ie. don't change).< A

push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Terrence Brannon
Hello, The most common way of dynamically producing HTML is via template engines like genshi, cheetah, makotemplates, etc. These engines are 'inline' --- they intersperse programming constructs with the HTML document itself. An opposite approach to this form of dynamic HTML production is called

Re: Ping monitor - monitor ip in the background?

2008-11-02 Thread Jorgen Grahn
On Sat, 01 Nov 2008 20:26:43 -0700, ScottZ <[EMAIL PROTECTED]> wrote: ... > if os.name == "nt": # Windows > pcmd = "ping -n 1 -w 1000 " > else:# *nix > pcmd = "ping -c1 -W1 " Not really correct. Unfortunately there are many variants of ping for Unix, and they don't take th

Re: [ANN] Python 3 Symbol Glossary

2008-11-02 Thread skip
Terry> Over the years, people have complained about the difficulty of Terry> finding the meaning of symbols used in Python syntax. So ... I Terry> wrote a Python 3 Symbol Glossary Terry> http://code.google.com/p/xploro/downloads/list Why not just add a new section to the current

Re: Ping monitor - monitor ip in the background?

2008-11-02 Thread Andrey Balaguta
On Nov 2, 12:47 pm, "ScottZ" <[EMAIL PROTECTED]> wrote: > Andrey - Thank you very much for the example. > Is something missing after the def start(self): or should def run(): not > be there? No, Scott, this is one of the neatest features of Python -- "run" is a nested function. It is visible and u

Re: Fast list traversal

2008-11-02 Thread bearophileHUGS
Steven D'Aprano: > The only solutions to that are to reduce the amount of > computation in each loop, reduce the number of items, or get a faster > computer. Changing language too is an option :-) Languages like Java, D, C, C++ may help :-) Bye, bearophile -- http://mail.python.org/mailman/listin

Re: Executing a hidden/background program

2008-11-02 Thread jim3371
On Nov 2, 3:59 am, "Mike Driscoll" <[EMAIL PROTECTED]> wrote: > You probably want to create a Windows service with Python. There are > various ways to accomplish this. Was considering a Windows service too, however would like to avoid that as non-Admin users may not be able to do that. While I'm n

Re: Fast list traversal

2008-11-02 Thread Steven D'Aprano
On Sun, 02 Nov 2008 00:25:13 -0700, dineshv wrote: > I want to see if there is an alternative method for fast list traversal. > The code is very simple: > > dict_long_lists = defaultdict(list) > for long_list in dict_long_lists.itervalues() > for element in long_list: > a

RE: Ping monitor - monitor ip in the background?

2008-11-02 Thread ScottZ
Andrey - Thank you very much for the example. Is something missing after the def start(self): or should def run(): not be there? I think I understand the idea your showing though and working on adapting it. Again thanks! Jorgen - yes that is very true in regards to the *nix comment. I will change

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Tino Wildenhain
Terrence Brannon wrote: Hello, The most common way of dynamically producing HTML is via template engines like genshi, cheetah, makotemplates, etc. These engines are 'inline' --- they intersperse programming constructs with the HTML document itself. An opposite approach to this form of dynamic

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Terrence Brannon
Tino Wildenhain wrote: An opposite approach to this form of dynamic HTML production is called push-style templating, as coined by Terence Parr: Hm. "$attr.title$ $if(attr.active)$ $attr.submenu:menuItem()$ $endif$" This looks ugly to me. It looks ugly to me too. Why not just using wel

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Tino Wildenhain
Terrence Brannon wrote: Tino Wildenhain wrote: An opposite approach to this form of dynamic HTML production is called push-style templating, as coined by Terence Parr: Hm. "$attr.title$ $if(attr.active)$ $attr.submenu:menuItem()$ $endif$" This looks ugly to me. It looks ugly to me too

buffer

2008-11-02 Thread Aditi Meher
i am using it postgresql as back-end and HTML as front-end,i want to, display 10-10 records at a time which is there in the database using, python.so what is function for buffer that we can use it in python?i, am able to connect my databse in python,but dont know how to create, buffer in python and

compare items in list to x

2008-11-02 Thread Matt Herzog
I want a program that loops over a list of numbers (y) and tells me whether each number in the list is less than, greater than or equal to another number (x). In the below code, I can't get python to see that 2 is equal to 2. x = 2 def compare(): for y in ['12', '33', '2']: if x

Re: compare items in list to x

2008-11-02 Thread Pete Kirkham
2 is not equal to '2' -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator for validation - inefficient?

2008-11-02 Thread Bryan
On Nov 1, 6:57 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 01 Nov 2008 17:12:33 -0700, Bryan wrote: > > The list of validation error descriptions is returned instead of raising > > exceptions so clients can show the errors to the user for fixing. > > Raising exceptio

Re: compare items in list to x

2008-11-02 Thread asit
On Nov 2, 9:54 pm, "Pete Kirkham" <[EMAIL PROTECTED]> wrote: > 2 is not equal to '2' As the error is correctly marked, u have to convert '2' to 2 by using int() function so the write code is x = 2 def compare(): for y in ['12', '33', '2']: y=int(y) #string '2' is conver

storing a string data in access

2008-11-02 Thread [EMAIL PROTECTED]
Hi I have access.Fields("Time").value=t I would like t to be a string reprsenting a data. How can I do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Python 3 Symbol Glossary

2008-11-02 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Terry> Over the years, people have complained about the difficulty of Terry> finding the meaning of symbols used in Python syntax. So ... I Terry> wrote a Python 3 Symbol Glossary Terry> http://code.google.com/p/xploro/downloads/list Arnaud Delobelle w

Re: Decorator for validation - inefficient?

2008-11-02 Thread Arnaud Delobelle
Bryan <[EMAIL PROTECTED]> writes: > However, hoping to make client code cleaner and to avoid setter > functions doing expensive db lookup validations, I do not validate > during the setter, but instead defer it until the client explicitly > asks for the validity of the business object. So the ess

Re: compare items in list to x

2008-11-02 Thread Bruno Desthuilliers
Matt Herzog a écrit : I want a program that loops over a list of numbers (y) and tells me whether each number in the list is less than, greater than or equal to another number (x). In the below code, I can't get python to see that 2 is equal to 2. x = 2 def compare(): for y in ['12',

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Paul Boddie
On 2 Nov, 15:25, Terrence Brannon <[EMAIL PROTECTED]> wrote: > > I like the approach of my own HTML::Seamstress --- object-oriented Perl > and knowledge of an object-oriented tree-rewriting library is all you need: > http://search.cpan.org/~tbone/HTML-Seamstress-5.0b/lib/HTML/Seamstres The Pyt

Re: Windows DOS box redirection

2008-11-02 Thread Thorsten Kampe
* Dennis Lee Bieber (Sat, 01 Nov 2008 11:34:32 -0700) > On Sat, 1 Nov 2008 18:50:53 +0100, Thorsten Kampe > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > That article mentions a pipe - and has nothing to do with input or > > output redirection... > > > And what is a pip

Re: Finding the instance reference of an object

2008-11-02 Thread Aaron Brady
On Oct 31, 3:23 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 30 Oct 2008 19:55:57 -0700, Aaron Brady wrote: > > On Oct 30, 9:05 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > >> On Fri, 31 Oct 2008 13:58:13 +1300, greg wrote: > >> > Dale Rober

Unyeilding a permutation generator

2008-11-02 Thread sillyhat
Hello, can someone please help. I found the following code at http://code.activestate.com/recipes/252178/ def all_perms(str): if len(str) <=1: yield str else: for perm in all_perms(str[1:]): for i in range(len(perm)+1): #nb str[0:1] works in bot

Re: Unyeilding a permutation generator

2008-11-02 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Anyway what I want to do is experiment with code similar to this (i.e. > same algorithm and keep the recursion) in other languages, > particularly vbscript and wondered what it would look like if it was > rewritten to NOT use the yield statement - Without the yield sta

Re: Unyeilding a permutation generator

2008-11-02 Thread Carsten Haese
[EMAIL PROTECTED] wrote: > Anyway what I want to do is experiment with code similar to this (i.e. > same algorithm and keep the recursion) in other languages, > particularly vbscript and wondered what it would look like if it was > rewritten to NOT use the yield statement An obvious (though memory

Re: Unyeilding a permutation generator

2008-11-02 Thread Aaron Brady
On Nov 2, 3:34 pm, [EMAIL PROTECTED] wrote: > Hello, can someone please help. > > I found the following code athttp://code.activestate.com/recipes/252178/ > > def all_perms(str): >     if len(str) <=1: >         yield str >     else: >         for perm in all_perms(str[1:]): >             for i in

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Terrence Brannon
Tino Wildenhain wrote: Terrence Brannon wrote: Tino Wildenhain wrote: An opposite approach to this form of dynamic HTML production is called push-style templating, as coined by Terence Parr: Hm. "$attr.title$ $if(attr.active)$ $attr.submenu:menuItem()$ $endif$" This looks ugly to me

[ANN] PySmell v0.7, a Python auto-completion library

2008-11-02 Thread Orestis Markou
I'm very proud to announce the release of PySmell v0.7! PySmell is an auto-completion library for Python, meant to be plugged in different editors. It uses static analysis to generate a TAGS file for your code, and uses that to give you suggestions. It's very fast - suggestions are instanta

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Diez B. Roggisch
Hi, first a bit of background: I've been using push-style templating in the form of XMLC before. Actually, I've been a core-developer of BarracudaMVC, a java web-framework that for rendering massively relied on XMLC and has been driving XMLC's development (at least used to). And I liked it.

Re: How to Use ANSI for Remote Screen Scraping?

2008-11-02 Thread Henry Chang
I am taking a step back, and just get something simple working with ANSI. The following code works (creates the ANSI terminal object, and inserts a few characters, and scrap the characters back). import ANSI crt = ANSI.ANSI(25,80) crt.insert_abs(2,2,"a") crt.insert_abs(3,10,"b") crt.insert_abs(

Re: How to Use ANSI for Remote Screen Scraping?

2008-11-02 Thread Henry Chang
After playing with this, it seems the key is to pass objects to the ANSI terminal via the following: import ANSI crt = ANSI.ANSI(25,80) head_output = ["line 1 ABCDEFGHIJKL", "line 2 ABCDEFGHIJKL", "line 3 ABCDEFGHIJKL", "line 4 ABCDEFGHIJKL", "line 5 ABCDEFGHIJKL", "

Re: Restricted Execution of untrusted code

2008-11-02 Thread Emanuele D'Arrigo
On Nov 1, 12:44 am, Lawrence D'Oliveiro wrote: > I think the most reliable solution is to take advantage of a level in the > system that already has to provide protection against malicious code: use a > chroot jail. Or run a complete virtualized machine with its own OS > installation. Then the code

comptech

2008-11-02 Thread rema
Discover history of communications. Fact-filled, fun and totally free. Click below for more details *** www.ambairam.webs.com www.recipesallin1.50webs.com www.busioperatin.50webs.com www.scorecash4all.webs.com *** -- ht

Re: [ANN] Python 3 Symbol Glossary

2008-11-02 Thread Terry Reedy
Terry Reedy wrote: Over the years, people have complained about the difficulty of finding the meaning of symbols used in Python syntax. So ... I wrote a Python 3 Symbol Glossary http://code.google.com/p/xploro/downloads/list There are .txt and .odt versions. Replaced with an updated .html v

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Aahz
In article <[EMAIL PROTECTED]>, Terrence Brannon <[EMAIL PROTECTED]> wrote: > >The most common way of dynamically producing HTML is via template >engines like genshi, cheetah, makotemplates, etc. > >These engines are 'inline' --- they intersperse programming constructs >with the HTML document itse

Re: CAD.py

2008-11-02 Thread r
On Nov 1, 7:13 pm, infixum <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > r> I am currently looking to create a small CAD program with python. > > > Instead of starting from scratch how about extending PythonCAD instead: > > >    http://www.pythoncad.org/ > > > Skip > > ThanCAD might hav

Re: storing a string data in access

2008-11-02 Thread alex23
On Nov 3, 3:47 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi > I have > access.Fields("Time").value=t > I would like t to be  a string reprsenting a data.  How can I do this? t = "string representing a datum" access.Fields("Time").value = t -- http://mail.python.org/mailman/listinfo/pyth

Re: Restricted Execution of untrusted code

2008-11-02 Thread Ben Finney
"Emanuele D'Arrigo" <[EMAIL PROTECTED]> writes: > On Nov 1, 12:44 am, Lawrence D'Oliveiro wrote: > > I think the most reliable solution is to take advantage of a level > > in the system that already has to provide protection against > > malicious code: use a chroot jail. […] > > [sigh] That sound

Re: Restricted Execution of untrusted code

2008-11-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > "Emanuele D'Arrigo" <[EMAIL PROTECTED]> writes: > > > On Nov 1, 12:44 am, Lawrence D'Oliveiro wrote: > > > I think the most reliable solution is to take advantage of a level > > > in the system that already has to provide p

Re: Unyeilding a permutation generator

2008-11-02 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hello, can someone please help. > > I found the following code at http://code.activestate.com/recipes/252178/ > > def all_perms(str): > if len(str) <=1: > yield str > else: > for perm in all_perms(str[1:]): > for i in range(len(perm)+

Re: ANN: Docpicture 0.2

2008-11-02 Thread nopsidy
André wrote: Docpicture 0.2 has been released. You can download it from http://code.google.com/p/docpicture/ Docpicture's goal is to enable embedding pictures inside Python docstrings using some custom domain specific language (dsl). docpicture includes a plugin architecture enabling users to e

Re: Decorator for validation - inefficient?

2008-11-02 Thread Steven D'Aprano
On Sun, 02 Nov 2008 09:33:41 -0800, Bryan wrote: > I'm coming from a .Net background, and yes, one of the reasons I did not > consider raising exceptions was to avoid the overhead of an exception > handler clause, which in .Net land is expensive. Actually catching an exception in Python is expens

Re: Finding the instance reference of an object

2008-11-02 Thread Steven D'Aprano
On Sun, 02 Nov 2008 13:23:11 -0800, Aaron Brady wrote: > But, doing so, an object is not the same as a reference to it, and all > Python does is pass and copy references. No, that's what at least one particular implementation of Python does. That's not what Python does. The Python VM doesn't hav

Dont miss... Just click...

2008-11-02 Thread [EMAIL PROTECTED]
http://www.sportstips8.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: CAD.py

2008-11-02 Thread nopsidy
r wrote: On Nov 1, 7:13 pm, infixum <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: r> I am currently looking to create a small CAD program with python. Instead of starting from scratch how about extending PythonCAD instead: http://www.pythoncad.org/ Skip ThanCAD might have a few ideas

Re: Responding to web request with python

2008-11-02 Thread Christopher David Kyle
On Sun, 2 Nov 2008, Tim Roberts wrote: > scott212 <[EMAIL PROTECTED]> wrote: > > > >I'm responding with xml to a web request from google checkout but I > >think I'm in a catch-22. To get my webserver (apache) to respond I > >need a header and then a blank line before my xml begins, or else it > >t

how to call this dll in python

2008-11-02 Thread Shark
I have a windows dll1.dll with a export function: int f1(char filename,char **buf,int *bufLen) { int len; //got the length of file anyway,such as 100 len = 100;//len = getLen(filename); *buf = (char*)calloc(100); *bufLen = len; return 0; } then how can I call the f1 function with python. thanks f

Why does numpy.array(a[0],b[0]) have this meaning?

2008-11-02 Thread Rick Giuly
Hello All, Case 1 This generates an error, which makes sense because the argument should be a list of numbers: numpy.array(10,10) Case 2 This does not generate an error and the result is an array with a single element: a = numpy.array([10]) b = numpy.array([10]) numpy.array(a[0],b[0]) The only d

How to build python 32 bit version on 64 bit linux.

2008-11-02 Thread Pravin Sinha
Hi Experts, I want to build a 32 bit version of python on 64 bit Linux machine. Could any body tell how can I achieve this.I tried many alternatives but didn't work. Much appreciate your time and help, Thanks in advance, -Pravin Add more friends to your messenger and enjoy! Go to http

Re: Why does numpy.array(a[0],b[0]) have this meaning?

2008-11-02 Thread alex goretoy
just a shot in the dark. second arg to numpy.array is of type see numpy.array.__doc__ -nop On Mon, Nov 3, 2008 at 1:26 AM, Rick Giuly <[EMAIL PROTECTED]> wrote: > Hello All, > > Case 1 > This generates an error, which makes sense because the argument should > be a list of numbers: > numpy.arr

Vacheron Constantin Malte Dual Time Regulator Mens Watch 42005000R9068 Collection

2008-11-02 Thread ndata
Vacheron Constantin Malte Dual Time Regulator Mens Watch 42005000R9068 Collection Watches Collection Site : http://www.watches-collection.com/ Vacheron Constantin Malte Dual Time Regulator Mens Watch 42005000R9068 View Full : http://vacheron-constantin.watches-collection.com/Vacheron-Constantin-Ma

Invicta Lupah Grand Watches Collection - Best Invicta

2008-11-02 Thread ndata
Invicta Lupah Grand Watches Collection - Best Invicta Watches Collection : http://www.watches-collection.com/ Invicta Watches Collection : http://invicta.watches-collection.com/ Invicta Lupah Grand Watches Collection : http://invicta.watches-collection.com/invicta-lupah-grand-watches.html Invict

Girard Perragaux Sport Classique Stainless Steel Mens Watch 49920.1.11.4144 Collection

2008-11-02 Thread ndata
Girard Perragaux Sport Classique Stainless Steel Mens Watch 49920.1.11.4144 Collection Watches Collection Site : http://www.watches-collection.com/ Girard Perragaux Sport Classique Stainless Steel Mens Watch 49920.1.11.4144 View Full : http://girard-perregaux.watches-collection.com/Girard-Perragau

Movado Portico Watches Collection - Best Movado

2008-11-02 Thread ndata
Movado Portico Watches Collection - Best Movado Watches Collection : http://www.watches-collection.com/ Movado Watches Collection : http://movado.watches-collection.com/ Movado Portico Watches Collection : http://movado.watches-collection.com/movado-portico-watches.html Movado Portico Watches A