Writing Object Data to Disk

2007-09-21 Thread Amit Kumar Saha
Hello, I have a Python class with data members, say: class Foo: def __init__(self): self.a=7 self.b[]={1,3,4} #couple of more lists, tuples, etc I would like to know if "Pickling" the class object is the only way of writing

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Kay Schluehr
On 22 Sep., 00:36, Cristian <[EMAIL PROTECTED]> wrote: > Yeah, I agree, that does look pretty ugly. Correct me if I'm wrong, > but I thought the way Python determines a block is by the whitespace > of the first line. So, as long as the spacing (or !tabbing!) is > consistent from line to line the p

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread Marc 'BlackJack' Rintsch
On Fri, 21 Sep 2007 16:25:20 -0700, Python Maniac wrote: > On Sep 21, 3:02 pm, "Matt McCredie" <[EMAIL PROTECTED]> wrote: > >> Isn't D compiled to machine code? I would expect it to win hands down. >> That is, unless it is horribly unoptimized. >> >> > Well D code is compiled into machine code tha

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Paul Rubin
Carl Banks <[EMAIL PROTECTED]> writes: > Especially someone like an > engineer (in the classical sense), who isn't building versatile software > packages, won't need to resort to functional programming much. http://www.math.chalmers.se/~rjmh/Papers/whyfp.html -- http://mail.python.org/mailman/

Re: Who can develop the following Python script into working application ?

2007-09-21 Thread Marc 'BlackJack' Rintsch
On Fri, 21 Sep 2007 17:09:04 -0700, http://members.lycos.co.uk/dariusjack/ wrote: > On Sep 21, 1:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> > Is Python not fit to a task of this kind ? It is, and it should be quite simple. > Is there no a library of Python free scripts to accomplis

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Marc 'BlackJack' Rintsch
On Fri, 21 Sep 2007 19:52:41 -0400, Carl Banks wrote: > First of all, let me say that I think "functions as first class data" is > helpful, but not crucial, to programming in Python, and there are many > people who simply don't need the lesson. Especially someone like an > engineer (in the cla

Re: Getting rid of bitwise operators in Python 3?

