Re: substituting list comprehensions for map()

2009-11-02 Thread Javier Collado
Hello, I'll do the following: [op1+op2 for op1,op2 in zip(operandlist1, operandlist2)] Best regards, Javier 2009/11/2 Jon P. : > I'd like to do: > > resultlist = operandlist1 + operandlist2 > > where for example > > operandlist1=[1,2,3,4,5] > operandlist2=[5,4,3,2,1] > > and resultlist will

Re: substituting list comprehensions for map()

2009-11-02 Thread Chris Rebert
On Mon, Nov 2, 2009 at 12:54 AM, Jon P. wrote: > I'd like to do: > > resultlist = operandlist1 + operandlist2 > > where for example > > operandlist1=[1,2,3,4,5] > operandlist2=[5,4,3,2,1] > > and resultlist will become [6,6,6,6,6].  Using map(), I > can do: > > map(lambda op1,op2: op1 + op2, opera

Re: substituting list comprehensions for map()

2009-11-02 Thread Steven D'Aprano
On Sun, 01 Nov 2009 23:54:16 -0800, Jon P. wrote: > I'd like to do: > > resultlist = operandlist1 + operandlist2 > > where for example > > operandlist1=[1,2,3,4,5] > operandlist2=[5,4,3,2,1] > > and resultlist will become [6,6,6,6,6]. Using map(), I can do: > > map(lambda op1,op2: op1 + op2,

Re: substituting list comprehensions for map()

2009-11-02 Thread Paul Rudin
"Jon P." writes: > I'd like to do: > > resultlist = operandlist1 + operandlist2 > > where for example > > operandlist1=[1,2,3,4,5] > operandlist2=[5,4,3,2,1] > > and resultlist will become [6,6,6,6,6]. Using map(), I > can do: > > map(lambda op1,op2: op1 + op2, operandlist1, operandlist2) > > Is

Re: substituting list comprehensions for map()

2009-11-02 Thread Ben Finney
"Jon P." writes: > I'd like to do: > > resultlist = operandlist1 + operandlist2 That's an unfortunate way of expressing it; it's valid Python syntax that doesn't do what you're describing (in this case, it will bind ‘resultlist’ to a new list that is the *concatenation* of the two original lists

Re: substituting list comprehensions for map()

