Re: Help needed

2008-01-10 Thread A.T.Hofkamp
On 2008-01-11, tijo <[EMAIL PROTECTED]> wrote: > Hi mate > i created the socket and the connection with tcp and udp i dont know > how to check the bytes send and time > could you help me with this Have a look at the time or timeit modules. Albert -- http://mail.python.org/mailman/listinfo/python

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Fri, 11 Jan 2008 01:48:43 -0500 Marty <[EMAIL PROTECTED]> wrote: > Mike Meyer wrote: > >> This caused me to wonder why Python does not have a "foreach" statement > >> (and > >> also why has it not come up in this thread)? I realize the topic has > >> probably > >> been beaten to death in ea

improving performance of python webserver running python scripts in cgi-bin

2008-01-10 Thread Dale
I am using a simple python webserver (see code below) to serve up python scripts located in my cgi-bin directory. import BaseHTTPServer import CGIHTTPServer class Handler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = ['/cgi-bin'] httpd = BaseHTTPServer.HTTPServer(('',8000), Handler)

Re: for loop without variable

2008-01-10 Thread Basilisk96
On Jan 10, 10:36 pm, Marty <[EMAIL PROTECTED]> wrote: > Hrvoje Niksic wrote: > > Mike Meyer <[EMAIL PROTECTED]> writes: > > >> It sounds to me like your counter variable actually has meaning, > > > It depends how the code is written. In the example such as: > > > for meaningless_variable in xrange

Re: for loop without variable

2008-01-10 Thread Marty
Mike Meyer wrote: > On Thu, 10 Jan 2008 22:36:56 -0500 Marty <[EMAIL PROTECTED]> wrote: >> I recently faced a similar issue doing something like this: >> >> data_out = [] >> for i in range(len(data_in)): >> data_out.append([]) > > More succinctly: > > data_out = [] > for _

How to POSTcall and retrieve result page

2008-01-10 Thread suyash jape
Hi all i want to access a web page through python script, fillup the necessary fields, and press submit button (which does POST call) and retrieve the result page and retrieve some values from it. Here is the script i have written till now. >import urllib2 > # create array of name/value pairs > s

Analyzing Python GC output - what is a "cell", and what information is available about it.

2008-01-10 Thread John Nagle
I'm printing out each entry in "gc.garbage" after a garbage collection in DEBUG_LEAK mode, and I'm seeing many entries like That's the output of "repr". Are "cell" objects created only from external C libraries, or can regular Python code generate them? Is there any way to find out what the '

Re: Python too slow?

2008-01-10 Thread Jaimy Azle
"Ed Jensen" <[EMAIL PROTECTED]> wrote: > > Wow, this is pretty misleading. > > Java is, indeed, compiled to bytecode; however, modern JVMs typically > compile the bytecode to native code and then execute the native code. > > CPython strictly interprets bytecode; it does not compile the > bytecode

Re: for loop without variable