2007-09-21 Thread Carl Banks
On Sat, 22 Sep 2007 05:06:42 +, Stargaming wrote: > On Fri, 21 Sep 2007 23:44:00 -0400, Carl Banks wrote: > >> Anyone with me here? (I know the deadline for P3 PEPs has passed; this >> is just talk.) >> >> Not many people are bit-fiddling these days. > > Why did we invent the `binary litera

Re: threading.local _threading_local problems

2007-09-21 Thread Gabriel Genellina
En Fri, 21 Sep 2007 14:36:34 -0300, Jd <[EMAIL PROTECTED]> escribi�: > Hi > I have the following situation.. Have a worker thread, that does the > "work" given to it. While doing work, some of the objects use thread > local storage for storing that requires explicit close. e.g. connection > hand

Re: Getting rid of bitwise operators in Python 3?

2007-09-21 Thread Grant Edwards
On 2007-09-22, Carl Banks <[EMAIL PROTECTED]> wrote: > Anyone with me here? (I know the deadline for P3 PEPs has passed; this > is just talk.) Not me. > Not many people are bit-fiddling these days. I do. > One of the main uses of bit fields is flags, but that's not > often done in Python bec

Re: Sets in Python

2007-09-21 Thread Bryan Olson
Gabriel Genellina wrote: > En Thu, 20 Sep 2007 08:46:29 -0300, Steven D'Aprano > >> Another way is to use this class: >> >> class HashableList(list): >> def __hash__(self): >> return hash(tuple(self)) > > ...and that will stop working as soon as the list is mutated (which is > exact

Re: Newbie completely confused

2007-09-21 Thread Gabriel Genellina
En Fri, 21 Sep 2007 13:34:40 -0300, Jeroen Hegeman <[EMAIL PROTECTED]> escribi�: > So the first time around the file gets read in in ~0.1 seconds, the > second time around it needs almost four seconds! As far as I can see > this is related to 'something in memory being copied around' since if >

Re: Getting rid of bitwise operators in Python 3?

2007-09-21 Thread Stargaming
On Fri, 21 Sep 2007 23:44:00 -0400, Carl Banks wrote: > Anyone with me here? (I know the deadline for P3 PEPs has passed; this > is just talk.) > > Not many people are bit-fiddling these days. Why did we invent the `binary literals`_ (0b101) then? > One of the main uses of > bit fields is fl

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread Python Maniac
On Sep 21, 4:48 pm, "Matt McCredie" <[EMAIL PROTECTED]> wrote: > > It would be nice if Python could be made to automatically detect the > > LC and string translation patterns used by the unoptimized Python code > > and make them into optimized Python code on the fly at runtime. I am > > more than

Re: Building Python with VC8 on x86-64 Vista

2007-09-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Though I don't know how useful it is, I did open the python libraries > in wordpad, and though most of the file wasn't legible, I did find > strings "Py_NoneStruct," "Py_RefTotal," and "PyExc_IndexError." Do you have some equivalent of t

Re: Killing A Process By PID

2007-09-21 Thread Michael Bentley
On Sep 20, 2007, at 7:46 PM, Arvind Singh wrote: file('/var/lock/Application.lock', 'w').write(str(os.getpid())) Which to be honest appears to run just fine, when I look in that file it always contains the correct process ID, for instance, 3419 or something like that. I honestly doubt th

Getting rid of bitwise operators in Python 3?

2007-09-21 Thread Carl Banks
Anyone with me here? (I know the deadline for P3 PEPs has passed; this is just talk.) Not many people are bit-fiddling these days. One of the main uses of bit fields is flags, but that's not often done in Python because of keyword arguments and dicts, which are lot more versatile. Another ma

Re: Newbie completely confused

2007-09-21 Thread John Machin
On Sep 22, 2:34 am, Jeroen Hegeman <[EMAIL PROTECTED]> wrote: [snip] > ...processing all 2 files found > --> 1/2: ./test_file0.txt > Now reading ... > DEBUG readLines A took 0.093 s > ...took 8.85717201233 seconds Your code does NOT include any statements that could have produced the above line of

Re: Zope review

2007-09-21 Thread Istvan Albert
On Sep 21, 7:04 pm, "Sean Tierney" <[EMAIL PROTECTED]> wrote: > someone could contrast Zope w/ another Python framework like Twisted. > I've been investing some time in learning Zope/Plone and would love to > hear someone speak to alternatives. Twisted is a networking engine, Zope is a web appli

Re: elementtree question

2007-09-21 Thread Mark T
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > En Fri, 21 Sep 2007 11:49:53 -0300, Tim Arnold <[EMAIL PROTECTED]> > escribi�: > >> Hi, I'm using elementtree and elementtidy to work with some HTML files. >> For >> some of these files I need to enclose the body

Gobject

2007-09-21 Thread Eduardo Matus
hi all... I'm trying to get a event when a pipe of a process is no longer receiving data, in this case a EOF... the process start with no problems... but... the gobject_io_add_watch does not trigger the test method when the file in mplayer has finish... any ideas?? Thks :) the codes is this (the r

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Scott David Daniels
Cristian wrote: > On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > >> I think key may be to discuss names and name binding with your friend. Here's an idea: import math def sin_integral(start, finish, dx): total = 0.0 y0 = math.sin(start) for n in range(1, 1 + int((finis

Re: Counting method calls

2007-09-21 Thread chris . monsanto
On Sep 21, 7:15 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Hi, I know I'm being dumb but, why does it not work? > > >>> class MyList(list): > > ... def __init__(self): > ... self.calls = 0 > ... def __getattr__(self, name): > ... self.calls += 1 > ... return list

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Steven D'Aprano
On Fri, 21 Sep 2007 22:07:55 +, Cristian wrote: > True, there is lambda, but that is very limited. It might be useful for > key arguments, but not much else. No, lambda is useful for anything that any other function is useful for, provided that you can write it as a single expression and not

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Ron Adam
Cristian wrote: > On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > >> I think key may be to discuss names and name binding with your friend. How >> a name is not the object it self, like a variable is in other languages. >> For example show him how an object can have more than one name

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Carl Banks
On Fri, 21 Sep 2007 21:37:18 +, Cristian wrote: > Although his learning experience has gone mostly smoothly, he's hit a > lot of speed bumps with functions. Specifically, he's having trouble > thinking of functions as first order data (don't worry, I haven't > confused him with such terminology

Is it possible to grab headers after you login to a site?

2007-09-21 Thread Lamonte Harris
For instance cookie headers? I want to login to a site and make sure the site remembers im logged in using python and cgi. -- http://mail.python.org/mailman/listinfo/python-list

Re: Who can develop the following Python script into working application ?

2007-09-21 Thread http://members.lycos.co.uk/dariusjack/
On Sep 21, 1:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > Please help and let me know your terms. > > There are websites dedicated to this - like e.g. > > http://www.guru.com/ > > Make an offer there. > > Diez Ok Diez, Do you really think only Gurus from Guru.com can help me ? Do

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Cristian
On Sep 21, 4:47 pm, "Sean Tierney" <[EMAIL PROTECTED]> wrote: > Just tell him that "functions are like all other variables and can > therefore be passed by other functions or returned by other functions. > " > I could """Just tell him that "functions are like all other variables and can theref

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Cristian
On Sep 21, 4:27 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > Cristian wrote: > > On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > > >> I think key may be to discuss names and name binding with your friend. How > >> a name is not the object it self, like a variable is in other language

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Sean Tierney
On 9/21/07, Sean Tierney <[EMAIL PROTECTED]> wrote: > Just tell him that "functions are like all other variables and can > therefore be passed by other functions or returned by other functions. > " > > If your friend understands variables and functions and he can't make > the "leap" (and assuming

How I import xls file

2007-09-21 Thread hassen62
Hi, I have installed xlrd for windows but I can't used it succesfully. If I have a file "file.xls", what lines I can write from python to import and visualize this file. Thank you.-- http://mail.python.org/mailman/listinfo/python-list

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread Matt McCredie
> It would be nice if Python could be made to automatically detect the > LC and string translation patterns used by the unoptimized Python code > and make them into optimized Python code on the fly at runtime. I am > more than a little amazed nobody has chosen to build a JIT (Just In- > Time compi

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Sean Tierney
Just tell him that "functions are like all other variables and can therefore be passed by other functions or returned by other functions. " If your friend understands variables and functions and he can't make the "leap" (and assuming you're right, of course) then your friend doesn't understand va

Re: Calling constructor but not initializer

2007-09-21 Thread Steven D'Aprano
On Fri, 21 Sep 2007 10:47:02 -0400, Steve Holden wrote: [snippity-doo-dah] >> but of course __init__ is automatically called. >> >> >> Any suggestions for doing something like this? >> >> > Easy: use a method whose name is something other than __init__, then > don't bother to implement __init

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Cristian <[EMAIL PROTECTED]> wrote: ... > To someone who's learning to program wouldn't a syntax like the > further give them all they need and also reinforces the idea that > functions are data just like everything else? > > my_function = function(foo, bar): pass

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread Python Maniac
On Sep 21, 3:02 pm, "Matt McCredie" <[EMAIL PROTECTED]> wrote: > > Now I think I will code this little scrambler using nothing but the D > > Language just to see whether there is any benefit in using D over > > Python for this sort of problem. > > Isn't D compiled to machine code? I would expect it

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread J. Cliff Dyer
Cristian wrote: > On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > > >> I think key may be to discuss names and name binding with your friend. How >> a name is not the object it self, like a variable is in other languages. >> For example show him how an object can have more than one na

Counting method calls

2007-09-21 Thread Ricardo Aráoz
Hi, I know I'm being dumb but, why does it not work? >>> class MyList(list): ... def __init__(self): ... self.calls = 0 ... def __getattr__(self, name): ... self.calls += 1 ... return list.__getattribute__(self, name) >>> a = MyList() >>> a [] >>> a.append(1) >>> a

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Cristian
On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > I think key may be to discuss names and name binding with your friend. How > a name is not the object it self, like a variable is in other languages. > For example show him how an object can have more than one name. And discus > how names

Re: Zope review

2007-09-21 Thread Sean Tierney
It might help if someone could contrast Zope w/ another Python framework like Twisted. I've been investing some time in learning Zope/Plone and would love to hear someone speak to alternatives. "part of the brain" -- would that speak to the "event-based" approach of Twisted? The "event-based" a

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Ron Adam
Cristian wrote: > My hope is to subtly reinforce the notion that functions are data > and can be passed around. The current function declaration doesn't > help with this. Creating a function and assigning it to a name is > exactly what Python does, why not have it come out in the syntax? It's > n

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Cristian
On Sep 21, 3:22 pm, [EMAIL PROTECTED] wrote: > On Sep 21, 6:07 pm, Cristian <[EMAIL PROTECTED]> wrote: > > > > > On Sep 21, 2:48 pm, [EMAIL PROTECTED] wrote: > > > > There are already anonymous functions in Python. > > > > lambda x, y, z: x + y + z > > > > is the same as: > > > > def _(x, y, z): re

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread chris . monsanto
On Sep 21, 6:07 pm, Cristian <[EMAIL PROTECTED]> wrote: > On Sep 21, 2:48 pm, [EMAIL PROTECTED] wrote: > > > > > There are already anonymous functions in Python. > > > lambda x, y, z: x + y + z > > > is the same as: > > > def _(x, y, z): return x + y + z > > > As for the method stuff, check out sta

Re: elementtree question

2007-09-21 Thread Gabriel Genellina
En Fri, 21 Sep 2007 11:49:53 -0300, Tim Arnold <[EMAIL PROTECTED]> escribi�: > Hi, I'm using elementtree and elementtidy to work with some HTML files. > For > some of these files I need to enclose the body content in a new div tag, > like this: > > >original contents... > > > > I f

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Cristian
On Sep 21, 2:48 pm, [EMAIL PROTECTED] wrote: > There are already anonymous functions in Python. > > lambda x, y, z: x + y + z > > is the same as: > > def _(x, y, z): return x + y + z > > As for the method stuff, check out staticmethod(). If you assign > staticmethod() to an object, it will be treat

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread Matt McCredie
> Now I think I will code this little scrambler using nothing but the D > Language just to see whether there is any benefit in using D over > Python for this sort of problem. Isn't D compiled to machine code? I would expect it to win hands down. That is, unless it is horribly unoptimized. Matt --

Re: RE Help

2007-09-21 Thread J. Cliff Dyer
Thomas Jollans wrote: > On Friday 21 September 2007, [EMAIL PROTECTED] wrote: > >> Not specific to Python, but it will be implemented in it... how do I >> compile a RE to catch everything between two know values? Here's what >> I've tried (but failed) to accomplish... the knowns here are START a

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread George Sakkis
On Sep 21, 1:00 pm, Python Maniac <[EMAIL PROTECTED]> wrote: > My best runtime with Ruby using the same machine and OS was 67.797 > secs which is 29.8x slower than the fastest Python runtime. This > makes Ruby almost as slow as Python was made faster. The irony with > Ruby was that the use of a

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread chris . monsanto
On Sep 21, 5:37 pm, Cristian <[EMAIL PROTECTED]> wrote: > A friend of mine is an engineer and he's been needing to do more and > more programming as he goes on with is career. I convinced him to > learn Python instead of Perl and he's really started to like it. He > usually comes to me when he can'

Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread Cristian
A friend of mine is an engineer and he's been needing to do more and more programming as he goes on with is career. I convinced him to learn Python instead of Perl and he's really started to like it. He usually comes to me when he can't accomplish a task with his current knowledge and I introduce h

Re: An Editor that Skips to the End of a Def

2007-09-21 Thread Steven W. Orr
On Thursday, Sep 20th 2007 at 18:14 +0100, quoth Paul Rudin: =>"W. Watson" <[EMAIL PROTECTED]> writes: => =>> Thanks, but no thanks. The learning curve is way too steep. => =>Up to you but, these days emacs comes with all sorts of =>pointing-clicky-menu-y type things - you don't really have to lea

Re: newb: Simple regex problem headache

2007-09-21 Thread Erik Jones
On Sep 21, 2007, at 4:04 PM, crybaby wrote: > import re > > s1 =' 25000 ' > s2 = ' 5.5910 ' > > mypat = re.compile('[0-9]*(\.[0-9]*|$)') > rate= mypat.search(s1) > print rate.group() > > rate=mypat.search(s2) > print rate.group() > rate = mypat.search(s1) > price = float(rate.group()) > print pri

Re: newb: Simple regex problem headache

2007-09-21 Thread Ian Clark
crybaby wrote: > import re > > s1 =' 25000 ' > s2 = ' 5.5910 ' > > mypat = re.compile('[0-9]*(\.[0-9]*|$)') > rate= mypat.search(s1) > print rate.group() > > rate=mypat.search(s2) > print rate.group() > rate = mypat.search(s1) > price = float(rate.group()) > print price > > I get an error when

Re: Resolving windows shortcut to url

2007-09-21 Thread Richard Townsend
On Fri, 21 Sep 2007 22:29:37 +0200, Ivo <[EMAIL PROTECTED]> wrote: >Ivo wrote: >> Richard Townsend wrote: >>> If I have a windows shortcut to a URL, is there a way to get the URL >>> in a Python app? >>> >>> I found some code that uses pythoncom to resolve shortcuts to local >>> files, but I haven

Re: newb: Simple regex problem headache

2007-09-21 Thread chris . monsanto
On Sep 21, 5:04 pm, crybaby <[EMAIL PROTECTED]> wrote: > import re > > s1 =' 25000 ' > s2 = ' 5.5910 ' > > mypat = re.compile('[0-9]*(\.[0-9]*|$)') > rate= mypat.search(s1) > print rate.group() > > rate=mypat.search(s2) > print rate.group() > rate = mypat.search(s1) > price = float(rate.group()) >

newb: Simple regex problem headache

2007-09-21 Thread crybaby
import re s1 =' 25000 ' s2 = ' 5.5910 ' mypat = re.compile('[0-9]*(\.[0-9]*|$)') rate= mypat.search(s1) print rate.group() rate=mypat.search(s2) print rate.group() rate = mypat.search(s1) price = float(rate.group()) print price I get an error when it hits the whole number, that is in this forma

Re: Google and Python

2007-09-21 Thread Paul Rubin
David <[EMAIL PROTECTED]> writes: > Another method is for the apps to run continuously and serve on non-80 > port (or on 80 from another host), and your main web server on port 80 > reverse proxies to it when appropriate. You can also pass the open sockets around between processes instead of rever

Re: An Editor that Skips to the End of a Def

2007-09-21 Thread W. Watson
Well, you may. Unfortunately, there are many NGs that do the opposite. Bruno Desthuilliers wrote: > W. Watson a écrit : >> How about in the case of MS Win? >> >> Ben Finney wrote: >>> >>> (Please don't top-post. Instead, reply below each point to which >>> you're responding, removing quoted text i

Re: RE Help

2007-09-21 Thread chris . monsanto
On Sep 21, 4:09 pm, Thomas Jollans <[EMAIL PROTECTED]> wrote: > On Friday 21 September 2007, [EMAIL PROTECTED] wrote: > > > Not specific to Python, but it will be implemented in it... how do I > > compile a RE to catch everything between two know values? Here's what > > I've tried (but failed) to a

Re: Resolving windows shortcut to url

2007-09-21 Thread Ivo
Ivo wrote: > Richard Townsend wrote: >> If I have a windows shortcut to a URL, is there a way to get the URL >> in a Python app? >> >> I found some code that uses pythoncom to resolve shortcuts to local >> files, but I haven't found any examples for URLs. >> >> The PyWin32 help mentions the PyIUnif

Re: Resolving windows shortcut to url

2007-09-21 Thread Ivo
Ivo wrote: > Richard Townsend wrote: >> If I have a windows shortcut to a URL, is there a way to get the URL >> in a Python app? >> >> I found some code that uses pythoncom to resolve shortcuts to local >> files, but I haven't found any examples for URLs. >> >> The PyWin32 help mentions the PyIUnif

Re: executing list of methods (and collecting results)

2007-09-21 Thread David
> I wondering if is this a good pattern to apply, i like the way it looks > like, at least to me it looks `natural', but...im calling every method > twice here? One in v_dict and again on the dict iteration? > > Any suggestion will be great! Another suggestion is to use a naming convention for you