2009-11-02 Thread Bruno Desthuilliers
Ben Finney a écrit : (snip) Yes, just about any ‘map()’ operation has a corresponding list comprehension. Right AFAICT, but: (Does anyone know of a counter-example, a ‘map()’ operation that doesn't have a correspondingly simple list comprehension?) ... depends on your definition of "simple"

Re: About one class/function per module

2009-11-02 Thread Bruno Desthuilliers
Gabriel Genellina a écrit : On Nov 2, 8:11 am, Peng Yu wrote: I prefer organized my code one class/function per file (i.e per module in python). I know the majority of programmers don't use this approach. Therefore, I'm wondering what its disadvantage is. (snip) You may put one class per

Re: About one class/function per module

2009-11-02 Thread Bruno Desthuilliers
Peng Yu a écrit : (snip) I prefer organized my code one class/function per file (i.e per module in python). I know the majority of programmers don't use this approach. Therefore, I'm wondering what its disadvantage is. Hmmm... As far as I'm concerned, you already answered your own question: "t

Re: Tkinter callback arguments

2009-11-02 Thread eb303
On Nov 1, 8:53 pm, Lord Eldritch wrote: > Hi > > Maybe this is maybe something it has been answered somewhere but I haven't > been able to make it work. I wanna pass one variable to a callback function > and I've read the proper way is: > > Button(.., command=lambda: function(x)) > > So with >

Re: substituting list comprehensions for map()

2009-11-02 Thread Neil Crighton
Steven D'Aprano REMOVE.THIS.cybersource.com.au> writes: > > > > operandlist1=[1,2,3,4,5] > > operandlist2=[5,4,3,2,1] > > > > and resultlist will become [6,6,6,6,6]. Using map(), I can do: > > > > map(lambda op1,op2: op1 + op2, operandlist1, operandlist2) > > If the two lists are very large,

Re: Tkinter callback arguments

2009-11-02 Thread Peter Otten
Alf P. Steinbach wrote: >> for x in range(0,3): >> Button(.., command=lambda x=x: function(x)) > > An alternative reusable alternative is to create a button-with-id class. > > This is my very first Python class so I'm guessing that there are all > sorts of issues, in particular n

Re: Tkinter callback arguments

2009-11-02 Thread Brian J Mingus
On Mon, Nov 2, 2009 at 2:26 AM, Peter Otten <__pete...@web.de> wrote: > Alf P. Steinbach wrote: > > >> for x in range(0,3): > >> Button(.., command=lambda x=x: function(x)) > > > > An alternative reusable alternative is to create a button-with-id class. > > > > This is my very firs

Re: disable image loading to speed up webpage load

2009-11-02 Thread Diez B. Roggisch
elca schrieb: Hi, im using win32com 's webbrowser module. i have some question about it.. is it possible to disable image loading to speed up webpage load? any help ,much appreciate thanks in advance Use urllib2. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: substituting list comprehensions for map()

2009-11-02 Thread Diez B. Roggisch
Steven D'Aprano schrieb: On Sun, 01 Nov 2009 23:54:16 -0800, Jon P. wrote: I'd like to do: resultlist = operandlist1 + operandlist2 where for example operandlist1=[1,2,3,4,5] operandlist2=[5,4,3,2,1] and resultlist will become [6,6,6,6,6]. Using map(), I can do: map(lambda op1,op2: op1 +

Re: About one class/function per module

2009-11-02 Thread Ben Finney
Bruno Desthuilliers writes: > Gabriel Genellina a écrit : > > You may put one class per file, nobody forbids that > > But anyone having to work on your code will hate you. And if you can find anyone to collaborate with who can stand your insistence on putting one *function* per file, you should

Re: substituting list comprehensions for map()

2009-11-02 Thread Ben Finney
Bruno Desthuilliers writes: > Ben Finney a écrit : > > (Does anyone know of a counter-example, a ‘map()’ operation that > > doesn't have a correspondingly simple list comprehension?) > > ... depends on your definition of "simple". There are things I'd > rather not write as a list comprehension...

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Peter Otten: Alf P. Steinbach wrote: for x in range(0,3): Button(.., command=lambda x=x: function(x)) An alternative reusable alternative is to create a button-with-id class. This is my very first Python class so I'm guessing that there are all sorts of issues, in particular

About "Object in list" expression

2009-11-02 Thread Mirons
Hi everybody! I'm having a very annoying problem with Python: I need to check if a (mutable) object is part of a list but the usual expression return True also if the object isn't there. I've implemented both __hash__ and __eq__, but still no result. what does "in" implementation use for comparison

Re: About "Object in list" expression

2009-11-02 Thread Jon Clements
On Nov 2, 10:41 am, Mirons wrote: > Hi everybody! I'm having a very annoying problem with Python: I need > to check if a (mutable) object is part of a list but the usual > expression return True also if the object isn't there. I've > implemented both __hash__ and __eq__, but still no result. what

exec-function in Python 3.+

2009-11-02 Thread Hans Larsen
Help! I'm begginer in Python 3.+! If i wih to update a module after an import and chages, How could I do: By "from imp import reload" and then reload(mymodule) or how to use "exec(?)", it is mentoined in docs. In Python ver. <3 reload(module) writes something back to interpr

AW: Python2.6 + win32com crashes with unicode bug

2009-11-02 Thread Stefan Schukat
Hello Gerrit, there is no problem in the file, but in the description of the Visio API. The place where the error occurs is during the definition of the parameters of the corresponding Python methods. The information for the names comes from the typelibrary of visio. Probably there is a non e

Re: About "Object in list" expression

2009-11-02 Thread Mirons
On 2 Nov, 11:46, Jon Clements wrote: > On Nov 2, 10:41 am, Mirons wrote: > > > Hi everybody! I'm having a very annoying problem with Python: I need > > to check if a (mutable) object is part of a list but the usual > > expression return True also if the object isn't there. I've > > implemented bo

Re: substituting list comprehensions for map()

2009-11-02 Thread Bruno Desthuilliers
Ben Finney a écrit : Bruno Desthuilliers writes: Ben Finney a écrit : (Does anyone know of a counter-example, a ‘map()’ operation that doesn't have a correspondingly simple list comprehension?) ... depends on your definition of "simple". There are things I'd rather not write as a list compre

Re: exec-function in Python 3.+

2009-11-02 Thread Jon Clements
On 2 Nov, 10:49, "Hans Larsen" wrote: > Help! >     I'm begginer in Python 3.+! >     If i wih to update a module after an import and chages, >     How could I do: >     By "from imp import reload" and then reload(mymodule) >     or how to use "exec(?)", it is mentoined in docs. >     In Python ve

Re: Tkinter callback arguments

2009-11-02 Thread Peter Otten
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >> for x in range(0,3): Button(.., command=lambda x=x: function(x)) >>> An alternative reusable alternative is to create a button-with-id class. >>> >>> This is my very first Python class so I'm guessing

Help with SOAPpy and WSDL.

2009-11-02 Thread Henrik Aagaard Sørensen
I have a problem with SOAPpy and WSDL. It is explained here: http://www.python-forum.org/pythonforum/viewtopic.php?f=3&t=15532 Many regards, Henrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with SOAPpy and WSDL.

2009-11-02 Thread Simon Brunning
2009/11/2 Henrik Aagaard Sørensen : > I have a problem with SOAPpy and WSDL. It is explained here: > http://www.python-forum.org/pythonforum/viewtopic.php?f=3&t=15532 Why not explain it here? In any case, I imagine the advice is going to be to try Suds - . -- Che

Re: Tkinter callback arguments

2009-11-02 Thread Diez B. Roggisch
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >> for x in range(0,3): Button(.., command=lambda x=x: function(x)) >>> An alternative reusable alternative is to create a button-with-id class. >>> >>> This is my very first Python class so I'm guessing

Re: About one class/function per module

2009-11-02 Thread Peng Yu
On Mon, Nov 2, 2009 at 3:03 AM, Bruno Desthuilliers wrote: > Peng Yu a écrit : > (snip) >> >> I prefer organized my code one class/function per file (i.e per module >> in python). I know the majority of programmers don't use this >> approach. Therefore, I'm wondering what its disadvantage is. > >

Re: About one class/function per module

2009-11-02 Thread Peng Yu
On Mon, Nov 2, 2009 at 7:11 AM, Peng Yu wrote: > On Mon, Nov 2, 2009 at 3:03 AM, Bruno Desthuilliers > wrote: >> Peng Yu a écrit : >> (snip) >>> >>> I prefer organized my code one class/function per file (i.e per module >>> in python). I know the majority of programmers don't use this >>> approac

Accessing a method from within its own code

2009-11-02 Thread Paddy O'Loughlin
Hi, I was wondering if there was a shorthand way to get a reference to a method object from within that method's code. Take this code snippet as an example: import re class MyClass(object): def find_line(self, lines): if not hasattr(MyClass.do_work, "matcher"): MyClass.do_

Re: About one class/function per module

2009-11-02 Thread Diez B. Roggisch
Peng Yu wrote: > On Mon, Nov 2, 2009 at 3:03 AM, Bruno Desthuilliers > wrote: >> Peng Yu a écrit : >> (snip) >>> >>> I prefer organized my code one class/function per file (i.e per module >>> in python). I know the majority of programmers don't use this >>> approach. Therefore, I'm wondering what

have opensource crawler written by python?

2009-11-02 Thread Junjun Shao
hi, Is there a crawler written by python? anybody can give me more information? thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: substituting list comprehensions for map()

2009-11-02 Thread J Kenneth King
Steven D'Aprano writes: > On Sun, 01 Nov 2009 23:54:16 -0800, Jon P. wrote: > >> I'd like to do: >> >> resultlist = operandlist1 + operandlist2 >> >> where for example >> >> operandlist1=[1,2,3,4,5] >> operandlist2=[5,4,3,2,1] >> >> and resultlist will become [6,6,6,6,6]. Using map(), I can

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Peter Otten: Alf P. Steinbach wrote: * Peter Otten: Alf P. Steinbach wrote: for x in range(0,3): Button(.., command=lambda x=x: function(x)) An alternative reusable alternative is to create a button-with-id class. This is my very first Python class so I'm guessing that th

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Diez B. Roggisch: Alf P. Steinbach wrote: * Peter Otten: Alf P. Steinbach wrote: for x in range(0,3): Button(.., command=lambda x=x: function(x)) An alternative reusable alternative is to create a button-with-id class. This is my very first Python class so I'm guessing th

Re: Help with SOAPpy and WSDL.

2009-11-02 Thread Henrik Aagaard Sørensen
I'll try to explain it here then: A small example on SOAPpy and WSDL. My code: from SOAPpy import WSDL wsdlFile = 'http://www.webservicex.net/country.asmx?wsdl' server = WSDL.Proxy(wsdlFile) server.GetCurrencyByCountry('Zimbabwe') returns: Traceback (most recent call last): File "pythonwsdl.py"

Re: have opensource crawler written by python?

2009-11-02 Thread Daniel Fetchinson
> Is there a crawler written by python? anybody can give me more information? http://www.google.com/search?q=python+web+crawlers HTH, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Command parsing... best module to use?

2009-11-02 Thread Collin D
Hey everyone. I am writing a game in python, and it includes a text console somewhat like the one in WoW and Runescape. I want to be able to include "/" commands, like IRC, and was wondering what the best module would be to parse these. Thanks a lot, Collin D -- http://mail.python.org/mailman/li

Re: Pyfora, a place for python

2009-11-02 Thread Daniel Fetchinson
>> If you have any suggestions, let me know -- this is a community >> effort! > > Suggestion: Please don't make efforts to fragment the community. When a community grows and consequently its needs also grow, how do you differentiate "natural growth" from "fragmenting the community"? Same question

Re: Help with SOAPpy and WSDL.

2009-11-02 Thread Simon Brunning
2009/11/2 Henrik Aagaard Sørensen : > I'll try to explain it here then: > > A small example on SOAPpy and WSDL. My code: > from SOAPpy import WSDL > wsdlFile = 'http://www.webservicex.net/country.asmx?wsdl' > server = WSDL.Proxy(wsdlFile) > server.GetCurrencyByCountry('Zimbabwe') > > returns: > Sy

Re: Pyfora, a place for python

2009-11-02 Thread Diez B. Roggisch
Daniel Fetchinson wrote: >>> If you have any suggestions, let me know -- this is a community >>> effort! >> >> Suggestion: Please don't make efforts to fragment the community. > > When a community grows and consequently its needs also grow, how do > you differentiate "natural growth" from "fragme

Re: exec-function in Python 3.+

2009-11-02 Thread Dave Angel
Hans Larsen wrote: Help! I'm begginer in Python 3.+! If i wih to update a module after an import and chages, How could I do: By "from imp import reload" and then reload(mymodule) or how to use "exec(?)", it is mentoined in docs. In Python ver. <3 reload(module) writes some

Re: About one class/function per module

2009-11-02 Thread Jean-Michel Pichavant
Diez B. Roggisch wrote: Peng Yu wrote: I can navigate to the definition of class and function by vim + ctags, Start learning a decent editor (emacs is mine) which allows you to deal with all of your perceived "problems" Diez This is a declaration of war against the vi communit

C api and exception handling

2009-11-02 Thread lallous
Hello, Is there is a way, using the Python C api, to install an exception handler that: - will be triggered when an exception occurs - analyze the reason of the exception - correct the situation and try again (something like exception handling on windows where the exception handler can retriev

Re: Accessing a method from within its own code

2009-11-02 Thread Dave Angel
Paddy O'Loughlin wrote: Hi, I was wondering if there was a shorthand way to get a reference to a method object from within that method's code. Take this code snippet as an example: import re class MyClass(object): def find_line(self, lines): if not hasattr(MyClass.do_work, "matcher"

Re: Pyfora, a place for python

2009-11-02 Thread Kee Nethery
I just noticed the tag line "a place for Python". Looked it up online (http://pyfora.org/ ) and it will be interesting to see if it can fill the void that I experience (no centralized place to post and view user submitted sample code) in the existing Python community. As for user community f

Re: Accessing a method from within its own code

2009-11-02 Thread Gerard Flanagan
Paddy O'Loughlin wrote: Hi, I was wondering if there was a shorthand way to get a reference to a method object from within that method's code. Take this code snippet as an example: import re class MyClass(object): def find_line(self, lines): if not hasattr(MyClass.do_work, "matche

Re: Pyfora, a place for python

2009-11-02 Thread Diez B. Roggisch
Kee Nethery wrote: > I just noticed the tag line "a place for Python". Looked it up online > (http://pyfora.org/ ) and it will be interesting to see if it can fill the > void that I experience (no centralized place to post and view user > submitted sample code) in the existing Python community. A

Re: Pyfora, a place for python

2009-11-02 Thread Daniel Fetchinson
If you have any suggestions, let me know -- this is a community effort! >>> >>> Suggestion: Please don't make efforts to fragment the community. >> >> When a community grows and consequently its needs also grow, how do >> you differentiate "natural growth" from "fragmenting the community"

How do I install libxml2 and libxslt?

2009-11-02 Thread Kevin Ar18
I want to use the lxml library, but can't get it to work on Windows. The following will not work: * import libxml2 * import libxslt * from lxml import etree Here's the instructions: http://codespeak.net/lxml/installation.html * So, I run "easy_install lxml" -- that works! * Now, it says I need

Re: Tkinter callback arguments

2009-11-02 Thread Mel
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >>> * Peter Otten: unidiomatic None-checks >>> What's the idiomatic Python way for an optional thing? >> >> if some_value is None: ... > > Thanks! > > But why is this preferred? I guess because `some_value == None` restric

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Diez B. Roggisch: Your comment about "computed" makes it more clear what that's all about. Also Bertrand Meyer (Eiffel language creator) had idea like that, he called it "referential transparency". But I think when Python has this nice property mechanism, why do people change direct data attrib

Re: Accessing a method from within its own code

2009-11-02 Thread Paddy O'Loughlin
> > I suspect that the "inspection" module has your answer, but that it'll be > bulkier, and much slower than just doing what you're doing already. > Hmm. Yeah, it does appear to be bulky. I don't think it's really any more use than what I'm doing already. Why not use the default arguments gimmic

Re: Tkinter callback arguments

2009-11-02 Thread Mel
Alf P. Steinbach wrote: > Your comment about "computed" makes it more clear what that's all about. > Also Bertrand Meyer (Eiffel language creator) had idea like that, he > called it "referential transparency". But I think when Python has this > nice property mechanism, why do people change direct d

Re: Pyfora, a place for python

2009-11-02 Thread Duncan Booth
"Diez B. Roggisch" wrote: > Kee Nethery wrote: >> My personal preference would be a link in each sub-paragraph in the >> official documentation to a wiki page devoted to that specific aspect >> of the Python language. A place were users could augment the >> documentation by providing sample code

Re: Command parsing... best module to use?

2009-11-02 Thread TerryP
On Nov 2, 2:27 pm, Collin D wrote: > Hey everyone. > > I am writing a game in python, and it includes a text console somewhat > like the one in WoW and Runescape. I want to be able to include "/" > commands, like IRC, and was wondering what the best module would be to > parse these. > > Thanks a l

Migrating from R to Python

2009-11-02 Thread Ryan
I am a long time user of "R" for statistical analysis and find it an extremely useful environment for data exploration. That said I may be adding and/or moving to Python for more of my work and wanted to know if people had any recommendations. My work is primarily financial time series analysis. I

Re: Accessing a method from within its own code

2009-11-02 Thread Dave Angel
Paddy O'Loughlin wrote: I suspect that the "inspection" module has your answer, but that it'll be bulkier, and much slower than just doing what you're doing already. Hmm. Yeah, it does appear to be bulky. I don't think it's really any more use than what I'm doing already. Why not use the

Re: Migrating from R to Python

2009-11-02 Thread Ishwor Gurung
Hi, 2009/11/3 Ryan : > I am a long time user of "R" for statistical analysis and find it an [...] > My question is to people who have used zoo and xts in R, what has > their experience been with Python? Would you recommend using native > Python to do time series analysis, or rPy to link back to R

graceful degradation : is it degrading?

2009-11-02 Thread Aaron Watters
Graceful degradation is what I hope to display as I continue to age... But in the context of web programming it also refers to the supposedly desirable behaviour of web sites to "do something reasonable" as resources are denied them by client browsers such as cookies, applets, javascript, etcetera

Re: C api and exception handling

2009-11-02 Thread Carl Banks
On Nov 2, 7:16 am, "lallous" wrote: > Hello, > > Is there is a way, using the Python C api, to install an exception handler > that: > - will be triggered when an exception occurs > - analyze the reason of the exception > - correct the situation and try again (something like exception handling on >

Re: graceful degradation : is it degrading?

2009-11-02 Thread Chris Withers
Aaron Watters wrote: These days javascript is so pervasive that graceful degradation is becoming increasingly difficult and absolutely no fun for web designers and programmers. This sounds like something I'd ask about on #web on irc.freenode.net... Those guys are pretty knowledgeable, would be

Re: Tkinter callback arguments

2009-11-02 Thread Peter Otten
Alf P. Steinbach wrote: > * Peter Otten: >> Alf P. Steinbach wrote: >> >>> * Peter Otten: Alf P. Steinbach wrote: >> for x in range(0,3): >> Button(.., command=lambda x=x: function(x)) > An alternative reusable alternative is to create a button-with-id >

Re: Pyfora, a place for python

2009-11-02 Thread Paul Rubin
Kee Nethery writes: > I just noticed the tag line "a place for Python". Looked it up online > (http://pyfora.org/ ) and it will be interesting to see if it can fill > the void that I experience (no centralized place to post and view > user submitted sample code) in the existing Python community.

Re: How do I install libxml2 and libxslt?

2009-11-02 Thread Nat Williams
On Mon, Nov 2, 2009 at 9:41 AM, Kevin Ar18 wrote: > I want to use the lxml library, but can't get it to work on Windows. > > The following will not work: > * import libxml2 > * import libxslt > * from lxml import etree > > Here's the instructions: > http://codespeak.net/lxml/installation.html >

Re: Command parsing... best module to use?

2009-11-02 Thread Mark Tolonen
"Collin D" wrote in message news:94dbc92b-0682-4995-b358-0c615c95a...@x6g2000prc.googlegroups.com... Hey everyone. I am writing a game in python, and it includes a text console somewhat like the one in WoW and Runescape. I want to be able to include "/" commands, like IRC, and was wondering w

conditional __init__

2009-11-02 Thread King
class A(object): def __init__(self): pass def printme(self): print "I am A" class B(object): def __init__(self): pass def printme(self): print "I am B" class K(A, B): def __init__(self, value=0): if value == 0: A.__init__(sel

Re: conditional __init__

2009-11-02 Thread Chris Rebert
On Mon, Nov 2, 2009 at 12:40 PM, King wrote: > class A(object): >    def __init__(self): >        pass >    def printme(self): >        print "I am A" > > class B(object): >    def __init__(self): >        pass >    def printme(self): >        print "I am B" > > class K(A, B): >    def __init__(se

Re: conditional __init__

2009-11-02 Thread OKB (not okblacke)
King wrote: > class A(object): > def __init__(self): > pass > def printme(self): > print "I am A" > > class B(object): > def __init__(self): > pass > def printme(self): > print "I am B" > > class K(A, B): > def __init__(self, value=0): >

Hi help me in installing pcapy extension module

2009-11-02 Thread pranesh
dear friends, I have python 2.6.4 i my Windows XP machine. I am trying to install pcapy - python extension module ( I am using http://oss.coresecurity.com/projects/pcapy.html for reference ) I decided to implement the libpcap library... Since I have only windows xp machine.. I installed WinPc

RE: How do I install libxml2 and libxslt?

2009-11-02 Thread Kevin Ar18
Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 > According to the lxml installation instructions you linked=2C > the windows lxml binary is statically linked and you do not > need to install the libraries separately. The install ins

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message , Carsten Haese wrote: > Lawrence D'Oliveiro wrote: > >> Says someone who hasn't realized where the real inefficiencies are. >> Remember what Tony Hoare told us: "premature optimization is the root of >> all evil". These are databases we're talking about. Real-world databases >> are la

Re: Hi help me in installing pcapy extension module

2009-11-02 Thread Diez B. Roggisch
pranesh schrieb: dear friends, I have python 2.6.4 i my Windows XP machine. I am trying to install pcapy - python extension module ( I am using http://oss.coresecurity.com/projects/pcapy.html for reference ) I decided to implement the libpcap library... Since I have only windows xp machine.

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message , Dennis Lee Bieber wrote: > On Sun, 01 Nov 2009 19:08 +1300, Lawrence D'Oliveiro > declaimed the following in > gmane.comp.python.general: > >> On the grounds that Python has more general and powerful string >> parameter- substitution mechanisms than anything built into any database

Re: list comprehension problem

2009-11-02 Thread Aahz
In article <7589e0a1-98b2-4df4-bc76-5d4c10194...@f20g2000prn.googlegroups.com>, Falcolas wrote: > >I'd also recommend trying the following filter, since it is identical >to what you're trying to do, and will probably catch some additional >edge cases without any additional effort from you. > >[s.

Re: Recommended number of threads? (in CPython)

2009-11-02 Thread Aahz
In article , mk wrote: > >I wrote run-of-the-mill program for concurrent execution of ssh command >over a large number of hosts. (someone may ask why reinvent the wheel >when there's pssh and shmux around -- I'm not happy with working details >and lack of some options in either program) > >The

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Robert Kern
On 2009-11-02 14:47 PM, Lawrence D'Oliveiro wrote: In message, Dennis Lee Bieber wrote: On Sun, 01 Nov 2009 19:08 +1300, Lawrence D'Oliveiro declaimed the following in gmane.comp.python.general: On the grounds that Python has more general and powerful string parameter- substitution mechani

Re: substituting list comprehensions for map()

2009-11-02 Thread Ben Finney
J Kenneth King writes: > Steven D'Aprano writes: > > > from operator import add > > map(add, operandlist1, operandlist2) > > This is the best solution so far. Strange to say it's a solution, when it doesn't solve the stated problem: to replace use of ‘map()’ with a list comprehension. > I unde

Re: graceful degradation : is it degrading?

2009-11-02 Thread Terry Reedy
Aaron Watters wrote: people noted that they sometimes didn't work properly with javascript off. I could fix this in some cases, but the fix would involve changing a "POST" to a "GET" and that would cause MSIE to suddenly fail when the GET parameters get too big (and probably other browsers too)

Re: Tkinter callback arguments

2009-11-02 Thread Diez B. Roggisch
Alf P. Steinbach schrieb: * Diez B. Roggisch: Your comment about "computed" makes it more clear what that's all about. Also Bertrand Meyer (Eiffel language creator) had idea like that, he called it "referential transparency". But I think when Python has this nice property mechanism, why do peopl

Re: list comprehension problem

2009-11-02 Thread Krister Svanlund
On Mon, Nov 2, 2009 at 10:11 PM, Aahz wrote: > In article > <7589e0a1-98b2-4df4-bc76-5d4c10194...@f20g2000prn.googlegroups.com>, > Falcolas   wrote: >> >>I'd also recommend trying the following filter, since it is identical >>to what you're trying to do, and will probably catch some additional >>

Re: conditional __init__

2009-11-02 Thread Carl Banks
On Nov 2, 11:40 am, King wrote: > class A(object): >     def __init__(self): >         pass >     def printme(self): >         print "I am A" > > class B(object): >     def __init__(self): >         pass >     def printme(self): >         print "I am B" > > class K(A, B): >     def __init__(self,

read Zipfile

2009-11-02 Thread sityee kong
Hi all, I'm writing a program to manipulate data in 3 different kind of format, there are GZIP, cvs/txt, or ZIP file. Here is part of my program to open these 3 kind formats of file, if (option==1): file=gzip.GzipFile(sys.argv[1],"r") elif (option==2): file=open(sys.argv[1],"r")

Re: read Zipfile

2009-11-02 Thread Chris Rebert
On Mon, Nov 2, 2009 at 4:39 PM, sityee kong wrote: > However for the ZIP file, let says the ZIP file contains only one member, archive.namelist() > ['CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv'] > > I would like to open the csv file with folowwing command, > file=archive.open("CHAVI_M

Re: About one class/function per module

2009-11-02 Thread Rhodri James
On Mon, 02 Nov 2009 13:24:59 -, Peng Yu wrote: Another advantage one of class/function per file is that the syntax clearly tell the dependence relation between classes and functions. Um, no. Grepping for "import" now tells you that there is a dependency between the file contents, but it

Re: Pyfora, a place for python

2009-11-02 Thread Diez B. Roggisch
Daniel Fetchinson schrieb: If you have any suggestions, let me know -- this is a community effort! Suggestion: Please don't make efforts to fragment the community. When a community grows and consequently its needs also grow, how do you differentiate "natural growth" from "fragmenting the commun

Re: Tkinter callback arguments

2009-11-02 Thread Alf P. Steinbach
* Peter Otten: * Alf P. Steinbach wrote: * Peter Otten: Every time someone has to read the code he will read, hesitate, read again, and then hopefully come to the conclusion that the code does nothing, consider not using it, or if it is not tied into a larger project removing it. I don't under

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-02 Thread Rhodri James
On Mon, 02 Nov 2009 00:49:50 -, Alf P. Steinbach wrote: * Rhodri James: On Sun, 01 Nov 2009 21:20:20 -, Alf P. Steinbach wrote: * Rhodri James: This is a weird attribution style, by the way. I don't think it helps. That's a pretty weird thing to comment on. And as far as I

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-02 Thread Alf P. Steinbach
* Rhodri James: On Mon, 02 Nov 2009 00:49:50 -, Alf P. Steinbach wrote: * Rhodri James: On Sun, 01 Nov 2009 21:20:20 -, Alf P. Steinbach wrote: * Rhodri James: This is a weird attribution style, by the way. I don't think it helps. That's a pretty weird thing to comment on.

Re: import bug

2009-11-02 Thread Carl Banks
On Oct 31, 7:12 am, kj wrote: > I'm running into an ugly bug, which, IMHO, is really a bug in the > design of Python's module import scheme.  Consider the following > directory structure: > > ham > |-- __init__.py > |-- re.py > `-- spam.py > > ...with the following very simple files: > > % head ha

Re: read Zipfile

2009-11-02 Thread Tim Chase
I would like to open the csv file with folowwing command, file=archive.open("CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv","r") But it turned out error, Traceback (most recent call last): File "", line 1, in ? AttributeError: ZipFile instance has no attribute 'open' ZipFile.open(name[, m

Re: About one class/function per module

2009-11-02 Thread Peng Yu
On Mon, Nov 2, 2009 at 9:02 AM, Jean-Michel Pichavant wrote: > Diez B. Roggisch wrote: >> >> Peng Yu wrote: >> >>> >>>  I can navigate to the definition of >>> class and function by vim + ctags, >>> >> >> Start learning a decent editor (emacs is mine) which allows you to deal >> with all of your p

Re: __eq__() inconvenience when subclassing set

2009-11-02 Thread Jess Austin
On Nov 1, 1:13 am, "Gabriel Genellina" wrote: > Looks like in 3.1 this can be done with bytes+str and viceversa, even if   > bytes and str don't have a common ancestor (other than object; basestring   > doesn't exist in 3.x): > > p3> Base = bytes > p3> Other = str > p3> > p3> class Derived(Base):

Re: read Zipfile

2009-11-02 Thread Gabriel Genellina
En Mon, 02 Nov 2009 20:39:07 -0300, sityee kong escribió: However for the ZIP file, let says the ZIP file contains only one member, archive.namelist() ['CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv'] I would like to open the csv file with folowwing command, file=archive.open("CHAVI_MA

Re: read Zipfile

2009-11-02 Thread sityee kong
Hi all, yes, im using python 2.4. I would like to know how does python 2.4 work for my case w/o the new added feature in 2.6? Do you guys know? thanks! On Mon, Nov 2, 2009 at 5:02 PM, Tim Chase wrote: > I would like to open the csv file with folowwing command, >>> >>> file=archive.open("CHAVI_

Re: read Zipfile

2009-11-02 Thread Chris Rebert
> On Mon, Nov 2, 2009 at 5:02 PM, Tim Chase > wrote: I would like to open the csv file with folowwing command, file=archive.open("CHAVI_MACS_SC_A__AUG_25_08_FinalReport_090812.csv","r") But it turned out error, Traceback (most recent call last):  File "", line 1,

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message , Robert Kern wrote: > On 2009-11-02 14:47 PM, Lawrence D'Oliveiro wrote: > >> For instance, I'm not aware of any database API that lets me do this: >> >> sql.cursor.execute \ >>( >> "update numbers set flags = flags | %(setflags)u where >> project

Re: __eq__() inconvenience when subclassing set

2009-11-02 Thread Gabriel Genellina
En Mon, 02 Nov 2009 22:05:42 -0300, Jess Austin escribió: On Nov 1, 1:13 am, "Gabriel Genellina" wrote: Looks like in 3.1 this can be done with bytes+str and viceversa, even if bytes and str don't have a common ancestor (other than object; basestring doesn't exist in 3.x): The same examp

Re: read Zipfile

2009-11-02 Thread Tim Chase
I would like to know how does python 2.4 work for my case w/o the new added feature in 2.6? Do you guys know? You can just grab the zipfile.py file from within the 2.6 distribution[1] and dump it in your project folder. Python should find it before it finds the 2.4 version in the $PYTHONPATH

  1   2   >