Re: Diversity in Python

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 12:38:36 Ben Finney wrote: > Hendrik van Rooyen writes: > > On Tuesday 18 August 2009 06:45:39 Aahz wrote: > > > Mainly an opportunity to flog the new diversity list. > > > > Here my English fails me - flog as in "whip", or flog as in "sell"? > > Yes :-) Thank you that c

Re: recording input from USB port and write to text file

2009-08-19 Thread Diez B. Roggisch
Allan schrieb: Hi! I'm fairly new to Python. I understand the basics basics but I'm been trying to write a simple python code that will let me read input data (such as mouse movement) from my USB port and write it in a text file and I am so lost. Can anyone help or direct me to some resources?

Re: Inheriting dictionary

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 21:44:55 Pavel Panchekha wrote: > I want a dictionary that will transparently "inherit" from a parent > dictionary. So, for example: > > """ > a = InheritDict({1: "one", 2: "two", 4: "four"}) > b = InheritDict({3: "three", 4: "foobar"}, inherit_from=a) > > a[1] # "one" > a

Re: Parallelization in Python 2.6

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 22:45:38 Robert Dailey wrote: > Really, all I'm trying to do is the most trivial type of > parallelization. Take two functions, execute them in parallel. This > type of parallelization is called "embarrassingly parallel", and is > the simplest form. There are no dependenc

Re: Read C++ enum in python

2009-08-19 Thread Mark Tolonen
"MRAB" wrote in message news:4a8b3e2d.7040...@mrabarnett.plus.com... Ludo wrote: Hello, I work in a very large project where we have C++ packages and pieces of python code. I've been googleing for days but what I find seems really too complicated for what I want to do. My business is,

socket bug or not?

2009-08-19 Thread Gabriel Rossetti
Hello everyone, I found what was not working in my code (see Twisted mailing list topics "self.socket.accept() in doRead() in tcp.py has (11, 'Resource temporarily unavailable') error", "Twisted, PushProducer, Words & big msgs, any limit?" and Python mailing list topic "socket.send : (11, 'Re

expandtabs acts unexpectedly

2009-08-19 Thread digisat...@gmail.com
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> ' test\ttest'.expandtabs(4) ' test test' >>> 'test \ttest'.expandtabs(4) 'testtest' 1st example: expect returning 4 spaces between 'test', 3

Re: expandtabs acts unexpectedly

2009-08-19 Thread Xavier Ho
On Wed, Aug 19, 2009 at 5:57 PM, digisat...@gmail.com wrote: > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> ' test\ttest'.expandtabs(4) > ' test test' > >>> 'test \ttest'.expandtabs(4)

Re: Parallelization in Python 2.6

2009-08-19 Thread Paul Rubin
Hendrik van Rooyen writes: > Just use thread then and thread.start_new_thread. > It just works. The GIL doesn't apply to threads made like that?! -- http://mail.python.org/mailman/listinfo/python-list

Re: Read C++ enum in python

2009-08-19 Thread Neil Hodgson
AggieDan04: > file_data = open(filename).read() > # Remove comments and preprocessor directives > file_data = ' '.join(line.split('//')[0].split('#')[0] for line in > file_data.splitlines()) > file_data = ' '.join(re.split(r'\/\*.*\*\/', file_data)) For some headers I tried it didn't work unti

Re: expandtabs acts unexpectedly

2009-08-19 Thread Peter Brett
"digisat...@gmail.com" writes: > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. ' test\ttest'.expandtabs(4) > ' test test' 'test \ttest'.expandtabs(4) > 'testtest' > > 1st examp

reading a text file

2009-08-19 Thread superpollo
hi clp what's the difference between: while True: input_line = sys.stdin.readline() if input_line: sys.stdout.write(input_line.upper()) else: break and: while True: try: sys.stdout.write(sys.stdin.next().upper()) except StopIteration

Re: reading a text file

2009-08-19 Thread Paul Rubin
superpollo writes: > while True: > try: > sys.stdout.write(sys.stdin.next().upper()) > except StopIteration: > break Maybe there is some subtle difference, but it looks like you really mean for line in sys.stdin: sys.stdout.write(line.upper()) -- http://mai

difference between 2 arrays

2009-08-19 Thread Pierre
Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... I thought a.difference(b) could work, but no : AttributeError: 'numpy.ndarray' object has no at

Re: Identifying a class type - bad practice?

2009-08-19 Thread James Harris
On 18 Aug, 21:50, Chris Rebert wrote: > On Tue, Aug 18, 2009 at 10:09 AM, James > > Harris wrote: > > I am writing some code to form a tree of nodes of different types. The > > idea is to define one class per node type such as > > > class node_type_1(node): > >   > > class node_type_2(node): > >  

Re: difference between 2 arrays

2009-08-19 Thread Diez B. Roggisch
Pierre wrote: > Hello, > > I would like to know how to find the difference (set operation) > between 2 arrays : > > a = array([1,2, 3,2,5,2]) > b = array([1,2]) > I want a - b = [3,5] > > Well, the equivalence of setdiff in matlab... > > I thought a.difference(b) could work, but no : Attribute

Re: difference between 2 arrays

2009-08-19 Thread Michel Claveau - MVP
(envoyé via news:\\news.wanadoo.fr\comp.lang.python) Hi! See the module "sets" @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: reading a text file

2009-08-19 Thread Peter Otten
superpollo wrote: > hi clp > > what's the difference between: > > while True: > input_line = sys.stdin.readline() > if input_line: > sys.stdout.write(input_line.upper()) > else: > break > > and: > > > while True: > try: > sys.stdo

Re: Scope and classes

2009-08-19 Thread Bruno Desthuilliers
Chris Rebert a écrit : (snip) To access class-level variables from within instance methods of the class, you have 2 options: A. Use the class name, i.e. Abc.message B. Reference the class indirectly, i.e. self.__class__.message Or even simpler - *if* there's no synonym instance attribute: => s

How to create ones own lib

2009-08-19 Thread Horst Jäger
Hi, I would like to create my own lib "hotte.py" which I can import like import string,hotte . How do I do that? I'm working on MacOS 10.5.6 . Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create ones own lib

2009-08-19 Thread Xavier Ho
On Wed, Aug 19, 2009 at 7:00 PM, Horst Jäger wrote: > Hi, > > I would like to create my own lib "hotte.py" which I can import like > > >import string,hotte > > . How do I do that? > 1) Have the hotte.py in the same directory of any of your other Python code that imports it, or 2) Put the

Re: How to create ones own lib

2009-08-19 Thread Francesco Bochicchio
On 19 Ago, 11:00, Horst Jäger wrote: > Hi, > > I would like to create my own lib "hotte.py" which I can import like > >         import string,hotte > > . How do I do that? > > I'm working on MacOS 10.5.6 . > > Thanks in advance Just create the file 'hotte.py' and place it somewhere python can fin

Re: Scope and classes

2009-08-19 Thread Bruno Desthuilliers
David a écrit : (snip) Out of 'Abc.message' and 'self.message', which is the favoured convention? It would be very easy to accidentally override 'self.messages' with an instance attribute! Only use 'Abc.message' if you want to make sure you get the Abc class 'message' attribute - that is, if

Re: Read C++ enum in python

2009-08-19 Thread Bill Davy
"Mark Tolonen" wrote in message news:mailman.89.1250666942.2854.python-l...@python.org... > > "MRAB" wrote in message > news:4a8b3e2d.7040...@mrabarnett.plus.com... >> Ludo wrote: >>> Hello, >>> >>> I work in a very large project where we have C++ packages and pieces of >>> python code. >>> >>

Re: Need cleanup advice for multiline string

2009-08-19 Thread Jean-Michel Pichavant
Grant Edwards wrote: On 2009-08-18, Simon Forman wrote: Sexism, racism, homophobia, religious intolerance, etc., all stem from a fundamental forgetfulness of our Unity in God (as I would put it) and this is perhaps the single greatest cause of human misery. You mean the single greate

Re: Identifying a class type - bad practice?

2009-08-19 Thread Bruno Desthuilliers
James Harris a écrit : On 18 Aug, 21:50, Chris Rebert wrote: (snip) class node_type_1: def walk_tree(self): #code self.subtree.walk() class node_type_2: def walk_tree(self): #code self.subtree.walk() #etc Interesting idea. Basic OO stuff, really. I

Re: Need cleanup advice for multiline string

2009-08-19 Thread Jean-Michel Pichavant
Simon Forman wrote: On Tue, Aug 18, 2009 at 8:03 PM, Steven D'Aprano wrote: On Tue, 18 Aug 2009 17:13:02 -0400, Simon Forman wrote: Sexism, racism, homophobia, religious intolerance, etc., all stem from a fundamental forgetfulness of our Unity in God (as I would put it) and Of

Re: How to create ones own lib

2009-08-19 Thread Nick Craig-Wood
Horst Jäger wrote: > I would like to create my own lib "hotte.py" which I can import like > > import string,hotte > > . How do I do that? One of the nice things about python is that you don't need to do anything special to define a library. Just define your classes / functions in hotte

Re: expandtabs acts unexpectedly

2009-08-19 Thread digisat...@gmail.com
On Aug 19, 4:16 pm, Peter Brett wrote: > "digisat...@gmail.com" writes: > > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) > > [GCC 4.3.3] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > ' test\ttest'.expandtabs(4) > > ' test   test' > 'test

Re: How to create functors?

2009-08-19 Thread Terry Reedy
Robert Dailey wrote: I'm using Python 2.6. And using the legacy syntax in the lambda does not work either. I want to avoid using a def if possible. Thanks. In Python, writing name = lambda arg: expr instead of def name(arg): return expr is all negative and no positive and should be avoided

Re: Raw Strings with Variables

2009-08-19 Thread Terry Reedy
WilsonOfCanada wrote: Hellos, I know that if you have: happy = r"C:\moo" print happy you get C:\moo instead of C:\\moo The thing is that I want to do this a variable instead. ex. testline = fileName.readline() rawtestline = r testline Python does not have 'raw strings'. It only has '

Re: urlopen errors in script

2009-08-19 Thread Sleepy Cabbage
On Tue, 18 Aug 2009 13:05:03 +, Sleepy Cabbage wrote: > Thanks for the time you've spent anyway Peter. I have superkaramba > installed and the rest of the script is running fine, it's only when I > put the urlopen part in that it comes back with errors. The quotes are > just to make it readabl

Re: reading a text file

2009-08-19 Thread Tino Wildenhain
superpollo wrote: hi clp what's the difference between: while True: input_line = sys.stdin.readline() if input_line: sys.stdout.write(input_line.upper()) else: break and: while True: try: sys.stdout.write(sys.stdin.next().upper()) e

Help with libxml2dom

2009-08-19 Thread Nuno Santos
I have just started using libxml2dom to read html files and I have some questions I hope you guys can answer me. The page I am working on (teste.htm): Title 8/15/2009 >>> import libxml2dom >>> foo

About Python Symbian 60

2009-08-19 Thread Kannan
Hi friends I want a Python SDK like Netbeans to work with the Symbian 60 python. I don't have the Symbian 60 mobile.I create some Apps for S60 Platform.To execute that i want this Help me.. With regards, Kannan. R. P, -- http://mail.python.org/mailman/listinfo/python-list

Re: Parallelization in Python 2.6

2009-08-19 Thread sturlamolden
On 18 Aug, 11:19, Robert Dailey wrote: > I'm looking for a way to parallelize my python script without using > typical threading primitives. For example, C++ has pthreads and TBB to > break things into "tasks". In C++, parallelization without "typical threading primitives" usually means one of t

Re: Re: Parallelization in Python 2.6

2009-08-19 Thread Dave Angel
Hendrik van Rooyen wrote: On Tuesday 18 August 2009 22:45:38 Robert Dailey wrote: Really, all I'm trying to do is the most trivial type of parallelization. Take two functions, execute them in parallel. This type of parallelization is called "embarrassingly parallel", and is the simplest form

Excel edit using python

2009-08-19 Thread suman
Hi, Is there any package to edit the existing excel cell data using python or to create excel charts using python please help. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: Parallelization in Python 2.6

2009-08-19 Thread sturlamolden
On 18 Aug, 13:45, Robert Dailey wrote: > Really, all I'm trying to do is the most trivial type of > parallelization. Take two functions, execute them in parallel. This > type of parallelization is called "embarrassingly parallel", and is > the simplest form. There are no dependencies between the

Re: Excel edit using python

2009-08-19 Thread Tim Wintle
On Wed, 2009-08-19 at 05:25 -0700, suman wrote: > > Is there any package to edit the existing excel cell data using python > or > to create excel charts using python Chris, Chris, where are you? http://www.python-excel.org/ Site provided by Chris Withers: http://mail.python.org/pipermail/py

Re: Parallelization in Python 2.6

2009-08-19 Thread Martin P. Hellwig
sturlamolden wrote: The human brain is bad at detecting computational bottlenecks though. So it almost always pays off to write everything in Python first, and use the profiler to locate the worst offenders. +1 QOTW -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoni

Re: Help with libxml2dom

2009-08-19 Thread Diez B. Roggisch
Nuno Santos wrote: > I have just started using libxml2dom to read html files and I have some > questions I hope you guys can answer me. > > The page I am working on (teste.htm): > > > > Title > > > > > > > > > > >

Re: recording input from USB port and write to text file

2009-08-19 Thread Piet van Oostrum
> Allan (A) wrote: >A> Hi! I'm fairly new to Python. I understand the basics basics but I'm >A> been trying to write a simple python code that will let me read input >A> data (such as mouse movement) from my USB port and write it in a text >A> file and I am so lost. Can anyone help or direc

Re: Parallelization in Python 2.6

2009-08-19 Thread sturlamolden
On 19 Aug, 05:16, sturlamolden wrote: > You should know about the GIL. It prevents multiple threads form using > the Python interpreter simultaneously. For parallel computing, this is > a blessing and a curse. Only C extensions can release the GIL; this > includes I/0 routines in Python's standar

Re: Subclass dynamically

2009-08-19 Thread Piet van Oostrum
> Robert Dailey (RD) wrote: >RD> Hey, >RD> I have a class that I want to have a different base class depending on >RD> a parameter that I pass to its __init__method. For example >RD> (pseudocode): >RD> class MyDerived( self.base ): >RD> def __init__( self, base ): >RD> self.base = base

Re: Parallelization in Python 2.6

2009-08-19 Thread Hendrik van Rooyen
On Wednesday 19 August 2009 10:13:41 Paul Rubin wrote: > Hendrik van Rooyen writes: > > Just use thread then and thread.start_new_thread. > > It just works. > > The GIL doesn't apply to threads made like that?! The GIL does apply - I was talking nonsense again. Misread the OP's intention. - He

Re: recording input from USB port and write to text file

2009-08-19 Thread Diez B. Roggisch
Piet van Oostrum wrote: >> Allan (A) wrote: > >>A> Hi! I'm fairly new to Python. I understand the basics basics but I'm >>A> been trying to write a simple python code that will let me read input >>A> data (such as mouse movement) from my USB port and write it in a text >>A> file and I am so

Re: Parallelization in Python 2.6

2009-08-19 Thread sturlamolden
On 19 Aug, 05:27, Dave Angel wrote: > With the current GIL implementation, for two CPU-bound tasks, you either > do them sequentially, or make a separate process. I'd also like to add that most compute-bound code should be delegated to specialized C libraries, many of which are prewritten. For e

Re: Parallelization in Python 2.6

2009-08-19 Thread sturlamolden
On 19 Aug, 05:34, Hendrik van Rooyen wrote: > The GIL does apply - I was talking nonsense again.  Misread the OP's > intention. It depends on what the OP's functions "doStuff1" and "doStuff2" actually do. If they release the GIL (e.g. make I/O calls) it does not apply. The GIL only serialize acc

Re: Parallelization in Python 2.6

2009-08-19 Thread sturlamolden
On 18 Aug, 11:41, Stefan Behnel wrote: > I think the canonical answer is to use the threading module or (preferably) > the multiprocessing module, which is new in Py2.6. > > http://docs.python.org/library/threading.htmlhttp://docs.python.org/library/multiprocessing.html > > Both share a (mostly)

listen and receive the stock price from a VPN

2009-08-19 Thread John Liu
Hi, My friends   I am trying a Pyhton script to connect a VPN with (IP address, user ID, and passwrod).   suppose I need to use Socket to connect the VPN and compare to a list of stock tickers I want to receive.   Is there any wasy way and fast way to do that?   Thanks so much in advance.   Kind

Re: Using a Callback Function - ftplib

2009-08-19 Thread nitebirdz
On Mon, Aug 17, 2009 at 11:10:25AM -0700, seldan24 wrote: > > I didn't even notice the higher level methods. I changed the > retrieval line to: > > ftp.nlst("testfile*.txt") > > This works great. The result is even captured in an array. I really > have no idea what the difference between a LI

Re: Parallelization in Python 2.6

2009-08-19 Thread sturlamolden
On 19 Aug, 05:27, Dave Angel wrote: > But if you do it that way, it's slower than sequential.  And if you have > a multi-core processor, or two processors, or ...   then it gets much > slower yet, and slows down other tasks as well. > > With the current GIL implementation, for two CPU-bound tasks

Re: Need cleanup advice for multiline string

2009-08-19 Thread Carl Banks
On Aug 18, 8:49 pm, Ben Finney wrote: > Grant Edwards writes: > > On 2009-08-19, Ben Finney wrote: > > > Simon Forman writes: > > >> We are one family. > > > > Agreed. > > > That's not much comfort if you've seen the way many families get along > > with each other. > > Demonstrable facts, by na

Re: Changing Python Opcodes

2009-08-19 Thread Peter Otten
Diez B. Roggisch wrote: > Sreejith K wrote: >> So I compiled Python from source changing some opcode values > Nobody > can be helping you there, because it's *your* code, not Python anymore. > And giving others access to it defies somewhat the purpose of the whole > exercise ...and everyon

Re: difference between 2 arrays

2009-08-19 Thread Michel Claveau - MVP
Re ! Juste pour signaler qu'il existe un newsgroup en français sur Python, qui permet de recevoir des réponses en français (donc plus complètes/détaillées). @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

can't retrieve data from pyxml

2009-08-19 Thread Sakib
well, i need to retrive data from the following line of xml. i need the Caption and the type data. is any one out there help me doing that? thanks, Sakib -- http://mail.python.org/mailman/listinfo/python-list

Re: Using a Callback Function - ftplib

2009-08-19 Thread seldan24
On Aug 18, 6:02 am, Nitebirdz wrote: > On Mon, Aug 17, 2009 at 11:10:25AM -0700, seldan24 wrote: > > > I didn't even notice the higher level methods.  I changed the > > retrieval line to: > > > ftp.nlst("testfile*.txt") > > > This works great.  The result is even captured in an array.  I really >

Re: can't retrieve data from pyxml

2009-08-19 Thread Diez B. Roggisch
Sakib schrieb: well, i need to retrive data from the following line of xml. i need the Caption and the type data. is any one out there help me doing that? That's not XML. It lacks namespace-declarations. So no XML-parser will (or should) grok it. Also, to get help here it's better t

Re: Code formatting question: conditional expression

2009-08-19 Thread Diez B. Roggisch
> BTW, from the (admittedly few) responses to my original post, it seems > there's some sentiment that "conditional expressions" are a non-Pythonic > misfeature. Interesting ... No. I love them. But not if they are so large that they stretch over several lines (or to many columns). foo = bar if

Re: Need cleanup advice for multiline string

2009-08-19 Thread Ben Finney
Jean-Michel Pichavant writes: > Anyway the hysteria that is surrounding this thread is just amazing. If the calm reproach that has been the maximum response so far seems like “hysteria” to you, I can only conclude you have only been using the internet for a few hours. -- \ “The fact

Re: Scope and classes

2009-08-19 Thread Ben Finney
David writes: > Out of 'Abc.message' and 'self.message', which is the favoured > convention? It's not a matter of convention. They mean different things, so you use each depending on what you mean. > It would be very easy to accidentally override 'self.messages' with an > instance attribute! R

Re: Need cleanup advice for multiline string

2009-08-19 Thread Ben Finney
Grant Edwards writes: > On 2009-08-19, Ben Finney wrote: > > Simon Forman writes: > >> We are one family. > > > > Agreed. > > That's not much comfort if you've seen the way many families get along > with each other. Demonstrable facts, by nature of being independently verifiable, are a better

Re: Need cleanup advice for multiline string

2009-08-19 Thread Ben Finney
Simon Forman writes: > On Tue, Aug 18, 2009 at 8:42 PM, Ben Finney wrote: > > We're all unified by our humanity. Bringing any god into the picture > > is surely counter to any goals of unity. > > Unity "in humanity" is, to my way of thinking, the same as Unity "in > God". Then you're playing Hum

Re: Need cleanup advice for multiline string

2009-08-19 Thread Grant Edwards
On 2009-08-19, Ben Finney wrote: > Simon Forman writes: >> We are one family. > > Agreed. That's not much comfort if you've seen the way many families get along with each other. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-19 Thread Gilles Ganault
I find it odd that the regex library can't handle European characters :-/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Parallelization in Python 2.6

2009-08-19 Thread Neal Becker
sturlamolden wrote: > On 18 Aug, 11:41, Stefan Behnel wrote: > >> I think the canonical answer is to use the threading module or >> (preferably) the multiprocessing module, which is new in Py2.6. >> >> http://docs.python.org/library/threading.htmlhttp://docs.python.org/library/multiprocessing.h

Re: Subclass dynamically

2009-08-19 Thread Bruno Desthuilliers
Robert Dailey a écrit : Hey, I have a class that I want to have a different base class depending on a parameter that I pass to its __init__method. For example (pseudocode): class MyDerived( self.base ): def __init__( self, base ): self.base = base Something like that... and then I would

Re: Code formatting question: conditional expression

2009-08-19 Thread Bruno Desthuilliers
Richard Brodie a écrit : "John Posner" wrote in message news:mailman.26.1250604346.2854.python-l...@python.org... if total > P.BASE: excessblk = Block(total - P.BASE, srccol, carry_button_suppress=True) else: excessblk = None I wonder if it is appropriate to replace the None sen

NOOB: Developing using python on two different computers

2009-08-19 Thread Smeagol
Hi there, Occasionally I have to develop on two different computers, and I was wondering if there was a way to copy the python "environment" from one to the other? Access to the data is trivial (networked database) but various packages etc exist on one computer, and I want to ensure I have everyt

Re: How to create functors?

2009-08-19 Thread Bruno Desthuilliers
Terry Reedy a écrit : Robert Dailey wrote: I'm using Python 2.6. And using the legacy syntax in the lambda does not work either. I want to avoid using a def if possible. Thanks. In Python, writing name = lambda arg: expr instead of def name(arg): return expr is all negative and no positiv

Re: difference between 2 arrays

2009-08-19 Thread John Machin
On Aug 19, 6:56 pm, "Michel Claveau - MVP" wrote: > See the module "sets" See especially the notice at the front of the current sets doc which says "deprecated since 2.6" and the comparison down the end which explains why the built-in set() and frozenset() are better than the sets module. Startin

Re: Help with libxml2dom

2009-08-19 Thread Paul Boddie
On 19 Aug, 13:55, Nuno Santos wrote: > I have just started using libxml2dom to read html files and I have some > questions I hope you guys can answer me. [...] >  >>> table = body.firstChild >  >>> table.nodeName > u'text' #?! Why!? Shouldn't it be a table? (1) You answer this yourself just bel

Re: Parallelization in Python 2.6

2009-08-19 Thread Grant Edwards
On 2009-08-19, Stefan Behnel wrote: > Dennis Lee Bieber wrote: >> If they are number crunchers (CPU-bound) and don't make use of >> binary extension libraries that release the GIL (for the most common >> Python implementation), they'll run faster being called in sequence >> since you won't h

Re: difference between 2 arrays

2009-08-19 Thread baalu aanand
On Aug 19, 1:48 pm, Pierre wrote: > Hello, > > I would like to know how to find the difference (set operation) > between 2 arrays : > > a = array([1,2, 3,2,5,2]) > b = array([1,2]) > I want a - b = [3,5] > > Well, the equivalence of setdiff in matlab... > > I thought a.difference(b) could work, bu

Re: difference between 2 arrays

2009-08-19 Thread baalu aanand
On Aug 19, 1:48 pm, Pierre wrote: > Hello, > > I would like to know how to find the difference (set operation) > between 2 arrays : > > a = array([1,2, 3,2,5,2]) > b = array([1,2]) > I want a - b = [3,5] > > Well, the equivalence of setdiff in matlab... > > I thought a.difference(b) could work, bu

Re: difference between 2 arrays

2009-08-19 Thread Matthias Huening
Pierre (19.08.2009 10:48): Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] What about set()? >>> a = set([1,2, 3,2,5,2]) >>> b = set([1,2]) >>> a.difference(b) set([3, 5]) Matthias --

New message

2009-08-19 Thread La Vie Spirituelle
Test -- http://mail.python.org/mailman/listinfo/python-list

Re: difference between 2 arrays

2009-08-19 Thread David Robinow
On Wed, Aug 19, 2009 at 4:48 AM, Pierre wrote: > Hello, > > I would like to know how to find the difference (set operation) > between 2 arrays : > > a = array([1,2, 3,2,5,2]) > b = array([1,2]) > I want a - b = [3,5] > > Well, the equivalence of setdiff in matlab... > > I thought a.difference(b) co

Re: Read C++ enum in python

2009-08-19 Thread Ludo
Neil Hodgson a écrit : For some headers I tried it didn't work until the .* was changed to a non-greedy .*? to avoid removing from the start of the first comment to the end of the last comment. file_data = ' '.join(re.split(r'\/\*.*?\*\/', file_data)) Thank you ! I adopt it ! Cheers. -- h

Re: difference between 2 arrays

2009-08-19 Thread Diez B. Roggisch
baalu aanand wrote: > On Aug 19, 1:48 pm, Pierre wrote: >> Hello, >> >> I would like to know how to find the difference (set operation) >> between 2 arrays : >> >> a = array([1,2, 3,2,5,2]) >> b = array([1,2]) >> I want a - b = [3,5] >> >> Well, the equivalence of setdiff in matlab... >> >> I tho

Re: difference between 2 arrays

2009-08-19 Thread Robert Kern
On 2009-08-19 01:48 AM, Pierre wrote: Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... You will want to ask numpy questions on the numpy mail

Re: How do I convert an iterator over bytes into a str?

2009-08-19 Thread markscottwright
On Aug 18, 6:52 pm, "Jan Kaliszewski" wrote: > 19-08-2009 o 00:24:20 markscottwright wrote: > > > What's the correct way to turn an iterator over bytes into a string? > > This works, but, ewww: > >     In [8]: "".join(iter("four score and seven years ago")) > >     Out[8]: 'four score and seven y

Re: Need cleanup advice for multiline string

2009-08-19 Thread Aahz
In article , Jean-Michel Pichavant wrote: >MRAB wrote: >> Carl Banks wrote: >>> On Aug 17, 10:03 am, Jean-Michel Pichavant >>> wrote: I'm no English native, but I already heard women/men referring to a group as "guys", no matter that group gender configuration. It's even used

Re: difference between 2 arrays

2009-08-19 Thread sturlamolden
On 19 Aug, 01:48, Pierre wrote: > Well, the equivalence of setdiff in matlab... That would be numpy.setdiff1d. -- http://mail.python.org/mailman/listinfo/python-list

Re: recording input from USB port and write to text file

2009-08-19 Thread Simon Forman
On Aug 18, 7:33 pm, Allan wrote: > Hi! I'm fairly new to Python.  I understand the basics basics but I'm > been trying to write a simple python code that will let me read input > data (such as mouse movement) from my USB port and write it in a text > file and I am so lost.  Can anyone help or dire

Re: Database query execution times in Python?

2009-08-19 Thread Aahz
In article , pwnedd wrote: > >> Look up EXPLAIN > >Thanks for the suggestion. I don't see any option to have EXPLAIN display >the query time though? My suggestion was partly a gentle push toward a database forum to get more information -- this isn't really a Python question. Unless all you want

Re: Need cleanup advice for multiline string

2009-08-19 Thread Simon Forman
On Aug 19, 12:05 am, Ben Finney wrote: > Simon Forman writes: > > On Tue, Aug 18, 2009 at 8:42 PM, Ben Finney > > wrote: > > > We're all unified by our humanity. Bringing any god into the picture > > > is surely counter to any goals of unity. > > > Unity "in humanity" is, to my way of thinking,

Re: httplib incredibly slow :-(

2009-08-19 Thread Aahz
In article , Chris Withers wrote: >Aahz wrote: >> >> What do you need to know for a decent example? > >Simple download of a file from a url with some auth headers added would >do me. Well, I've hacked up some sample code from my company's codebase: # !!! UNTESTED !!! c = pycurl.Curl() c.setopt

Re: generate keyboard/mouse event under windows

2009-08-19 Thread Ray
On Aug 19, 2:07 pm, yaka wrote: > Read this and see if it helps: > > http://kvance.livejournal.com/985732.html is there a way to generate a 'true' keyboard event? (works like user pressed a key on keyboard) not send the 'send keyboard event to application' ? -- http://mail.python.org/mailman/lis

Python and PHP encryption/decryption

2009-08-19 Thread Jean-Claude Neveu
I'm looking for a recommendation about encryption/decryption packages for Python. I'm working on a project that will require me to store some values in a database in encrypted format. I'll be storing them from a PHP script and retrieving them (decrypting them) using Python. I'm currently usin

Re: Any way to adjust difflib algorithm?

2009-08-19 Thread Aahz
In article , Grant Edwards wrote: >On 2009-08-14, Grant Edwards wrote: >> >> In my particular usage, no lines have ever been >> inserted/deleted, so perhaps I should be running diffs on >> individual lines instead? If I do that, I can't figure out >> how to generate HTML output. > >I ended up u

Re: NOOB: Developing using python on two different computers

2009-08-19 Thread Jonathan Gardner
On Aug 19, 6:50 am, Smeagol wrote: > Hi there, > > Occasionally I have to develop on two different computers, and I was > wondering if there was a way to copy the python "environment" from one > to the other? > > Access to the data is trivial (networked database) but various > packages etc exist o

Re: Any way to adjust difflib algorithm?

2009-08-19 Thread Grant Edwards
On 2009-08-19, Aahz wrote: > In article , > Grant Edwards wrote: >>On 2009-08-14, Grant Edwards wrote: >>> >>> In my particular usage, no lines have ever been >>> inserted/deleted, so perhaps I should be running diffs on >>> individual lines instead? If I do that, I can't figure out >>> how to

Re: python doc available in emacs info format?

2009-08-19 Thread A.Politz
On Aug 17, 6:43 am, Xah Lee wrote: > btw, is there still [no] info format for python doc? > > i feel kinda sad [...] > Part of this is due to [other peoples fault] Someone started a rst2info project (google it), maybe you want to help this guy out. Though, he might be a techgeeker, so watch out

Dictionary from a list

2009-08-19 Thread iu2
Hi all, I need to create a dictionary out of a list. Given the list [1, 2, 3, 4, 5, 6] I need the dictionary: {1:2, 3:4, 5:6} I'll appreciate your help Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Code formatting question: conditional expression

2009-08-19 Thread John Posner
Diez wrote: No. I love them. But not if they are so large that they stretch over several lines (or to many columns). foo = bar if cond else baz is more than fine for me. But foo = I_need_to_do_something_really_complicated_here() if cond else baz isn't, because one doesn't grasp as easily in

Re: Dictionary from a list

2009-08-19 Thread Diez B. Roggisch
iu2 schrieb: Hi all, I need to create a dictionary out of a list. Given the list [1, 2, 3, 4, 5, 6] I need the dictionary: {1:2, 3:4, 5:6} dict(zip(l[::2], l[1::2])) Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and PHP encryption/decryption

2009-08-19 Thread Diez B. Roggisch
Jean-Claude Neveu schrieb: I'm looking for a recommendation about encryption/decryption packages for Python. I'm working on a project that will require me to store some values in a database in encrypted format. I'll be storing them from a PHP script and retrieving them (decrypting them) using

Re: recording input from USB port and write to text file

2009-08-19 Thread Diez B. Roggisch
Simon Forman schrieb: On Aug 18, 7:33 pm, Allan wrote: Hi! I'm fairly new to Python. I understand the basics basics but I'm been trying to write a simple python code that will let me read input data (such as mouse movement) from my USB port and write it in a text file and I am so lost. Can an

  1   2   >