Re: uninstall python2.5 on debian

2007-09-21 Thread cyberco
On Sep 18, 9:03 am, "dimitri pater" <[EMAIL PROTECTED]> wrote: > Hello, > both python2.3 and python2.5 are installed on my Debian webserver. For > some reason, I would like to uninstall Python2.5 which was installed > from source (make install) and keep 2.3. > I have tried make uninstall and search

Re: RE Help

2007-09-21 Thread Thomas Jollans
On Friday 21 September 2007, [EMAIL PROTECTED] wrote: > Not specific to Python, but it will be implemented in it... how do I > compile a RE to catch everything between two know values? Here's what > I've tried (but failed) to accomplish... the knowns here are START and > END: > > data = "asdfasgSTA

Re: An Editor that Skips to the End of a Def

2007-09-21 Thread Matthew Woodcraft
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >In message <[EMAIL PROTECTED]>, John J. Lee wrote: >> Seriously for a moment, I read something recently (maybe here?) about >> an Apple study that claimed to show that people who perceived keyboard >> bindings as being much faster than mouseing did

Re: Resolving windows shortcut to url

2007-09-21 Thread Ivo
Richard Townsend wrote: > If I have a windows shortcut to a URL, is there a way to get the URL > in a Python app? > > I found some code that uses pythoncom to resolve shortcuts to local > files, but I haven't found any examples for URLs. > > The PyWin32 help mentions the PyIUniformResourceLocator

which python mode to use in emacs

2007-09-21 Thread Emin.shopper Martinian.shopper
Dear Experts, There seem to be multiple versions of python modes for emacs? Could someone point me to the mainterers of either the "official" one or the one that is being maintained most vigorously? I've tried both python.el and python-mode.el. Both seem to have various minor foibles which I'd be

Re: elementtree question

2007-09-21 Thread Ivo
Tim Arnold wrote: > Hi, I'm using elementtree and elementtidy to work with some HTML files. For > some of these files I need to enclose the body content in a new div tag, > like this: > > >original contents... > > > > I figure there must be a way to do it by creating a 'div' SubEleme

Re: RE Help

2007-09-21 Thread chris . monsanto
On Sep 21, 3:32 pm, [EMAIL PROTECTED] wrote: > > You'll want to use a non-greedy match: > > x = re.compile(r"START(.*?)END", re.DOTALL) > > Otherwise the . will match END as well. > > On Sep 21, 3:23 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > > > Only if there's a later END in the string, in whi

Re: Python Regex Question

2007-09-21 Thread David
> re.search(expr, string) compiles and searches every time. This can > potentially be more expensive in calculating power. especially if you > have to use the expression a lot of times. The re module-level helper functions cache expressions and their compiled form in a dict. They are only compiled

Re: Zope review

2007-09-21 Thread Istvan Albert
On Sep 20, 7:44 pm, Norm <[EMAIL PROTECTED]> wrote: > without meaning to start a flame war between the various python web > tools, I was wondering if anyone had a review of the status of Zope. > For example, is it being used for new projects or just maintenance? Zope is heavily used. It is a matu

Re: RE Help

2007-09-21 Thread J. Clifford Dyer
On Fri, Sep 21, 2007 at 12:05:51PM -0700, [EMAIL PROTECTED] wrote regarding Re: RE Help: > > > > > x = re.compile('START(.*)END', re.DOTALL) > > You'll want to use a non-greedy match: > > x = re.compile(r"START(.*?)END", re.DOTALL) > > Otherwise the . will match END as well. The . will only c

Re: RE Help

2007-09-21 Thread byte8bits
> You'll want to use a non-greedy match: > x = re.compile(r"START(.*?)END", re.DOTALL) > Otherwise the . will match END as well. On Sep 21, 3:23 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Only if there's a later END in the string, in which case the user's > requirements will determine whether

Resolving windows shortcut to url

2007-09-21 Thread Richard Townsend
If I have a windows shortcut to a URL, is there a way to get the URL in a Python app? I found some code that uses pythoncom to resolve shortcuts to local files, but I haven't found any examples for URLs. The PyWin32 help mentions the PyIUniformResourceLocator Object, but I couldn't find an exampl

Re: Google and Python

2007-09-21 Thread David
> OK, thanks. Would you know what technique the custom web server uses > to invoke a C++ app (ditto for Java and Python) CGI is supposed to be > too slow for large sites. For large sites you would have modules loaded into your web server so that executables don't have to be shelled for each reques

Re: RE Help

2007-09-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Sep 21, 2:44 pm, David <[EMAIL PROTECTED]> wrote: >>> data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" >>> x = re.compile('START.END', re.DOTALL) >> This should work: >> >> x = re.compile('START(.*)END', re.DOTALL) > > You'll want to use a non-greedy match: > >

Re: xml-rpc timeout

2007-09-21 Thread Steve Holden
Jd wrote: > Steve Holden wrote: >> Jd wrote: >>> Hi >>>I have a multi-threaded application. For certain operations to the >>> server, I would like to explicitly set timeout so that I get correct >>> status from the call and not timed out exception. >>>Does anyone know how to go about doing

Re: Remote Command a Python Script

2007-09-21 Thread Ivo
Ulysse wrote: > Hello, > > I've installed Python 2.5 on my WRT54G Linksys Router. On this router > a script is executed. This script write a little Pickle database in > the router memory. > > I would like to write another Python script which will be able to : > > 1. Stop and start the remote scr

Re: RE Help

2007-09-21 Thread chris . monsanto
On Sep 21, 2:44 pm, David <[EMAIL PROTECTED]> wrote: > > data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" > > x = re.compile('START.END', re.DOTALL) > > This should work: > > x = re.compile('START(.*)END', re.DOTALL) You'll want to use a non-greedy match: x = re.compile(r"START(.*?)END", re.

Re: Python Regex Question

2007-09-21 Thread Ivo
crybaby wrote: > On Sep 20, 4:12 pm, Tobiah <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> I need to extract the number on each >> i.e 49.950 from the following: >>>  49.950  >>> The actual number between:  49.950  can be any number of >>> digits before decimal and after decimal. >>>  #

Re: xml-rpc timeout

2007-09-21 Thread Jd
Steve Holden wrote: > Jd wrote: >> Hi >>I have a multi-threaded application. For certain operations to the >> server, I would like to explicitly set timeout so that I get correct >> status from the call and not timed out exception. >>Does anyone know how to go about doing it ? >> > The easi

Re: RE Help

2007-09-21 Thread David
> data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" > x = re.compile('START.END', re.DOTALL) This should work: x = re.compile('START(.*)END', re.DOTALL) -- http://mail.python.org/mailman/listinfo/python-list

RE Help

2007-09-21 Thread byte8bits
Not specific to Python, but it will be implemented in it... how do I compile a RE to catch everything between two know values? Here's what I've tried (but failed) to accomplish... the knowns here are START and END: data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" x = re.compile('START.END', r

Re: TRying to import files from my folder not pythons lib folder

2007-09-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Sep 21, 12:32 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: >> Hi, >> >> I'm trying to create my own lib of functions, but it seems like I can >> only import them if they are in pythons lib folder. >> >> Example >> I have a folder called >> K:\mypython >> >> Now

Re: Parameterize formatting string

2007-09-21 Thread Jean-Paul Calderone
On Fri, 21 Sep 2007 20:16:29 +0200, David <[EMAIL PROTECTED]> wrote: >On 9/21/07, cyril giraudon <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I 'd like to know if a std::setw() equivalent function exists in >> python ? >> >> i thought of something like : >> >> a = 16 >> "%ai" % 12 >> >> But it is not

Re: Parameterize formatting string

2007-09-21 Thread Carsten Haese
On Fri, 2007-09-21 at 20:16 +0200, David wrote: > Or, more ugly: > > "%%%di" % a % 12 Or, less ugly: "%*i" % (a,12) -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Parameterize formatting string

2007-09-21 Thread David
On 9/21/07, cyril giraudon <[EMAIL PROTECTED]> wrote: > Hello, > > I 'd like to know if a std::setw() equivalent function exists in > python ? > > i thought of something like : > > a = 16 > "%ai" % 12 > > But it is not correct. > > Any Idea ? ("%i" % 12).rjust(a) Or, more ugly: "%%%di" % a % 12

Re: Odd files; just left behind?

2007-09-21 Thread Robert Kern
Robin Becker wrote: > Bruno Desthuilliers wrote: >> Robin Becker a écrit : >>> John J. Lee wrote: >>> Robin Becker <[EMAIL PROTECTED]> writes: > I see a folder .python-eggs in my home directory on one of our servers > with various .so files > > ~/.python-eggs/MySQL_python-

Parameterize formatting string

2007-09-21 Thread cyril giraudon
Hello, I 'd like to know if a std::setw() equivalent function exists in python ? i thought of something like : a = 16 "%ai" % 12 But it is not correct. Any Idea ? Thanks a lot, Cyril. -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope review

2007-09-21 Thread Ross Patterson
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Norm a écrit : >> Hi, >> >> without meaning to start a flame war between the various python web >> tools, I was wondering if anyone had a review of the status of Zope. >> For example, is it being used for new projects or just maintenance? >> >> I

Re: TRying to import files from my folder not pythons lib folder

2007-09-21 Thread kyosohma
On Sep 21, 12:32 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to create my own lib of functions, but it seems like I can > only import them if they are in pythons lib folder. > > Example > I have a folder called > K:\mypython > > Now in the interactive python shell I type

Re: xml-rpc timeout

2007-09-21 Thread Steve Holden
Jd wrote: > Hi >I have a multi-threaded application. For certain operations to the > server, I would like to explicitly set timeout so that I get correct > status from the call and not timed out exception. >Does anyone know how to go about doing it ? > The easiest way is to use socket.setd

threading.local _threading_local problems

2007-09-21 Thread Jd
Hi I have the following situation.. Have a worker thread, that does the "work" given to it. While doing work, some of the objects use thread local storage for storing that requires explicit close. e.g. connection handles. These objects are long living. The worker, does not have any direct access

TRying to import files from my folder not pythons lib folder

2007-09-21 Thread [EMAIL PROTECTED]
Hi, I'm trying to create my own lib of functions, but it seems like I can only import them if they are in pythons lib folder. Example I have a folder called K:\mypython Now in the interactive python shell I type Import k:\mypython\listall And get a error on : If I store listall.py in pythons li

xml-rpc timeout

2007-09-21 Thread Jd
Hi I have a multi-threaded application. For certain operations to the server, I would like to explicitly set timeout so that I get correct status from the call and not timed out exception. Does anyone know how to go about doing it ? /Jd -- http://mail.python.org/mailman/listinfo/python-list

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread Python Maniac
On Sep 21, 12:56 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > It has to do with the input string length; try multiplying it by 10 or > > 100. Below is a more complete benchmark; for largish strings, the imap > > version is the fastest among those using

Newbie completely confused

2007-09-21 Thread Jeroen Hegeman
Dear Pythoneers, I'm moderately new to python and it got me completely lost already. I've got a bunch of large (30MB) txt files containing one 'event' per line. I open files after each other, read them line by line and from each line build a 'data structure' of a main class (HugeClass) cont

Re: calling extension's autoconf/make from distutils

2007-09-21 Thread Steve Holden
Gary Jefferson wrote: > On Sep 20, 10:43 pm, Gary Jefferson <[EMAIL PROTECTED]> > wrote: >> I've got a python extension that comes with its own standard autoconf/ >> automake system, and I can "python setup.py build" just fine with it >> as long as I have previously done "./configure" in that direc

Re: calling extension's autoconf/make from distutils

2007-09-21 Thread Steve Holden
Gary Jefferson wrote: > On Sep 20, 10:43 pm, Gary Jefferson <[EMAIL PROTECTED]> > wrote: >> I've got a python extension that comes with its own standard autoconf/ >> automake system, and I can "python setup.py build" just fine with it >> as long as I have previously done "./configure" in that direc

Re: acronym program

2007-09-21 Thread Ian Clark
Shawn Minisall wrote: > I'm trying to write a program that gets the first letter of every word > of a phrase and prints it on screen. I'm having problems with it. I'm > thinking a for loop would be good since I don't know the exact number of > words the user is going to enter, but after that I

  1   2   >