Re: Class variable inheritance

2009-09-09 Thread Carl Banks
On Sep 8, 11:05 pm, HPJ wrote: > And by the way, the reason I've come across this problem at all is > because I have something like this: > > class A: >   class X: >     n = 'a' >   x = X() > > class B(A): >   class X(A.X): >     n = 'b' > # x = X() You've nested classes here, that's a whole new

Re: Class variable inheritance

2009-09-09 Thread Chris Rebert
On Tue, Sep 8, 2009 at 11:30 PM, Steven D'Aprano wrote: > Out of curiosity, are there languages where inheritance means copy? I think some prototype-based ones handle it that way... Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I post to the wxPython mailing list?

2009-09-09 Thread Neil Hodgson
PythonAB: > No, but it means that more of my data goes into the same company. > There's no way to use my own email accounts from my own domain, > and I don't have a choice anymore. I just checked and it allowed me to use an account from my domain so I expect it will work with yours. > In othe

Re: Why does this group have so much spam?

2009-09-09 Thread Albert van der Horst
In article , Tino Wildenhain wrote: > >Here is another idea: for spam senders pointing to servers under=20 >jurisdiction, size the server and check all incoming requests >from users - if they try to do a deal, prosecute a few of them >in the public for supporting a crime. (And of course if possi

Re: Extracting patterns after matching a regex

2009-09-09 Thread Mart.
On Sep 8, 4:33 pm, MRAB wrote: > Mart. wrote: > > On Sep 8, 3:53 pm, MRAB wrote: > >> Mart. wrote: > >>> On Sep 8, 3:14 pm, "Andreas Tawn" wrote: > >>> Hi, > >>> I need to extract a string after a matching a regular expression. For > >>> example I have the string... > >>> s = "FT

Re: Re: Distutils - can user designate install directory for windows installer?

2009-09-09 Thread Timothy W. Grove
Mark Hammond wrote: On 9/09/2009 1:57 AM, Timothy W. Grove wrote: I have successfully built a windows installer for my python program using distutils, (python setup.py bdist_wininst), but is there a way to do it that will allow a user ('user' == 'boss', in this case!) to designate the installa

uses for setup.cfg and extracting data from it

2009-09-09 Thread Chris Withers
Hi All, Do people generally source control their package's setup.cfg? http://docs.python.org/distutils/configfile.html sort of implies it should be editable by the person installing the package, but I've never personally used a package where that's the case... Assuming the distutils docs are

How can I format unicode strings?

2009-09-09 Thread gentlestone
return u"{}".format(self.name) this one doesn't work on unicode strings. I there a not old formatting style possibilty for unicode strings? Note: self.name can be unicode string! -- http://mail.python.org/mailman/listinfo/python-list

[Tkinter] messed callbacks

2009-09-09 Thread Giacomo Boffi
i have this test program (that i already posted on it.comp.lang.python) [ test.py ] from Tkinter import * def output(s): print s def doit(fr,lst): for c1,c2 in zip(lst[::2], lst[1::2]): subframe=Frame(fr) Label(subframe,text=c1+' <-> '+c2).pack(side='left',expand=1,fill='both')

Re: [Tkinter] messed callbacks

2009-09-09 Thread Diez B. Roggisch
Giacomo Boffi wrote: > i have this test program (that i already posted on it.comp.lang.python) > > [ test.py ] > from Tkinter import * > > def output(s): > print s > > def doit(fr,lst): > for c1,c2 in zip(lst[::2], lst[1::2]): > subframe=Frame(fr) > Label(subframe,text=c1+' <->

Re: How can I format unicode strings?

2009-09-09 Thread Tim Northover
gentlestone writes: > return u"{}".format(self.name) > > this one doesn't work on unicode strings. I there a not old formatting > style possibilty for unicode strings? It looks like you're trying to mix python 3.1 and 2.6. In 2.6 you have to put a number inside the {} to tell it which argument

Re: Class variable inheritance

2009-09-09 Thread HPJ
> Maybe.  For some languages this might be an obvious behavior, but > Python would have different circumstances so it isn't so obvious (or > possible) there. Which means this topic definitely needs to be handled in detail by the LR, and preferably also in the Tutorial. Otherwise there is no way an

Re: How can I format unicode strings?

2009-09-09 Thread Patrick Sabin
gentlestone schrieb: return u"{}".format(self.name) u"{0}".format(u"blah") works for me with python-2.6.2 Maybe your format string is wrong. - Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I format unicode strings?

2009-09-09 Thread gentlestone
On 9. Sep., 12:31 h., Tim Northover wrote: > gentlestone writes: > >  return u"{}".format(self.name) > > > this one doesn't work on unicode strings. I there a not old formatting > > style possibilty for unicode strings? > > It looks like you're trying to mix python 3.1 and 2.6. In 2.6 you have >

Re: How can I format unicode strings?

2009-09-09 Thread Niklas Norrthon
On 9 Sep, 12:49, gentlestone wrote: > > I have python 2.5 > > return u'{0}'.format(self.name) > > doesn't work eigther > > the error message i've got is: > > 'unicode' object has no attribute 'format' > > is the new formatting style newer then python 2.5? Yes. The new string formatting appeared i

Re: How can I format unicode strings?

2009-09-09 Thread Duncan Booth
gentlestone wrote: > the error message i've got is: > > 'unicode' object has no attribute 'format' > > is the new formatting style newer then python 2.5? > > Have you tried reading the documentation? It generally tells you which version of Python introduced a feature: http://docs.python.org

Re: [Tkinter] messed callbacks

2009-09-09 Thread Giacomo Boffi
"Diez B. Roggisch" writes: > Giacomo Boffi wrote: > >> def doit(fr,lst): >> for c1,c2 in zip(lst[::2], lst[1::2]): >> subframe=Frame(fr) >> Label(subframe,text=c1+' <-> >> '+c2).pack(side='left',expand=1,fill='both') >> Button(subframe,text='>',command=lambda: output(c1+'->'+c2)

Some issue with easy_install and PIL/Imaging

2009-09-09 Thread Klein Stéphane
Hi, I would like to insert Imaging dependence in my setup.py file. Resume : 1. first question : why PIL package in "pypi" don't work ? 2. second question : when I add PIL dependence in my setup.py and I do "python setup.py develop", I've this error : "error: Could not find required distrib

Re: [Tkinter] messed callbacks

2009-09-09 Thread Giacomo Boffi
Giacomo Boffi writes: > ok, i'll try again following your advice ,[ test.py ] | from Tkinter import * | | def output(s): | print s | | def create_cb(a,b): | return lambda: output(a+'->'+b) | | def doit(fr,lst): | for c1,c2 in zip(lst[::2], lst[1::2]): | subframe=Frame(fr) |

Re: Extracting patterns after matching a regex

2009-09-09 Thread MRAB
Mart. wrote: On Sep 8, 4:33 pm, MRAB wrote: Mart. wrote: On Sep 8, 3:53 pm, MRAB wrote: Mart. wrote: On Sep 8, 3:14 pm, "Andreas Tawn" wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s = "FTPHOST: e4ftl01u.ecs.nasa.gov" and onc

\r\n or \n notepad editor end line ???

2009-09-09 Thread Sphoorti.Patil
Hey Terry, That was a very useful tip I got about the Escape Sequences.. \r and \n Regards, Sphoorti Digambar Patil Software Engineer * SunGard * Technology Services * Embassy Icon 3, Infantry Road, Bangalore India * HOME - (205)969-1798*Tel +91-80--0501 * Extn 3154 * Fax +91-80

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-09 Thread Chris Withers
Sverker Nilsson wrote: But I don't think I would want to risk breaking someone's code just for this when we could just add a new method. I don't think anyone will be relying on StopIteration being raised. If you're worried, do the next release as a 0.10.0 release and explain the backwards inco

Re: uses for setup.cfg and extracting data from it

2009-09-09 Thread Ben Finney
Chris Withers writes: > Do people generally source control their package's setup.cfg? Yes. I prefer the distribution metadata to be declarative, for the reasons you touch on later in your message. So where it makes sense I store it in ‘setup.cfg’ or some other declarative file, and put it under

Re: "Rapid GUI Programming with Python and Qt" source code

2009-09-09 Thread David Boddie
On Wed Sep 9 07:11:26 CEST 2009, Steven Woody wrote: > *I've searched google and cannot find a valid link for the source code of > the book "Rapid GUI Programming with Python and Qt". Could anyone please > give me a non-broken URL?* See this page for the links: http://www.qtrac.eu/pyqtbook.htm

Open Position: Software/System Engineer....Python....

2009-09-09 Thread James
Hello All I do not know if this is the correct forum. I am looking for a Software/System Engineer with Python experience in the Cleveland, OH area. The skill set looks like this: Skills/Qualifications: • Working in a dynamic, self motivated environment with minimal supervision in a small f

Re: Open Position: Software/System Engineer....Python....

2009-09-09 Thread Diez B. Roggisch
James wrote: > Hello All > I do not know if this is the correct forum. I am looking for a > Software/System Engineer with Python experience in the Cleveland, OH > area. The skill set looks like this: > > Skills/Qualifications: > • Working in a dynamic, self motivated environment with minima

Re: Open Position: Software/System Engineer....Python....

2009-09-09 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > James wrote: > >> Hello All >> I do not know if this is the correct forum. I am looking for a >> Software/System Engineer with Python experience in the Cleveland, OH >> area. The skill set looks like this: >> >> Skills/Qualifications: >> • Working in a dynamic, se

Re: Open Position: Software/System Engineer....Python....

2009-09-09 Thread James
On Sep 9, 10:06 am, "Diez B. Roggisch" wrote: > Diez B. Roggisch wrote: > > James wrote: > > >> Hello All > >> I do not know if this is the correct forum.  I am looking for a > >> Software/System Engineer with Python experience in the Cleveland, OH > >> area.  The skill set looks like this: > > >>

Re: [Tkinter] messed callbacks

2009-09-09 Thread Scott David Daniels
Giacomo Boffi wrote: Giacomo Boffi writes: ... | def create_cb(a,b): | return lambda: output(a+'->'+b) | | def doit(fr,lst): | for c1,c2 in zip(lst[::2], lst[1::2]): | subframe=Frame(fr) | Label(subframe,text=c1+' <-> '+c2).pack(side='left',expand=1,fill='both') | Button(su

Re: [Distutils] uses for setup.cfg and extracting data from it

2009-09-09 Thread P.J. Eby
At 11:25 PM 9/9/2009 +1000, Ben Finney wrote: That's one of the pain points of the current distutils capability: there's no standard-library way to extract that information. If you're talking about setup.cfg (and all the other distutils .cfg files), all you need to do is create a Distribution

Re: hanning python

2009-09-09 Thread pdpi
On Sep 9, 3:27 am, sturlamolden wrote: > On 9 Sep, 00:24, Steven D'Aprano > > wrote: > > A decent vendor-supplied implementation will include error checking that > > you otherwise would need to implement yourself, so yes. > > Not for code like this: > > > > >>> import numpy as np > >>> n = np.ara

ANNOUNCE: Leo 4.7 beta 1 released

2009-09-09 Thread Edward K Ream
Leo 4.7 beta 1 is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.html This version of Leo is labeled a beta version because it conta

Re: hanning python

2009-09-09 Thread pdpi
On Sep 9, 3:46 pm, pdpi wrote: > On Sep 9, 3:27 am, sturlamolden wrote: > > > On 9 Sep, 00:24, Steven D'Aprano > > > wrote: > > > A decent vendor-supplied implementation will include error checking that > > > you otherwise would need to implement yourself, so yes. > > > Not for code like this: >

logging sound / speech handler?

2009-09-09 Thread Gregor Horvath
Hi, For an application in an industrial environment where the workers are not always sitting in front of the monitor, but are within earshot of the PC I would need an sound / speech handler for the standard logging system. It should beep or better say the logging message. (with standard filtering

Less APIs or more encapsulation?

2009-09-09 Thread 一首诗
2 class, B contains C. When user want to use some service of C, there are two choice: First, more encapsulation: = class B: def newMethod(self): self.c.newMethod() class C: def newMethod(self): #do something pass b.newMethod()

Re: Less APIs or more encapsulation?

2009-09-09 Thread Diez B. Roggisch
一首诗 wrote: > 2 class, B contains C. When user want to use some service of C, > there are two choice: > > First, more encapsulation: > > = > class B: > def newMethod(self): > self.c.newMethod() > > class C: > def newMethod(self): > > #do some

Re: [Tkinter] messed callbacks

2009-09-09 Thread Terry Reedy
Giacomo Boffi wrote: "Diez B. Roggisch" writes: Giacomo Boffi wrote: def doit(fr,lst): for c1,c2 in zip(lst[::2], lst[1::2]): subframe=Frame(fr) Label(subframe,text=c1+' <-> '+c2).pack(side='left',expand=1,fill='both') Button(subframe,text='>',command=lambda: output(c1+'->'

Re: a question about numpy

2009-09-09 Thread Robert Kern
On 2009-09-08 20:45 PM, hi_roger wrote: hello, i want to ask a question about numpy. i know how to select a submatrix using the slice object in numpy. But how can i select a submatrix A[i1,i2,i3;j1,j2,j3] (elements in A on line i1,i2,i3 and column j1,j2,j3 , and i1,i2,i3,j1,j2,j3 are all arbitr

Re: Extracting patterns after matching a regex

2009-09-09 Thread Al Fansome
Mart. wrote: On Sep 8, 4:33 pm, MRAB wrote: Mart. wrote: On Sep 8, 3:53 pm, MRAB wrote: Mart. wrote: On Sep 8, 3:14 pm, "Andreas Tawn" wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s = "FTPHOST: e4ftl01u.ecs.nasa.gov" and onc

Re: a question about numpy

2009-09-09 Thread Robert Kern
On 2009-09-08 22:03 PM, sturlamolden wrote: On 9 Sep, 03:45, hi_roger wrote: i know how to select a submatrix using the slice object in numpy. But how can i select a submatrix A[i1,i2,i3;j1,j2,j3] (elements in A on line i1,i2,i3 and column j1,j2,j3 , and i1,i2,i3,j1,j2,j3 are all arbitrary nu

python and openSSL

2009-09-09 Thread Luca Bel
Hi all. I need a trick to do something like this: openssl smime -decrypt -verify -inform DER -in ReadmeDiKe.pdf.p7m -noverify -out ReadmeDike.pdf To unwrap a p7m file and read his content. I know that I could use somthing like: >>> import os >>> os.system('openssl ') but i would use a pyth

Re: "Rapid GUI Programming with Python and Qt" source code

2009-09-09 Thread Mark
On Sep 9, 2:33 pm, David Boddie wrote: > On Wed Sep 9 07:11:26 CEST 2009, Steven Woody wrote: > > > *I've searched google and cannot find a valid link for the source code of > > the book "Rapid GUI Programming with Python and Qt". Could anyone please > > give me a non-broken URL?* > > See this pag

Function to apply superset of arguments to a function

2009-09-09 Thread Andrey Fedorov
Hi all, I've written a function [1] called apply_some which takes a set of keywords arguments, filters only those a function is expecting, and calls the function with only those arguments. This is meant to suppress TypeErrors - a way to abstract the logic which checks what arguments a passed-in fu

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread ryles
On Sep 9, 1:47 am, The Music Guy wrote: > I should also mention--and I should have realized this much > sooner--that each of the BaseN classes are themselves each going to > have at least one common base which will define method_x, so each > BaseN will be calling that if it defines its own method_

Re: logging sound / speech handler?

2009-09-09 Thread Chris Hulan
On Sep 9, 11:03 am, Gregor Horvath wrote: > Hi, > > For an application in an industrial environment where the workers are > not always sitting in front of the monitor, but are within earshot of > the PC I would need an sound / speech handler for the standard logging > system. It should beep or bet

Re: Function to apply superset of arguments to a function

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 12:45 PM, Andrey Fedorov wrote: > Hi all, > > I've written a function [1] called apply_some which takes a set of > keywords arguments, filters only those a function is expecting, and > calls the function with only those arguments. This is meant to > suppress TypeErrors - a wa

Re: [Tkinter] messed callbacks

2009-09-09 Thread John Posner
def cb12(): return output(c1+'->'+c2) def cb21(): return output(c2+'->'+c1) I think these can be simplified, e.g: def cb12(): output(c1+'->'+c2) But I'd go with the functools.partial approach. You can save some code by making output() do more of the work: #---

HTTP POST File without cURL

2009-09-09 Thread John D Giotta
I'm working with an API that allows me to POST a zip file via HTTP and the documentation uses a cURL example. cURL works, but when I try to POST the file via python it fails. I don't want to use cURL (since I'm trying to be transparent and dependency-less), but I can't find anything online that wor

Re: hanning python

2009-09-09 Thread sturlamolden
On 9 Sep, 16:57, pdpi wrote: > Raising this to 1 million, rather than 100, nodes in the window, the > timing difference between your version and NumPy's is tiny (but numpy > still edges you out, but just barely), but they trounce my naive > version, being around 7 or 8 times faster the list compr

Re: logging sound / speech handler?

2009-09-09 Thread Stef Mientki
Gregor Horvath wrote: Hi, For an application in an industrial environment where the workers are not always sitting in front of the monitor, but are within earshot of the PC I would need an sound / speech handler for the standard logging system. It should beep or better say the logging message. (

Re: Function to apply superset of arguments to a function

2009-09-09 Thread Andrey Fedorov
When a web request is made, my Django views are called with argument `user_id' present if someone is logged in, and set to None if the request is anonymous. The response varies based on this argument - someone pulling a team's information will get their relationship to the team if they are logged i

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread Carl Banks
On Sep 8, 10:47 pm, The Music Guy wrote: > I should also mention--and I should have realized this much > sooner--that each of the BaseN classes are themselves each going to > have at least one common base which will define method_x, so each > BaseN will be calling that if it defines its own method

Re: Class variable inheritance

2009-09-09 Thread Carl Banks
On Sep 9, 3:32 am, HPJ wrote: > > Maybe.  For some languages this might be an obvious behavior, but > > Python would have different circumstances so it isn't so obvious (or > > possible) there. > > Which means this topic definitely needs to be handled in detail by the > LR, and preferably also in

Re: Function to apply superset of arguments to a function

2009-09-09 Thread 7stud
On Sep 9, 10:45 am, Andrey Fedorov wrote: > Hi all, > > I've written a function [1] called apply_some which takes a set of > keywords arguments, filters only those a function is expecting, and > calls the function with only those arguments. This is meant to > suppress TypeErrors - a way to abstrac

Re: HTTP POST File without cURL

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 1:57 PM, John D Giotta wrote: > I'm working with an API that allows me to POST a zip file via HTTP and > the documentation uses a cURL example. cURL works, but when I try to > POST the file via python it fails. > I don't want to use cURL (since I'm trying to be transparent an

Re: HTTP POST File without cURL

2009-09-09 Thread Jarkko Torppa
On 2009-09-09, John D Giotta wrote: > I'm working with an API that allows me to POST a zip file via HTTP and > the documentation uses a cURL example. cURL works, but when I try to > POST the file via python it fails. > I don't want to use cURL (since I'm trying to be transparent and > dependency-l

Re: start default application for read a pdf from python

2009-09-09 Thread Angelo Ballabio
Thenks for this suggestion, at the end I find this solution import os . . #then where I decide to show the file in the default application I put this #file_name the name I construct with path and all necessary #recor contain all the data of one record end the 4th position

Re: PyPI upload documentation

2009-09-09 Thread Dan Yamins
Sorry to write again, but really nobody on the Python list knows how to get in touch with the people running PyPI's website in an effective way? Thanks! Dan On Tue, Sep 8, 2009 at 6:25 PM, Dan Yamins wrote: > Dear all: > > I'm trying to upload documentation to the PyPI site for a project I'm >

Re: Q on explicitly calling file.close

2009-09-09 Thread David C Ullrich
On Sat, 05 Sep 2009 23:41:08 +, Steven D'Aprano wrote: > On Sat, 05 Sep 2009 16:14:02 +, kj wrote: > >> Finally, I was under the impression that Python closed filehandles >> automatically when they were garbage-collected. [...] > > (3) For quick and dirty scripts, or programs that only u

Python server locks up

2009-09-09 Thread Zac Burns
I have a server running Python 2.6x64 which after running for about a month decides to lock up and become unresponsive to all threads for several minutes at a time. While it is locked up Python proceeds to consume large amounts of continually increasing memory. The basic function of the server is

Re: PyPI upload documentation

2009-09-09 Thread Robert Kern
On 2009-09-09 15:14 PM, Dan Yamins wrote: Sorry to write again, but really nobody on the Python list knows how to get in touch with the people running PyPI's website in an effective way? http://www.python.org/community/sigs/current/catalog-sig/ -- Robert Kern "I have come to believe that the

Re: Python server locks up

2009-09-09 Thread MRAB
Zac Burns wrote: I have a server running Python 2.6x64 which after running for about a month decides to lock up and become unresponsive to all threads for several minutes at a time. While it is locked up Python proceeds to consume large amounts of continually increasing memory. The basic functio

Re: Q on explicitly calling file.close

2009-09-09 Thread r
On Sep 9, 3:18 pm, David C Ullrich wrote: (snip) > These days I've actually got the syntax and spelling memorized - > I can type "close()" without needing to look it up! +1 You are so right David! I think some people around here need to look up "code reuse". Here are a couple of simple templates

Re: Function to apply superset of arguments to a function

2009-09-09 Thread Mel
David Stanek wrote: > On Wed, Sep 9, 2009 at 12:45 PM, Andrey Fedorov > wrote: >> I've written a function [1] called apply_some which takes a set of >> keywords arguments, filters only those a function is expecting, and >> calls the function with only those arguments. This is meant to >> suppress

Re: Q on explicitly calling file.close

2009-09-09 Thread MRAB
r wrote: [snip] #-- Double Extra Creidit --# Create a backup_file() function that takes as arg and creates a copy of the file with the extension ".bak"... backup_file('C:\test.txt') -> 'C:\test.bak' You should've used raw strings. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Q on explicitly calling file.close

2009-09-09 Thread Charles Yeomans
On Sep 9, 2009, at 4:50 PM, r wrote: On Sep 9, 3:18 pm, David C Ullrich wrote: (snip) These days I've actually got the syntax and spelling memorized - I can type "close()" without needing to look it up! +1 You are so right David! I think some people around here need to look up "code reuse"

Re: Function to apply superset of arguments to a function

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 5:03 PM, Mel wrote: > David Stanek wrote: >> On Wed, Sep 9, 2009 at 12:45 PM, Andrey Fedorov >> wrote: > >>> I've written a function [1] called apply_some which takes a set of >>> keywords arguments, filters only those a function is expecting, and >>> calls the function with

search term parsing like Google/Gmail

2009-09-09 Thread Randy Syring
I am looking for a string parser that works kind of like Google's or Gmail's advanced search capabilities. So it would turn something like this: (subject:"hi there" from:[tim, tom, -fred]) or (subject:foobar from:sam) into a python structure that could be used. I don't really care so much

Re: Function to apply superset of arguments to a function

2009-09-09 Thread Carl Banks
On Sep 9, 10:40 am, David Stanek wrote: > On Wed, Sep 9, 2009 at 12:45 PM, Andrey Fedorov wrote: > > Hi all, > > > I've written a function [1] called apply_some which takes a set of > > keywords arguments, filters only those a function is expecting, and > > calls the function with only those argum

Re: Function to apply superset of arguments to a function

2009-09-09 Thread Carl Banks
On Sep 9, 11:47 am, 7stud wrote: > On Sep 9, 10:45 am, Andrey Fedorov wrote: > > > > > > > Hi all, > > > I've written a function [1] called apply_some which takes a set of > > keywords arguments, filters only those a function is expecting, and > > calls the function with only those arguments. Thi

Re: Function to apply superset of arguments to a function

2009-09-09 Thread Carl Banks
On Sep 9, 9:45 am, Andrey Fedorov wrote: > Hi all, > > I've written a function [1] called apply_some which takes a set of > keywords arguments, filters only those a function is expecting, and > calls the function with only those arguments. This is meant to > suppress TypeErrors - a way to abstract

Re: Q on explicitly calling file.close

2009-09-09 Thread r
On Sep 9, 4:19 pm, Charles Yeomans wrote: (snip:) > Unfortunately, both of these simple templates have the following   > problem -- if open fails, a NameError will be raised from the finally   > block. (snip) > I removed the except block because I prefer exceptions to error codes. how will the c

how to log connection refused attempt with python-paramiko

2009-09-09 Thread nickname
hello all, I am getting to grips with paramiko. I am trying to open a ssh connection to my server 127.0.0.1 using paramiko and want to specify the password via the program itself. I want to generate and change passwds via the program very frequently and hence am avoiding a key based ap

Re: how to log connection refused attempt with python-paramiko

2009-09-09 Thread nickname
On Sep 9, 3:35 pm, nickname wrote: > hello all, >             I am getting to grips with paramiko. I am trying to open a > ssh connection to my server 127.0.0.1 using paramiko and want to > specify the password via the program itself. I want to generate  and > change passwds via the program very f

Re: how to log connection refused attempt with python-paramiko

2009-09-09 Thread nickname
On Sep 9, 3:37 pm, nickname wrote: > On Sep 9, 3:35 pm, nickname wrote: > > > > > hello all, > >             I am getting to grips with paramiko. I am trying to open a > > ssh connection to my server 127.0.0.1 using paramiko and want to > > specify the password via the program itself. I want to g

Re: logging sound / speech handler?

2009-09-09 Thread Tim Chase
For an application in an industrial environment where the workers are not always sitting in front of the monitor, but are within earshot of the PC I would need an sound / speech handler for the standard logging system. It should beep or better say the logging message. (with standard filtering etc.

Re: PyPI upload documentation

2009-09-09 Thread Dan Yamins
On Wed, Sep 9, 2009 at 4:29 PM, Robert Kern wrote: > On 2009-09-09 15:14 PM, Dan Yamins wrote: > >> Sorry to write again, but really nobody on the Python list knows how to >> get in touch with the people running PyPI's website in an effective way? >> > > http://www.python.org/community/sigs/curre

lxml question

2009-09-09 Thread mattia
I would like to click on an image in a web page that I retrieve using urllib in order to trigger an event. Here is the piece of code with the image that I want to click: I don't know how to do it (I'm trying using lxml, but any suggestion can help). Thanks, Mattia -- http://mail.python.org/

Re: PyPI upload documentation

2009-09-09 Thread Robert Kern
On 2009-09-09 18:14 PM, Dan Yamins wrote: On Wed, Sep 9, 2009 at 4:29 PM, Robert Kern mailto:robert.k...@gmail.com>> wrote: On 2009-09-09 15:14 PM, Dan Yamins wrote: Sorry to write again, but really nobody on the Python list knows how to get in touch with the peopl

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread The Music Guy
On Wed, Sep 9, 2009 at 1:21 PM, Carl Banks wrote: > On Sep 8, 10:47 pm, The Music Guy wrote: > What is get_other_base?  Just use a regular super call here, > get_other_base and hacks like that are what gets you into trouble. > > You seem to be overthinking this.  You don't need to.  Just use supe

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread The Music Guy
Btw, Carl, please forgive me if I frustrate you, because I'm trying my best not to. I'm trying to keep track of what I did and what you did and what Ryles and Scott did, while at the same time trying to keep a firm grasp of exactly what it is I'm trying to acheive. Besides that, I'm not a professio

Re: search term parsing like Google/Gmail

2009-09-09 Thread Daniel Fetchinson
> I am looking for a string parser that works kind of like Google's or > Gmail's advanced search capabilities. So it would turn something like this: > > (subject:"hi there" from:[tim, tom, -fred]) or (subject:foobar from:sam) > > into a python structure that could be used. I don't really care

ANN: dh, the daemon helper

2009-09-09 Thread John Kelly
dh, the daemon helper The daemon helper starts any program or script as a daemon. It's a small C program with a simple interface and a liberal license. ftp://ftp.isp2dial.com/users/jak/src/dh/ Get the files and do: make install clean To build and install dh. Don't try to run the Sh.inst

Re: lxml question

2009-09-09 Thread Chris Rebert
On Wed, Sep 9, 2009 at 4:11 PM, mattia wrote: > I would like to click on an image in a web page that I retrieve using > urllib in order to trigger an event. > Here is the piece of code with the image that I want to click: > onclick="return checkPhoneField(document.contactFrm, 'mobile');" > alt="sm

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread Carl Banks
On Sep 9, 4:37 pm, The Music Guy wrote: > On Wed, Sep 9, 2009 at 1:21 PM, Carl Banks wrote: > > On Sep 8, 10:47 pm, The Music Guy wrote: > > What is get_other_base?  Just use a regular super call here, > > get_other_base and hacks like that are what gets you into trouble. > > > You seem to be ove

Re: Python server locks up

2009-09-09 Thread Zac Burns
> If it has been running continuously all that time then it might be that > the dictionary has grown too big (is that possible?) or that it's a > memory fragmentation problem. In the latter case it might be an idea to > restart Python every so often; perhaps it could do that automatically > during

Re: Less APIs or more encapsulation?

2009-09-09 Thread Tycho Andersen
On Wed, Sep 9, 2009 at 10:08 AM, 一首诗 wrote: > But when C has many many methods to expose to outer user, 2nd choice > seems to be more reasonable I In the first design, B.newMethod did > nothing really useful. Is there any reason you can't do something like the following? class B(object): def __

Re: a question about numpy

2009-09-09 Thread rechard
Robert Kern wrote: On 2009-09-08 20:45 PM, hi_roger wrote: hello, i want to ask a question about numpy. i know how to select a submatrix using the slice object in numpy. But how can i select a submatrix A[i1,i2,i3;j1,j2,j3] (elements in A on line i1,i2,i3 and column j1,j2,j3 , and i1,i2,i3,j1,

Re: Python server locks up

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 4:28 PM, Zac Burns wrote: > > How would you suggest to figure out what is the problem? > I don't think you said your OS so I'll assume Linux. Sometimes it is more noise than value, but stracing the process may shed light on what system calls are being made. This in turn may

Re: python and openSSL

2009-09-09 Thread exarkun
On 9 Sep, 01:30 pm, luca...@gmail.com wrote: Hi all. I need a trick to do something like this: openssl smime -decrypt -verify -inform DER -in ReadmeDiKe.pdf.p7m -noverify -out ReadmeDike.pdf To unwrap a p7m file and read his content. I know that I could use somthing like: import os os.system(

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread ryles
On Sep 9, 7:48 pm, The Music Guy wrote: > Btw, Carl, please forgive me if I frustrate you, because I'm trying my > best not to. I'm trying to keep track of what I did and what you did > and what Ryles and Scott did, while at the same time trying to keep a > firm grasp of exactly what it is I'm try

Automatic Attribute Assignment during Class Inheritance

2009-09-09 Thread gizli
Hi all, I have been trying to do a programming trick with python and so far I failed. I am using sqlalchemy in my code and writing a framework with it. This framework uses something called polymorphic identity attribute to define the do single table inheritance. Here's roughly how it works: 1. De

Re: Function to apply superset of arguments to a function

2009-09-09 Thread Steven D'Aprano
On Wed, 09 Sep 2009 14:58:22 -0700, Carl Banks wrote: > Use case seems perfectly obvious to me. You have a set of functions > that use different strategies to accomplish a task, and there is a lot > of overlap in the arguments used but no consistency. You want to be > able to swap in different f

Re: Math Notations, Computer Languages, and the “Form” in Formalism

2009-09-09 Thread Jon Harrop
fortunatus wrote: > to that end you might be interested in Fortress at Sun: > > http://projectfortress.sun.com/Projects/Community > http://research.sun.com/projects/plrg/fortress.pdf > http://research.sun.com/spotlight/2007/2007-01-10_fortress.html Fortress is dead, right? -- Dr Jon D Harrop, F

Re: Function to apply superset of arguments to a function

2009-09-09 Thread Carl Banks
On Sep 9, 8:14 pm, Steven D'Aprano wrote: > On Wed, 09 Sep 2009 14:58:22 -0700, Carl Banks wrote: > > Use case seems perfectly obvious to me.  You have a set of functions > > that use different strategies to accomplish a task, and there is a lot > > of overlap in the arguments used but no consiste

Re: Automatic Attribute Assignment during Class Inheritance

2009-09-09 Thread Steven D'Aprano
On Wed, 09 Sep 2009 20:14:33 -0700, gizli wrote: > I do not want to force the consumers of this framework to write this > obscure line of code. I was wondering if it is possible (at class > definition time) to capture the fact that MyTask extends Task and > automatically insert the polymorphic_ide

s.index(x[, i[, j]]) will change the s ?

2009-09-09 Thread s7v7nislands
hi all: what is the s.index() mean? does the index() change the s? In python2.6 doc (6.6.4. Mutable Sequence Types), Note 4: Raises ValueError when x is not found in s. When a negative index is passed as the second or third parameter to the index() method, the list length is added, as for

Re: s.index(x[, i[, j]]) will change the s ?

2009-09-09 Thread r
On Sep 9, 11:00 pm, s7v7nislands wrote: > hi all: >     what is the s.index() mean? does the index() change the s? >     In python2.6 doc (6.6.4. Mutable Sequence Types), Note 4: > > Raises ValueError when x is not found in s. When a negative index is > passed as the second or third parameter to t

Re: s.index(x[, i[, j]]) will change the s ?

2009-09-09 Thread Chris Rebert
On Wed, Sep 9, 2009 at 9:00 PM, s7v7nislands wrote: > hi all: >    what is the s.index() mean? does the index() change the s? It tells you the index of the first instance of the given element in the sequence. Or, to quote the docs: s.index(x[, i[, j]]) --- return smallest k such that s[k] == x

Re: s.index(x[, i[, j]]) will change the s ?

2009-09-09 Thread Steven D'Aprano
On Wed, 09 Sep 2009 21:00:20 -0700, s7v7nislands wrote: > hi all: > what is the s.index() mean? does the index() change the s? It returns the index (position) of its argument in the object s. Have you tried it to see for yourself? >>> ['a', 'b', 'c', 'd'].index('c') # 'c' is in position 2

  1   2   >