Re: lxml question -- creating an etree.Element attribute with ':' in the name

2013-09-18 Thread dieter
Roy Smith writes: > But, how do I handle something like: > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";, since "xmlns:xsi" > isn't a valid python identifier? Read about "lxml"'s "namespace" support. -- https://mail.python.org/mailman/listinfo/python-list

Re: iterating over a file with two pointers

2013-09-18 Thread Steven D'Aprano
On Wed, 18 Sep 2013 04:12:05 -0700, nikhil Pandey wrote: > hi, > I want to iterate over the lines of a file and when i find certain > lines, i need another loop starting from the next of that "CERTAIN" line > till a few (say 20) lines later. so, basically i need two pointers to > lines (one for ou

Re: Python GUI?

2013-09-18 Thread llanitedave
On Friday, September 13, 2013 10:31:17 AM UTC-7, Eamonn Rea wrote: > I don't like the idea of being able to drag and drop anything in the > programming world. Outside of that, I use D&D programs a lot. I got into GUI > programming because I thought that I could get away from them, but I guess >

Re: scipy 11 and scipy 12

2013-09-18 Thread Steven D'Aprano
On Wed, 18 Sep 2013 13:28:44 +0100, Oscar Benjamin wrote: > On 18 September 2013 03:48, Steven D'Aprano wrote: >> On Tue, 17 Sep 2013 20:06:44 -0400, Susan Lubbers wrote: >> >>> Our group is a python 2.7 which is installed in a shared area. We >>> have scipy 11 installed in site-packages. How w

Re: iterating over a file with two pointers

2013-09-18 Thread Steven D'Aprano
On Wed, 18 Sep 2013 05:14:23 -0700, nikhil Pandey wrote: > I want to iterate in the inner loop by reading each line till some > condition is met.how can i do that. Thanks for this code. while not condition: read line Re-write using Python syntax, and you are done. -- Steven -- https://

Re: mutlifile inheritance problem

2013-09-18 Thread Steven D'Aprano
On Wed, 18 Sep 2013 20:38:10 -0400, Ned Batchelder wrote: > super() takes a class and an instance for a reason. If you could use > self.__class__ for the class, then it would only take the instance. > Super() needs to know the instance, but also needs to know the class > it's being called from. Y

Re: mutlifile inheritance problem

2013-09-18 Thread Ned Batchelder
On 9/18/13 7:54 PM, Peter Cacioppi wrote: This is a very old topic, but here is a trick for single inheritance. (The problem you allude to isn't restricted to multiple inheritance). Any class with a single parent simply defines this function. def mySuper(self) : return super(sel

Re: mutlifile inheritance problem

2013-09-18 Thread Peter Cacioppi
One more comment - my trick has some utility with multiple inheritance, but you really need to understand super() to and method resolution ordering in that case (as, I suppose, you ought to whenever you cross the Rubicon beyond single inheritance). So it's a nice trick but YMMV On Wednesday, Se

Re: Tryign to send mail via a python script by using the local MTA

2013-09-18 Thread Dave Angel
On 18/9/2013 18:31, Dennis Lee Bieber wrote: > On Tue, 17 Sep 2013 18:34:50 -0400, William Ray Wing > declaimed the following: > > >> >>I think you need to read up on some of the most basic fundamentals of tcp/ip >>networking, i.e., the basis of the global internet. EVERY network packet >>(and

Re: mutlifile inheritance problem

2013-09-18 Thread Peter Cacioppi
This is a very old topic, but here is a trick for single inheritance. (The problem you allude to isn't restricted to multiple inheritance). Any class with a single parent simply defines this function. def mySuper(self) : return super(self.__class__, self) And then any parent

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread Dave Angel
On 18/9/2013 17:40, Neil Hodgson wrote: > Dave Angel: > >> So is the bug in Excel, in Windows, or in the Python library? Somebody >> is falling down on the job; if Windows defines the string as ending at >> the first null, then the Python interface should use that when defining >> the text defin

Python with Delphi

2013-09-18 Thread Errol Anderson
Is there anyone out there who uses Python with Delphi, or knows someone who uses Python with Delphi or who used to use Python with Delphi? The latest version of "Python for Delphi" (P4D) works fine with Python 2.5 and Delphi 2007, but not for Python 2.7. Any assistance gratefully received. Er

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread Neil Hodgson
Dave Angel: So is the bug in Excel, in Windows, or in the Python library? Somebody is falling down on the job; if Windows defines the string as ending at the first null, then the Python interface should use that when defining the text defined with CF_UNICODETEXT. Everything is performing

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread Dave Angel
On 18/9/2013 15:40, MRAB wrote: > On 18/09/2013 20:28, stephen.bou...@gmail.com wrote: >> Thanks to everyone for their help. Using everyone's suggestions, this seems >> to work: >> >> import win32clipboard, win32con >> >> def getclipboard(): >> win32clipboard.OpenClipboard() >> s = win3

Re: iterating over a file with two pointers

2013-09-18 Thread Dave Angel
On 18/9/2013 10:36, Roy Smith wrote: >> Dave Angel wrote (and I agreed with): >>> I'd suggest you open the file twice, and get two file objects. Then you >>> can iterate over them independently. > > > On Sep 18, 2013, at 9:09 AM, Oscar Benjamin wrote: >> There's no need to use OS resources by op

Re: Python GUI?

2013-09-18 Thread Michael Torrie
On 09/17/2013 10:19 AM, Benjamin Kaplan wrote: > Sure. Every platform provides its own GUI library (Cocoa on Mac OS X, > Win32 on Windows). Other programs that want to hook into yours, such > as screen readers, are familiar with the platform's native GUI > elements- it knows what a Win32 combo box

Re: linregress and polyfit

2013-09-18 Thread Dave Angel
On 18/9/2013 09:38, chitt...@uah.edu wrote: > Thanks - that helps ... but it is puzzling because > > np.random.normal(0.0,1.0,1) returns exactly one > and when I checked the length of "z", I get 21 (as before) ... > > I don't use Numpy, so this is just a guess, plus reading one web page. Accor

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread MRAB
On 18/09/2013 20:28, stephen.bou...@gmail.com wrote: Thanks to everyone for their help. Using everyone's suggestions, this seems to work: import win32clipboard, win32con def getclipboard(): win32clipboard.OpenClipboard() s = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)

Re: lxml question -- creating an etree.Element attribute with ':' in the name

2013-09-18 Thread Burak Arslan
On 09/18/13 21:59, Roy Smith wrote: > I can create an Element with a 'foo' attribute by doing: > > etree.Element('my_node_name', foo="spam") > > But, how do I handle something like: > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";, since "xmlns:xsi" > isn't a valid python identifier? > >

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread stephen . boulet
Thanks to everyone for their help. Using everyone's suggestions, this seems to work: import win32clipboard, win32con def getclipboard(): win32clipboard.OpenClipboard() s = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT) win32clipboard.CloseClipboard() if '\0' in s:

Re: lxml question -- creating an etree.Element attribute with ':' in the name

2013-09-18 Thread Zachary Ware
On Wed, Sep 18, 2013 at 1:59 PM, Roy Smith wrote: > I can create an Element with a 'foo' attribute by doing: > > etree.Element('my_node_name', foo="spam") > > But, how do I handle something like: > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";, since "xmlns:xsi" > isn't a valid python

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread random832
On Fri, Sep 13, 2013, at 12:09, random...@fastmail.us wrote: > Anyway, to match behavior found in other applications when pasting from > the clipboard, I would suggest using: > > if s.contains('\0'): s = s[:s.index('\0')] > > Which will also remove non-null bytes after the first null (but if the

lxml question -- creating an etree.Element attribute with ':' in the name

2013-09-18 Thread Roy Smith
I can create an Element with a 'foo' attribute by doing: etree.Element('my_node_name', foo="spam") But, how do I handle something like: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";, since "xmlns:xsi" isn't a valid python identifier? --- Roy Smith r...@panix.com -- https://mail.py

Re: Language design

2013-09-18 Thread Neil Cerutti
On 2013-09-18, wxjmfa...@gmail.com wrote: 1and 0 > 0 'a'or 1 > 'a' 5if True else 999 > 5 Curse you, FSR! Oh, wait... -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-18 Thread wxjmfauth
>>> 1and 0 0 >>> 'a'or 1 'a' >>> 5if True else 999 5 jmf -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-18 Thread William Ray Wing
On Sep 18, 2013, at 11:12 AM, Chris Angelico wrote: > On Thu, Sep 19, 2013 at 1:08 AM, Neil Cerutti wrote: >> On 2013-09-18, Chris Angelico wrote: >>> On Thu, Sep 19, 2013 at 12:57 AM, Neil Cerutti wrote: There's lots of poetry with significant indentation, though. Imbuing the shape

Re: iterating over a file with two pointers

2013-09-18 Thread Travis Griggs
On Sep 18, 2013, at 5:07 AM, nikhil Pandey wrote: > On Wednesday, September 18, 2013 4:51:51 PM UTC+5:30, Chris Angelico wrote: >> On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey >> wrote: >> >>> hi, >> >>> I want to iterate over the lines of a file and when i find certain lines, i >>> need

Re: Language design

2013-09-18 Thread Chris Angelico
On Thu, Sep 19, 2013 at 1:08 AM, Neil Cerutti wrote: > On 2013-09-18, Chris Angelico wrote: >> On Thu, Sep 19, 2013 at 12:57 AM, Neil Cerutti wrote: >>> There's lots of poetry with significant indentation, though. >>> Imbuing the shape of the text on the page with significance is a >>> thing. >>

Re: Language design

2013-09-18 Thread Neil Cerutti
On 2013-09-18, Chris Angelico wrote: > On Thu, Sep 19, 2013 at 12:57 AM, Neil Cerutti wrote: >> There's lots of poetry with significant indentation, though. >> Imbuing the shape of the text on the page with significance is a >> thing. > > And you can do that with C code, too. Doesn't mean that >

Re: Language design

2013-09-18 Thread Chris Angelico
On Thu, Sep 19, 2013 at 12:57 AM, Neil Cerutti wrote: > There's lots of poetry with significant indentation, though. > Imbuing the shape of the text on the page with significance is a > thing. And you can do that with C code, too. Doesn't mean that indentation is important to C; it means that you

Re: Language design

2013-09-18 Thread Neil Cerutti
On 2013-09-13, Chris Angelico wrote: > On Sat, Sep 14, 2013 at 5:32 AM, Terry Reedy wrote: >> Poetry, including that in English, often *is* concerned with formatting. >> Code is more like poetry than prose. >> >> >>> You can take this >>> paragraph of text, unwrap it, and then reflow it to any wi

Re: Please use the Python Job Board for recruiting (was: Python Developers)

2013-09-18 Thread Skip Montanaro
On Wed, Sep 18, 2013 at 2:57 AM, Ben Finney wrote: > Kelly Lurz writes: > >> List > > Please do not use this discussion forum for job advertisements. > > Instead, please use the Python Job Board designed for this purpose > http://www.python.org/community/jobs/>. Agreed. This recruiter also spamm

Re: iterating over a file with two pointers

2013-09-18 Thread Roy Smith
> Dave Angel wrote (and I agreed with): >> I'd suggest you open the file twice, and get two file objects. Then you >> can iterate over them independently. On Sep 18, 2013, at 9:09 AM, Oscar Benjamin wrote: > There's no need to use OS resources by opening the file twice or to > screw up the IO c

Re: linregress and polyfit

2013-09-18 Thread chitturk
Thanks - that helps ... but it is puzzling because np.random.normal(0.0,1.0,1) returns exactly one and when I checked the length of "z", I get 21 (as before) ... On Tuesday, September 17, 2013 9:34:39 PM UTC-5, Krishnan wrote: > I created an xy pair > > > > y = slope*x + intercept > > >

Re: iterating over a file with two pointers

2013-09-18 Thread Oscar Benjamin
On 18 September 2013 13:56, Roy Smith wrote: > >> > On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey >> > wrote: >> >> hi, >> >> I want to iterate over the lines of a file and when i find certain lines, >> >> i need another loop starting from the next of that "CERTAIN" line till a >> >> few (say 20

Re: iterating over a file with two pointers

2013-09-18 Thread Roy Smith
> > On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey > > wrote: > >> hi, > >> I want to iterate over the lines of a file and when i find certain lines, > >> i need another loop starting from the next of that "CERTAIN" line till a > >> few (say 20) lines later. > >> so, basically i need two point

Re: iterating over a file with two pointers

2013-09-18 Thread Peter Otten
nikhil Pandey wrote: > On Wednesday, September 18, 2013 5:14:10 PM UTC+5:30, Peter Otten wrote: > I want to iterate in the inner loop by reading each line till some > condition is met.how can i do that. Thanks for this code. That's not what I had in mind when I asked you to >> describe your act

Re: scipy 11 and scipy 12

2013-09-18 Thread Oscar Benjamin
On 18 September 2013 03:48, Steven D'Aprano wrote: > On Tue, 17 Sep 2013 20:06:44 -0400, Susan Lubbers wrote: > >> Our group is a python 2.7 which is installed in a shared area. We have >> scipy 11 installed in site-packages. How would I install scipy 12 so >> that I used the shared install of p

Re: iterating over a file with two pointers

2013-09-18 Thread nikhil Pandey
On Wednesday, September 18, 2013 5:14:10 PM UTC+5:30, Peter Otten wrote: > nikhil Pandey wrote: > > > > > hi, > > > I want to iterate over the lines of a file and when i find certain lines, > > > i need another loop starting from the next of that "CERTAIN" line till a > > > few (say 20) lines

Re: iterating over a file with two pointers

2013-09-18 Thread nikhil Pandey
On Wednesday, September 18, 2013 4:51:51 PM UTC+5:30, Chris Angelico wrote: > On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey > wrote: > > > hi, > > > I want to iterate over the lines of a file and when i find certain lines, i > > need another loop starting from the next of that "CERTAIN" line

Re: *.csv to *.txt after adding columns

2013-09-18 Thread Bryan Britten
Peter nailed it. Adding in the two lines of code to ensure I was just working with *.csv files fixed the problem. Thanks to everyone for the help and suggestions on best practices. -- https://mail.python.org/mailman/listinfo/python-list

Re: iterating over a file with two pointers

2013-09-18 Thread Peter Otten
nikhil Pandey wrote: > hi, > I want to iterate over the lines of a file and when i find certain lines, > i need another loop starting from the next of that "CERTAIN" line till a > few (say 20) lines later. so, basically i need two pointers to lines (one > for outer loop(for each line in file)) and

Re: iterating over a file with two pointers

2013-09-18 Thread Dave Angel
On 18/9/2013 07:21, Chris Angelico wrote: > On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey > wrote: >> hi, >> I want to iterate over the lines of a file and when i find certain lines, i >> need another loop starting from the next of that "CERTAIN" line till a few >> (say 20) lines later. >> so

Re: creating rectangle with qt-designer

2013-09-18 Thread MRAB
On 18/09/2013 04:41, Mohsen Pahlevanzadeh wrote: Dear all, I need to draw a rectangle , according to attached picture , you see a rectangle in a form that enclosed with a text: "Rebuild Last Target". Question: How can i draw a same rectangle with qt-designer? That's a "groupbox". In Qt it's c

Re: iterating over a file with two pointers

2013-09-18 Thread Chris Angelico
On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey wrote: > hi, > I want to iterate over the lines of a file and when i find certain lines, i > need another loop starting from the next of that "CERTAIN" line till a few > (say 20) lines later. > so, basically i need two pointers to lines (one for out

iterating over a file with two pointers

2013-09-18 Thread nikhil Pandey
hi, I want to iterate over the lines of a file and when i find certain lines, i need another loop starting from the next of that "CERTAIN" line till a few (say 20) lines later. so, basically i need two pointers to lines (one for outer loop(for each line in file)) and one for inner loop. How can

Re: HID Feature Raport, Linux

2013-09-18 Thread Kasper Jepsen
Den onsdag den 18. september 2013 12.10.29 UTC+2 skrev Anssi Saari: > > > > > Hi, > > > > > > I have been using pywinusb.hid for a hid unit, using only feature reports. > > > I like to get this code to run on raspbian PI, but i can not fint a good > > library to support HID/feature reports?

Re: HID Feature Raport, Linux

2013-09-18 Thread Anssi Saari
Kasper Jepsen writes: > Hi, > > I have been using pywinusb.hid for a hid unit, using only feature reports. > I like to get this code to run on raspbian PI, but i can not fint a good > library to support HID/feature reports? > I am a USB newbie > Can anyone help me, or point me in a direction to

Re: Remove \n, " " from tuple.

2013-09-18 Thread Vlastimil Brom
2013/9/18 Venkat Addala > Hi all, > > I have a tuple in this format, which is retrived using MySQLdb, now i want > to remove \n and extra spaces in this. > > 13L, 'ssDsC', 'CEs5s1, DsC', 'srylscetsmight\nghtscetylsse', '3', > '3q25.1', 151531861L, 151546276L, '+', '1 kjafhkfhlad\fdfdsdf ghtscetyl

Re: Remove \n, " " from tuple.

2013-09-18 Thread Dave Angel
On 18/9/2013 01:12, Venkat Addala wrote: > Hi all, > > I have a tuple in this format, which is retrived using MySQLdb, now i want > to remove \n and extra spaces in this. > > 13L, 'ssDsC', 'CEs5s1, DsC', 'srylscetsmight\nghtscetylsse', '3', '3q25.1', > 151531861L, 151546276L, '+', '1 kjafhkfhlad\f

Remove \n, " " from tuple.

2013-09-18 Thread Venkat Addala
Hi all, I have a tuple in this format, which is retrived using MySQLdb, now i want to remove \n and extra spaces in this. 13L, 'ssDsC', 'CEs5s1, DsC', 'srylscetsmight\nghtscetylsse', '3', '3q25.1', 151531861L, 151546276L, '+', '1 kjafhkfhlad\fdfdsdf ghtscetylsse \ncontends the sctivity of dsfdk s

Please use the Python Job Board for recruiting (was: Python Developers)

2013-09-18 Thread Ben Finney
Kelly Lurz writes: > List Please do not use this discussion forum for job advertisements. Instead, please use the Python Job Board designed for this purpose http://www.python.org/community/jobs/>. -- \ “I don't know half of you half as well as I should like, and I | `\ like less tha

Re: *.csv to *.txt after adding columns

2013-09-18 Thread Dave Angel
On 17/9/2013 22:28, Bryan Britten wrote: > Dave - > > I can't print the output because there are close to 1,000,000 records. It > would be extremely inefficient and resource intensive to look at every row. Not if you made a sample directory with about 3 files, each containing half a dozen lines.

Re: *.csv to *.txt after adding columns

2013-09-18 Thread rusi
On Wednesday, September 18, 2013 7:12:21 AM UTC+5:30, Bryan Britten wrote: > Hey, gang, I've got a problem here that I'm sure a handful of you will know > how to solve. I've got about 6 *.csv files that I am trying to open; change > the header names (to get rid of spaces); add two new columns, wh

Re: *.csv to *.txt after adding columns

2013-09-18 Thread Peter Otten
Bryan Britten wrote: > Hey, gang, I've got a problem here that I'm sure a handful of you will > know how to solve. I've got about 6 *.csv files that I am trying to open; > change the header names (to get rid of spaces); add two new columns, which > are just the results of a string.split() command;

Re: Having both if() and for() statements in one liner

2013-09-18 Thread Chris Angelico
On Wed, Sep 18, 2013 at 3:55 PM, Joshua Landau wrote: > range(person == "simon" and 5) +1 for the BOFH reference. ChrisA -- https://mail.python.org/mailman/listinfo/python-list