2008-01-10 Thread Carl Banks
On Thu, 10 Jan 2008 22:36:56 -0500, Marty wrote: > I recently faced a similar issue doing something like this: > > data_out = [] > for i in range(len(data_in)): > data_out.append([]) > > This caused me to wonder why Python does not have a "foreach" statement > (and also why has it

loading a script from text data

2008-01-10 Thread Patrick Stinson
Is it possible to load a script from it's text data, and not from a file? I'm writing a scripting engine and need to run the scripts right from the editor. cheers! -- Patrick Kidd Stinson http://www.patrickkidd.com/ http://pkaudio.sourceforge.net/ http://pksampler.sourceforge.net/ -- http://mail

Re: for loop without variable

2008-01-10 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes: > data_out = [[] for _ in data_in] > ... > But I'm curious - what's the difference between the "foreach" you have > in mind and the standard python "for"? The "for" loop, like the list comprehension, pollutes the namespace with an index variable that's not us

Re: for loop without variable

2008-01-10 Thread Paul Rubin
erik gartz <[EMAIL PROTECTED]> writes: > The loop performs some actions with web services. The particular > iteration I'm on isn't important to me. It is only important that I > attempt the web services that number of times. If I succeed I > obviously break out of the loop and the containing functi

Re: for loop without variable

2008-01-10 Thread Matimus
On Jan 10, 10:36 pm, Marty <[EMAIL PROTECTED]> wrote: > Hrvoje Niksic wrote: > > Mike Meyer <[EMAIL PROTECTED]> writes: > > >> It sounds to me like your counter variable actually has meaning, > > > It depends how the code is written. In the example such as: > > > for meaningless_variable in xrange

Re: Help needed

2008-01-10 Thread tijo
Hi mate i created the socket and the connection with tcp and udp i dont know how to check the bytes send and time could you help me with this cheers tijo -- http://mail.python.org/mailman/listinfo/python-list

Re: Persistent HTTP Connections with Python?

2008-01-10 Thread Ivan Novick
On Jan 10, 10:46 am, Scott Sharkey <[EMAIL PROTECTED]> wrote: > Hello All, > > I am trying to write a python script to talk to an xml-based stock feed > service. They are telling me that I must connect and login, and then > "issue refresh requests" to fetch the data. This sounds a lot (to me) > l

Re: Help needed

2008-01-10 Thread Ivan Novick
On Jan 10, 6:15 pm, tijo <[EMAIL PROTECTED]> wrote: > Hi mate > > i need o do a python program to connect 2 systems using TCP/IP and > UDP. Also i need to check the performance of these two protocols (how > many bytes received and how much time took). I havent worked in python > earlier and have no

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 22:36:56 -0500 Marty <[EMAIL PROTECTED]> wrote: > I recently faced a similar issue doing something like this: > > data_out = [] > for i in range(len(data_in)): > data_out.append([]) More succinctly: data_out = [] for _ in data_in: data_out.append([]) Or, a

Re: Detecting OS platform in Python

2008-01-10 Thread Benjamin
On Jan 10, 8:37 pm, Devraj <[EMAIL PROTECTED]> wrote: > Hi everyone, > > My Python program needs reliably detect which Operating System its > being run on, infact it even needs to know which distribution of say > Linux its running on. The reason being its a GTK application that > needs to adapt its

Re: Newbie Q: modifying SQL statements

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 20:32:06 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm in the process of learning Python by writing a job queue program. > Nothing fancy, mind you, just read from a table, shell out to a program, > write back to the table. > > I'm working off of the tuto

RE: for loop without variable

2008-01-10 Thread Ryan Ginstrom
> On Behalf Of Marty > I recently faced a similar issue doing something like this: > > data_out = [] > for i in range(len(data_in)): > data_out.append([]) > > This caused me to wonder why Python does not have a "foreach" > statement (and also why has it not come up in this thread

Re: for loop without variable

2008-01-10 Thread Marty
Hrvoje Niksic wrote: > Mike Meyer <[EMAIL PROTECTED]> writes: > >> It sounds to me like your counter variable actually has meaning, > > It depends how the code is written. In the example such as: > > for meaningless_variable in xrange(number_of_attempts): > ... > > the loop variable really

Re: getting n items at a time from a generator

2008-01-10 Thread Shane Geiger
Paul Rubin wrote: > Tim Roberts <[EMAIL PROTECTED]> writes: > >> I have to say that I have found this to be a surprisingly common need as >> well. Would this be an appropriate construct to add to itertools? >> > > I'm in favor. > I am ecstatic about the idea of getting n items at a t

Re: Detecting OS platform in Python

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 18:37:59 -0800 (PST) Devraj <[EMAIL PROTECTED]> wrote: > Hi everyone, > > My Python program needs reliably detect which Operating System its > being run on, infact it even needs to know which distribution of say > Linux its running on. The reason being its a GTK application th

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2008-01-10 Thread Paul Rubin
Raymond Hettinger <[EMAIL PROTECTED]> writes: > > I presume you did scans of > > large code bases and you did not find occurrences of > > takewhile and dropwhile, right? > > Yes. I think I have used them. I don't remember exactly how. Probably something that could have been done more generally

Re: getting n items at a time from a generator

2008-01-10 Thread Paul Rubin
Tim Roberts <[EMAIL PROTECTED]> writes: > I have to say that I have found this to be a surprisingly common need as > well. Would this be an appropriate construct to add to itertools? I'm in favor. -- http://mail.python.org/mailman/listinfo/python-list

Re: docstrings style question

2008-01-10 Thread Steven D'Aprano
On Fri, 11 Jan 2008 13:09:26 +1100, Steve Brown wrote: > What I'm trying to do with the tests is pare them back so that the code > explicitly and concisely documents the tests. Yes, this is good. > It is important that the comments and doc strings NOT contain > information about how Temperature

Re: open excel file while it is being used.

2008-01-10 Thread Devraj
Hi Barry, Obviously what you are trying to do is detect file locks. I am not exactly sure how to do this in Python but from previous system administration jobs here are some scenarios that you might want to watch out for. - I know for one that if you are accessing the file on a Samba share, file

Detecting OS platform in Python

2008-01-10 Thread Devraj
Hi everyone, My Python program needs reliably detect which Operating System its being run on, infact it even needs to know which distribution of say Linux its running on. The reason being its a GTK application that needs to adapt itself to be a Hildon application if run on devices like the N800.

Re: Help needed

2008-01-10 Thread Devraj
Sorry to diverge from the topic, but is there a reason you need to develop something like again? I would assume that there would be numerous utilities that would do this for you. If you want these features in your applications, why don't you consider incorporating existing tools/libraries into you

Re: Minimalistic Software Transactional Memory

2008-01-10 Thread Paul Rubin
Fuzzyman <[EMAIL PROTECTED]> writes: > STM isn't lock free - it just abstracts the locks away from the > 'user'. You still need to lock around committing the transaction. The idea is that readers don't need locks. They just look at the version number before they start reading and after they finis

Re: Best way to merge/sort two sorted lists?...

2008-01-10 Thread Paul Rubin
Aaron Watters <[EMAIL PROTECTED]> writes: > The second one is! That's why it works so fast. > Tim Peters optimized this case! > Gotta hand it to Tim Peters. The first one should > win some sort of obfuscated code contest, imho. > It also seems to be 5 times slower than any of the others. The hea

Help needed

2008-01-10 Thread tijo
Hi mate i need o do a python program to connect 2 systems using TCP/IP and UDP. Also i need to check the performance of these two protocols (how many bytes received and how much time took). I havent worked in python earlier and have no idea of this. Could someone pls help me. I created a program w

Re: docstrings style question

2008-01-10 Thread Steve Brown
What I'm trying to do with the tests is pare them back so that the code explicitly and concisely documents the tests. It is important that the comments and doc strings NOT contain information about how Temperature Sense works because that is outside the scope of the test. More generally, comments

Re: docstrings style question

2008-01-10 Thread Steve Brown
"Neil Cerutti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Jan 10, 2008 12:47 AM, Steve Brown <[EMAIL PROTECTED]> wrote: >> I've got a series of modules which look like this: >> >> # >> # >> # Temperature Sense Test >> # >> # >> class Test3(ar_test.AR_

Newbie Q: modifying SQL statements

2008-01-10 Thread Faber J. Fedor
Hi all, I'm in the process of learning Python by writing a job queue program. Nothing fancy, mind you, just read from a table, shell out to a program, write back to the table. I'm working off of the tutorial listed here (amongst many places): http://www.devx.com/dbzone/Article/22093 In my Jobs c

PyImport_ImportModule("cStringIO") failure with undefined symbol

2008-01-10 Thread Borse, Ganesh
Hi, Can you please guide me for the following problem? The call to "PyImport_ImportModule("cStringIO");" is failing with an error of "undefined symbol: PyObject_SelfIter". Before importing this module, I am importing only the sys module. Py_SetProgramName("/usr/bin/python"); Py_Initialize(

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > I'm reading this page: > http://www.ps.uni-sb.de/~duchier/python/continuations.html > and I've found a strange usage of lambda: > > > Now, CPS would transform the baz function above into: > > def baz(x,y,c): > mul(2,x,lambda v,y=y,c=c: add(

doctest.testfile universal newline -- only when module_relative=True?

2008-01-10 Thread Peter Donis
When running a doctest text file with doctest.testfile, I noticed that universal newline support did not appear to work when module_relative is False. My text file was saved on a Windows machine but I was testing it on a Linux machine, hence the newline mismatch (doctest would throw a SyntaxError f

Re: for loop without variable

2008-01-10 Thread Basilisk96
On Jan 9, 10:55 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > erik gartz <[EMAIL PROTECTED]> writes: > > The loop performs some actions with web services. The particular > > iteration I'm on isn't important to me. It is only important that I > > attempt the web services that number of times. If I suc

Re: adding methods at runtime

2008-01-10 Thread Marc 'BlackJack' Rintsch
On Thu, 10 Jan 2008 14:55:18 -0800, [EMAIL PROTECTED] wrote: > Can I access the class attributes from a method added at runtime? (My > experience says no.) > I experimented with the following code: > > [Code snipped] > > So it seems to me, if you add a method to an instance, the method will > no

Re: getting absolute path ?

2008-01-10 Thread Stef Mientki
thanks Mike, with your links I managed to write some code that seems to work well. Still I stay surprised that these kind of functions are not available ;-) cheers, Stef [EMAIL PROTECTED] wrote: > On Jan 9, 3:22 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > >> hello, >> >> I'm trying to conver

Win32+Cygwin+ActiveState Python+SCons

2008-01-10 Thread gamename
Hi, I just installed scons on win32 that has cygwin but uses ActiveState python. If I do "import SCons", the lib isn't found. The win32 installer seemed very complete, but the scons lib doesn't seem to be in any dir python knows about. Is there another install step I need to do? TIA, -T -- http

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Dustan
On Jan 10, 12:36 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I've figured it out, it is default argument. > print y() > gives 13 as result. > > It's a bit evil though. Why? It's the same syntax as with functions: x=3 def y(x=x): return x+10 print y(2) # prints 12 print y() # print

adding methods at runtime

2008-01-10 Thread [EMAIL PROTECTED]
Can I access the class attributes from a method added at runtime? (My experience says no.) I experimented with the following code: class myclass(object): myattr = "myattr" instance = myclass() def method(x): print x instance.method = method instance.method("hello world") inst2 = myclas

RE: ISO Python example projects (like in Perl Cookbook)

2008-01-10 Thread Delaney, Timothy (Tim)
You know you've been working at a large company for too long when you see that subject and think "ISO-certified Python?" Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question on Classes

2008-01-10 Thread John Machin
On Jan 11, 8:46 am, "Adrian Wood" <[EMAIL PROTECTED]> wrote: > Hi al! I'm new to the list, and reasonably new to Python, so be gentle. > > Long story short, I'm having a hard time finding a way to call a > function on every object of a class at once. A class is a factory that creates objects. It k

Re: Newbie question on Classes

2008-01-10 Thread Steven Clark
> l = [] > l.append(man) > l.append(woman) > > # Print the state. > for item in l: > print item.state() > > Small, off-topic nitpick: please don't use "l" (lower-case el) as a variable name. >From http://www.python.org/dev/peps/pep-0008/: "Naming Conventions Names to Avoid Never use the cha

RE: Newbie question on Classes

2008-01-10 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Adrian Wood > Sent: Thursday, January 10, 2008 4:47 PM > To: python-list@python.org > Subject: Newbie question on Classes > > > I can call man.state() and then woman.state() or Person.state(man

Fwd: Python-list Digest, Vol 52, Issue 128

2008-01-10 Thread Adrian Wood
Fredrik Lundh wrote: > > Adrian Wood wrote: > > > > I can call man.state() and then woman.state() or Person.state(man) and > > Person.state(woman) to print the status of each. This takes time and > > space however, and becomes unmanageable if we start talking about a > > large number of objects, an

Re: Wrap Tk widget using a class

2008-01-10 Thread Fredrik Lundh
Kevin Walzer wrote: > Here is an example of how I'm calling this in my code: > > from Macnotebook import Macnotebook > > self.prefbook = Macnotebook.notebook(self.prefframe) > self.prefbook.pack(fill=BOTH, expand=YES, side=TOP) you're attempting to call the method in a class

Re: XML+Logs to Latex. XSLT?

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 22:32:50 +0100 Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Yes. For sure. I though XSLT was something like XML not other > > "language" and that Python will have any library that uses XSLT to do > > transformation... > XSLT is definitely a language (it's turing complete, after

Re: Newbie question on Classes

2008-01-10 Thread Erik Max Francis
Adrian Wood wrote: > I can call man.state() and then woman.state() or Person.state(man) and > Person.state(woman) to print the status of each. This takes time and > space however, and becomes unmanageable if we start talking about a > large number of objects, and unworkable if there is an unknown

Re: Newbie question on Classes

2008-01-10 Thread Nanjundi
On Jan 10, 4:46 pm, "Adrian Wood" <[EMAIL PROTECTED]> wrote: > Hi al! I'm new to the list, and reasonably new to Python, so be gentle. > > Long story short, I'm having a hard time finding a way to call a > function on every object of a class at once. Example: > > I have a class Person, which has a

Re: Embedding python code into text document question.

2008-01-10 Thread Erik Max Francis
Thomas Troeger wrote: > I've written a program that parses a string or file for embedded python > commands, executes them and fills in the returned value. The input might > look like this: > > process id: $$return os.getpid()$$ > current date: $$return time.ctime()$$ > superuser: $$ > if os.get

Wrap Tk widget using a class

2008-01-10 Thread Kevin Walzer
I'm trying to wrap a subset of a Tcl/Tk widget set called tclmacbag (see http://tclmacbag.autons.net/) for use in my Tkinter application, using a "macnotebook" class. I'm having some difficulty getting things configured correctly. Here is my class code: from Tkinter import * class Macnoteboo

Re: Newbie question on Classes

2008-01-10 Thread Steven Clark
On Jan 10, 2008 4:54 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Adrian Wood wrote: > > > I can call man.state() and then woman.state() or Person.state(man) and > > Person.state(woman) to print the status of each. This takes time and > > space however, and becomes unmanageable if we start talki

Re: Newbie question on Classes

2008-01-10 Thread Fredrik Lundh
Adrian Wood wrote: > I can call man.state() and then woman.state() or Person.state(man) and > Person.state(woman) to print the status of each. This takes time and > space however, and becomes unmanageable if we start talking about a > large number of objects, and unworkable if there is an unknown

Re: Elementtree 1.3 and xpath

2008-01-10 Thread Fredrik Lundh
Andrew Lonie wrote: > Hi I noticed that the xpath functionality of elementtree has been > upgraded in version 1.3. However I can't seem to get the [postion] > predicate to function. All the other new functionality seems to be > working. ET 1.3 is only available in an early alpha yet, and the post

Re: Python too slow?

2008-01-10 Thread Ed Jensen
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > oh, please. it was perfectly clear for anyone with the slightest clue > what Bruno was talking about (especially if they'd read the post he was > replying to), so the only question that remains is why you didn't > understand it. If you have something

Newbie question on Classes

2008-01-10 Thread Adrian Wood
Hi al! I'm new to the list, and reasonably new to Python, so be gentle. Long story short, I'm having a hard time finding a way to call a function on every object of a class at once. Example: I have a class Person, which has a function state(). This prints a basic string about the Person (position

Elementtree 1.3 and xpath

2008-01-10 Thread Andrew Lonie
Hi I noticed that the xpath functionality of elementtree has been upgraded in version 1.3. However I can't seem to get the [postion] predicate to function. All the other new functionality seems to be working. Maybe I'm getting the syntax wrong?: >>> xml = ET.XML("""texttext2""") >>> elem = xml.f

Re: XML+Logs to Latex. XSLT?

2008-01-10 Thread Fredrik Lundh
Florencio Cano wrote: > Yes. For sure. I though XSLT was something like XML not other > "language" and that Python will have any library that uses XSLT to do > transformation... XSLT is definitely a language (it's turing complete, after all), but that there are of course several Python bindings

Re: Another dumb scope question for a closure.

2008-01-10 Thread Fredrik Lundh
Steven W. Orr wrote: > The problem only happens if I try to modify jj. It only happens if you try to *bind* the name "jj" to an object inside the function. > What am I not understanding? My guess is that you have a C/C++ view of variables and values, where variables are locations in memory th

Re: urllib2 rate limiting

2008-01-10 Thread Dimitrios Apostolou
On Thursday 10 January 2008 22:42:44 Rob Wolfe wrote: > Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > > On Thu, 10 Jan 2008, Rob Wolfe wrote: > >> Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > >>> P.S. And something simpler: How can I disallow urllib2 to follow > >>> redirections to foreign

outgoing traffic monitor

2008-01-10 Thread whatazor
Hi all, I have thread that call a module which upload a file in a remote repository. A possible approach to calculate the time is tomonitor outgoing traffic of that thread. How can I do in python. There are modules usefull for this kind of requests? thank you all, bye w -- http://mail.python.org

Re: Python too slow?

2008-01-10 Thread Fredrik Lundh
Ed Jensen wrote: > The only question that remains is if you were being accidentally > misleading or purposefully misleading. oh, please. it was perfectly clear for anyone with the slightest clue what Bruno was talking about (especially if they'd read the post he was replying to), so the only q

Re: Another dumb scope question for a closure.

2008-01-10 Thread Steven W. Orr
On Wednesday, Jan 9th 2008 at 14:01 -, quoth Fredrik Lundh: =>Steven W. Orr wrote: => =>> So sorry because I know I'm doing something wrong. =>> =>> 574 > cat c2.py =>> #! /usr/local/bin/python2.4 =>> =>> def inc(jj): =>> def dummy(): =>> jj = jj + 1 =>> return jj =>>

Re: Pythonic cats (and dogs?)

2008-01-10 Thread Gabriel
Yes ! Where are the dogs ? I preffer them .. :-) "Tim Churches" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > A challenge: an elegant, parsimonious and more general[1] implementation of this, in Python: > > http://lol.ianloic.com/feed/www.planetpython.org/rss20.xml > > Tim

Re: Embedding python code into text document question.

2008-01-10 Thread MRAB
On Jan 10, 1:10 pm, Thomas Troeger <[EMAIL PROTECTED]> wrote: > Dear all, > > I've written a program that parses a string or file for embedded python > commands, executes them and fills in the returned value. The input might > look like this: > > process id: $$return os.getpid()$$ > current date: $

Re: Python too slow?

2008-01-10 Thread Ed Jensen
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > I fail to see how the existence of JIT compilers in some Java VM changes > anything to the fact that both Java (by language specification) and > CPython use the byte-code/VM scheme. While your answer was technically correct, by omitting pertinent

Re: urllib2 rate limiting

2008-01-10 Thread Rob Wolfe
Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > On Thu, 10 Jan 2008, Rob Wolfe wrote: > >> Dimitrios Apostolou <[EMAIL PROTECTED]> writes: >> >>> P.S. And something simpler: How can I disallow urllib2 to follow >>> redirections to foreign hosts? >> >> You need to subclass `urllib2.HTTPRedirectHa

open excel file while it is being used.

2008-01-10 Thread barry . zhao
Hi, I have a python program that constantly updates an excel spreadsheet. I would like to be able to view its updates while using excel to edit other excel files. Below are the test codes I have: -- from time impo

Re: XML+Logs to Latex. XSLT?

2008-01-10 Thread Florencio Cano
2008/1/10, Fredrik Lundh <[EMAIL PROTECTED]>: > Florencio Cano wrote: > > > I'm thinking about implementing a script in Python to do this task. I > > have a XML log and logs from other programs. My aim is to do a report > > about all this information. I'm thinking in using Python to transform > > t

Re: urllib2 rate limiting

2008-01-10 Thread Dimitrios Apostolou
On Thu, 10 Jan 2008, Rob Wolfe wrote: > Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > >> P.S. And something simpler: How can I disallow urllib2 to follow >> redirections to foreign hosts? > > You need to subclass `urllib2.HTTPRedirectHandler`, override > `http_error_301` and `http_error_302` m

Re: XML+Logs to Latex. XSLT?

2008-01-10 Thread Fredrik Lundh
Florencio Cano wrote: > I'm thinking about implementing a script in Python to do this task. I > have a XML log and logs from other programs. My aim is to do a report > about all this information. I'm thinking in using Python to transform > the plain logs to XML and combine them with the XML docume

Re: Python too slow?

2008-01-10 Thread Ross Ridge
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > And the reference implementation of Python (CPython) is not > interpreted, it's compiled to byte-code, which is then executed by a VM > (just like Java). Ed Jensen a écrit : > Wow, this is pretty misleading. Bruno Desthuilliers <[EMAIL PROTECTE

XML+Logs to Latex. XSLT?

2008-01-10 Thread Florencio Cano
Hi! I'm thinking about implementing a script in Python to do this task. I have a XML log and logs from other programs. My aim is to do a report about all this information. I'm thinking in using Python to transform the plain logs to XML and combine them with the XML document I have and later use som

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Fredrik Lundh
Mike Meyer wrote: What does "y=y" and "c=c" mean in the lambda function? >>> >>> Older versions of python didn't make variables in an outer scope >>> visible in the inner scope. This was the standard idiom to work >>> around that. >>> >> lexically scoped free variables and object binding are

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 08:42:16 +0100 Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Mike Meyer <[EMAIL PROTECTED]> writes: > > It sounds to me like your counter variable actually has meaning, > It depends how the code is written. In the example such as: > > for meaningless_variable in xrange(number_of_

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 19:59:23 +0100 Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Mike Meyer wrote: > >> What does "y=y" and "c=c" mean in the lambda function? > > > > Older versions of python didn't make variables in an outer scope > > visible in the inner scope. This was the standard idiom to work >

Re: Problem with Tkinter.PhotoImage

2008-01-10 Thread Fredrik Lundh
Cédric Lucantis wrote: > I can only load gif images with Tkinter.PhotoImage and none with BitmapImage. > I tried png, jpg, bmp and xpm and always got this errors : > img = Tkinter.PhotoImage(file='/home/omer/fgfs/fgsync/map.xpm') > Traceback (most recent call last): > File "", line 1, in

Persistent HTTP Connections with Python?

2008-01-10 Thread Scott Sharkey
Hello All, I am trying to write a python script to talk to an xml-based stock feed service. They are telling me that I must connect and login, and then "issue refresh requests" to fetch the data. This sounds a lot (to me) like HTTP 1.1 persistent connections. Can I do that with the urllib f

Re: Python too slow?

2008-01-10 Thread George Sakkis
On Jan 10, 3:37 am, Bruno Desthuilliers wrote: > I fail to see how the existence of JIT compilers in some Java VM changes > anything to the fact that both Java (by language specification) and > CPython use the byte-code/VM scheme. Because these "some Java VMs" with JIT compilers are the de facto

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Fredrik Lundh
Mike Meyer wrote: >> What does "y=y" and "c=c" mean in the lambda function? > > Older versions of python didn't make variables in an outer scope > visible in the inner scope. This was the standard idiom to work > around that. lexically scoped free variables and object binding are two different

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 10:25:27 -0800 (PST) "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm reading this page: > http://www.ps.uni-sb.de/~duchier/python/continuations.html > and I've found a strange usage of lambda: > > > Now, CPS would transform the baz function above in

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > > Now, CPS would transform the baz function above into: > > def baz(x,y,c): > mul(2,x,lambda v,y=y,c=c: add(v,y,c)) > > ### > > What does "y=y" and "c=c" mean in the lambda function? they bind the argument "y" to the *obje

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread [EMAIL PROTECTED]
You're talking about syntax from the bad old days when the scope rules were different. If not too archeological for your tastes, download and boot a 1.5 and see what happens. Less empirically, here're some key references: http://www.python.org/doc/2.2.3/whatsnew/node9.html http://www.python.org/

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread [EMAIL PROTECTED]
I've figured it out, it is default argument. print y() gives 13 as result. It's a bit evil though. I hope this post will be useful some newbie like i'm now someday :) On Jan 10, 7:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm reading this > page:http://www.ps.uni-sb.de/~duchier/py

Re: ISO Python example projects (like in Perl Cookbook)

2008-01-10 Thread Robert Hicks
On Jan 10, 11:13 am, kj <[EMAIL PROTECTED]> wrote: > I'm looking for "example implementations" of small projects in > Python, similar to the ones given at the end of most chapters of > The Perl Cookbook (2nd edition, isbn: 0596003137). (Unfortunately, > the otherwise excellent Python Cookbook (2nd

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Tim Chase
> What does "y=y" and "c=c" mean in the lambda function? the same thing it does in a function definition: def myfunct(a, b=42, y=3.141): pass > # > x = 3 > y = lambda x=x : x+10 > > print y(2) > ## > > It prints 12, so it doesn't bind the variable in th

Re: Collecting Rich Data Structures for students

2008-01-10 Thread [EMAIL PROTECTED]
On Jan 10, 1:01 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 9 Jan 2008 15:05:25 -0800 (PST), "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > Sometimes we spare the students (whomever they may be) this added > > step and just hand them a di

Re: urllib2 rate limiting

2008-01-10 Thread Rob Wolfe
Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > P.S. And something simpler: How can I disallow urllib2 to follow > redirections to foreign hosts? You need to subclass `urllib2.HTTPRedirectHandler`, override `http_error_301` and `http_error_302` methods and throw `urllib2.HTTPError` exception.

What is "lambda x=x : ... " ?

2008-01-10 Thread [EMAIL PROTECTED]
I'm reading this page: http://www.ps.uni-sb.de/~duchier/python/continuations.html and I've found a strange usage of lambda: Now, CPS would transform the baz function above into: def baz(x,y,c): mul(2,x,lambda v,y=y,c=c: add(v,y,c)) ### What does "y=

Re: subprocess "handle is invalid" error

2008-01-10 Thread Daniel Serodio
Thomas Heller-2 wrote: > > Grant Edwards schrieb: > > [snip] > >> >> Traceback (most recent call last): >> File "surfedit.py", line 28, in ? >> File "Gnuplot\_Gnuplot.pyc", line 178, in __init__ >> File "Gnuplot\gp_win32.pyc", line 117, in __init__ >> File "subprocess.pyc",

Re: Using a proxy with urllib2

2008-01-10 Thread Rob Wolfe
"Jack" <[EMAIL PROTECTED]> writes: > I'm trying to use a proxy server with urllib2. > So I have managed to get it to work by setting the environment > variable: > export HTTP_PROXY=127.0.0.1:8081 > > But I wanted to set it from the code. However, this does not set the proxy: > httpproxy = '127

Re: Python too slow?

2008-01-10 Thread Fredrik Lundh
A.T.Hofkamp wrote: > Now the question you need to answer for yourself, is how much more worth is > your own time compared to the gain in CPU time. If you think they are equal > (ie > the problem as a whole should be solved as fast as possible, thus the sum of > development time + execution time s

Re: Why my program (using pexpect to switch user) doesn't work well?

2008-01-10 Thread Noah
On Jan 10, 12:59 am, BlackjadeLin <[EMAIL PROTECTED]> wrote: > I'm new to python > I want to write a simple script to switch user,for example,from user_A > to user_B. > This my codes: > > #!/usr/bin/python > importpexpect > import os > passwd="user_B" > child =pexpect.spawn('su user_B') > child.exp

Re: run shell commands

2008-01-10 Thread Noah Dain
On Jan 10, 2008 9:24 AM, Riccardo Maria Bianchi <[EMAIL PROTECTED]> wrote: > > Hello! :) > > I'm trying to run shell commands both with os.system() and > subprocess.Popen() class. > > But I can't run aliases or function defined in my .bashrc file, like in > the login interactive shell. > > Can you

urllib2 rate limiting

2008-01-10 Thread Dimitrios Apostolou
Hello list, I want to limit the download speed when using urllib2. In particular, having several parallel downloads, I want to make sure that their total speed doesn't exceed a maximum value. I can't find a simple way to achieve this. After researching a can try some things but I'm stuck on th

Re: ISO Python example projects (like in Perl Cookbook)

2008-01-10 Thread ajcppmod
Have a look at Dive into Python by Mark Pilgrim. It is available for free here http://www.diveintopython.org/. Andy -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >