Re: an element from a set

2010-05-16 Thread Steven D'Aprano
On Sun, 16 May 2010 21:53:21 -0700, Carl Banks wrote: > I've never had to do it (at least not in any situations where I had any > reluctance to call list on it), but it seems like a fairly bad > limitation. Random element from a set is such a natural idea. There was a long discussion on the Pyth

Re: an element from a set

2010-05-16 Thread Carl Banks
On May 14, 11:52 pm, Chris Rebert wrote: > On Fri, May 14, 2010 at 11:23 PM, Carl Banks wrote: > > On May 14, 9:39 am, Terry Reedy wrote: > >> On 5/14/2010 11:24 AM, gerardob wrote: > >> > Hello, let S be a python set which is not empty > >> > (http://docs.python.org/library/sets.html) > > >> >

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 2:24 PM, Steven D'Aprano wrote: > In what way are they constant? Can you not modify them and rebind them? It's just style/convention :) Much like _ to denote private variables and methods! --james -- http://mail.python.org/mailman/listinfo/python-list

Re: tone generation for motherboard and sound card speakers?

2010-05-16 Thread Jake b
For sound ( not internal beep ) you can check out: - pygame: http://www.pygame.org/project-PygSoundTestTest-1453-.html - python.org/sound : http://wiki.python.org/moin/PythonInMusic - pk http://trac2.assembla.com/pkaudio/ - pureData http://puredata.info/Members/thomas/py -- Jake --

Re: Global variables for python applications

2010-05-16 Thread Steven D'Aprano
On Sun, 16 May 2010 18:57:15 -0700, John Nagle wrote: > James Mills wrote: >> The only place global variables are considered somewhat "acceptable" >> are as constants in a module shared as a static value. > > Python really ought to have named constants. +1 Unfortunately, it will most likely

Re: Picking a license

2010-05-16 Thread Aahz
In article <87r5ldbw3k@benfinney.id.au>, Ben Finney wrote: >a...@pythoncraft.com (Aahz) writes: >> >> You can't really sell Open Source software in any practical way; >> someone will always undercut you once it's out in the wild. You can >> only sell support for the software, which is entirel

Re: Global variables for python applications

2010-05-16 Thread Steven D'Aprano
On Mon, 17 May 2010 13:34:57 +1000, James Mills wrote: > On Mon, May 17, 2010 at 11:57 AM, John Nagle wrote: >>   For one thing, it's fine to share constants across threads, while >> sharing globals is generally undesirable.  Also, more compile-time >> arithmetic becomes possible. >> >>   Python

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 11:57 AM, John Nagle wrote: >   For one thing, it's fine to share constants across threads, while > sharing globals is generally undesirable.  Also, more compile-time > arithmetic becomes possible. > >   Python does have a few built-in named unassignable constants: > "True"

Re: A couple questions about classes and inheritance

2010-05-16 Thread Mark Young
You can't subclass Ellipsis. -- http://mail.python.org/mailman/listinfo/python-list

tone generation for motherboard and sound card speakers?

2010-05-16 Thread Alex Hall
Hi all, I am wondering if there is a way to generate a tone for the motherboard speaker, like the call to Beep() in C++? Also, is there a module to generate tones in Python using the sound card? A module that can beep at a given frequency for a given time using the usual sine wave is okay, but the

Re: Global variables for python applications

2010-05-16 Thread John Nagle
James Mills wrote: The only place global variables are considered somewhat "acceptable" are as constants in a module shared as a static value. Python really ought to have named constants. For one thing, it's fine to share constants across threads, while sharing globals is generally undes

Re: A couple questions about classes and inheritance

2010-05-16 Thread Terry Reedy
On 5/16/2010 6:58 PM, Paul LaFollette wrote: Anyway, again can you point me to somewhere that I can learn more? In particular, is there a list somewhere of the builtin types that are not subclassable? I believe that in 3.1, the builtin classes with builtin names can be subclassed and and tho

Re: A couple questions about classes and inheritance

2010-05-16 Thread Carl Banks
On May 16, 4:17 pm, Christian Heimes wrote: > > First, I've looked a fair bit and can't find how one can find the base > > classes of a subclass?  isinstance and issubclass sort of do the > > opposite of what I want.  Surely somewhere there is something like > > > MyThingee.something.orOther.baseC

Re: A couple questions about classes and inheritance

2010-05-16 Thread Steven D'Aprano
On Sun, 16 May 2010 18:58:45 -0400, Paul LaFollette wrote: > First, I've looked a fair bit and can't find how one can find the base > classes of a subclass? subclass.__base__ subclass.__bases__ subclass.__mro__ (The third one stands for "Method Resolution Order".) See also the inspect module.

Re: global variables in imported modules

2010-05-16 Thread vsoler
On 17 mayo, 00:52, Patrick Maupin wrote: > On May 16, 5:38 pm, James Mills wrote: > > > On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > > > However, can I be 100% sure that,no matter how I access variable > > > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > > > that eit

Re: A couple questions about classes and inheritance

2010-05-16 Thread Christian Heimes
First, I've looked a fair bit and can't find how one can find the base classes of a subclass? isinstance and issubclass sort of do the opposite of what I want. Surely somewhere there is something like MyThingee.something.orOther.baseClasses() You can get the direct parents of a class with the

A couple questions about classes and inheritance

2010-05-16 Thread Paul LaFollette
Kind people, Using Python 3.1 I have been poking around trying to get more insight into Python's innards, and I have a couple of (marginally) related questions. First, I've looked a fair bit and can't find how one can find the base classes of a subclass? isinstance and issubclass sort of do the

Re: global variables in imported modules

2010-05-16 Thread Patrick Maupin
On May 16, 5:38 pm, James Mills wrote: > On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > > However, can I be 100% sure that,no matter how I access variable > > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > > that either reference of 'x' points to the same id(memory posi

Re: global variables in imported modules

2010-05-16 Thread vsoler
On 17 mayo, 00:38, James Mills wrote: > On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > > However, can I be 100% sure that,no matter how I access variable > > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > > that either reference of 'x' points to the same id(memory posit

Re: global variables in imported modules

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > However, can I be 100% sure that,no matter how I access variable > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > that either reference of 'x' points to the same id(memory position)? Yes it does unless you re-assign it. --

Re: global variables in imported modules

2010-05-16 Thread vsoler
On 17 mayo, 00:05, Patrick Maupin wrote: > On May 16, 4:42 pm, vsoler wrote: > > > > > Taken fromwww.python.org, FAQ 2.3 How do I share global variables > > across modules? > > > config.py: > > > x = 0   # Default value of the 'x' configuration setting > > > mod.py: > > > import config > > config

Re: global variables in imported modules

2010-05-16 Thread Rhodri James
On Sun, 16 May 2010 22:42:40 +0100, vsoler wrote: Taken from www.python.org, FAQ 2.3 How do I share global variables across modules? config.py: x = 0 # Default value of the 'x' configuration setting mod.py: import config config.x = 1 main.py: import config # try removing it impo

Re: global variables in imported modules

2010-05-16 Thread Patrick Maupin
On May 16, 4:42 pm, vsoler wrote: > Taken fromwww.python.org, FAQ 2.3 How do I share global variables > across modules? > > config.py: > > x = 0   # Default value of the 'x' configuration setting > > mod.py: > > import config > config.x = 1 > > main.py: > > import config       # try removing it >

global variables in imported modules

2010-05-16 Thread vsoler
Taken from www.python.org, FAQ 2.3 How do I share global variables across modules? config.py: x = 0 # Default value of the 'x' configuration setting mod.py: import config config.x = 1 main.py: import config # try removing it import mod print config.x The example, such as shown in t

Re: imports and exec

2010-05-16 Thread Patrick Maupin
On May 16, 1:51 pm, Paul Carter wrote: > We are using python for our build system. Each subproject dir has a > python script that builds it. Parent dirs have python scripts that > recurse into their children and use exec to invoke the python scripts. > Recently we discovered that one of the python

Re: Access to comp.lang.python

2010-05-16 Thread Vincent Davis
I have no problem with threads Using gmail in a browser. That said I like how google groups handles email. I am also ways having to fix the reply on this list to send back to the list and not to the list and the last author. If someone knows a way to fix that I would be happy to hear it. Vincent

Re: Qt and progressBar - how to update

2010-05-16 Thread OMS
On 16 Maj, 20:52, Robert Kern wrote: > On 2010-05-16 13:28 , OMS wrote: > > > > > I am quite new to Python and Qt and need very urgently advice on how > > to update Qt progressBar while executing a process. I have went thrugh > > number of 'google' stuff and saw different solution, hence none work

Re: Picking a license

2010-05-16 Thread Patrick Maupin
On May 16, 9:19 am, Ed Keith wrote: > --- On Sat, 5/15/10, Lawrence D'Oliveiro > wrote: > > >> But what about the “freedom” to take away > > other > > >> people’s freedom? Is that really “freedom”? > > > > Yes. > > > But that’s a “freedom” that non-GPL licences do not > > give you, that the GPL

Re: Global variables for python applications

2010-05-16 Thread christian schulze
On 16 Mai, 20:20, James Mills wrote: > On Mon, May 17, 2010 at 4:00 AM, Krister Svanlund > > wrote: > > On Sun, May 16, 2010 at 7:50 PM, AON LAZIO wrote: > >>    How can I set up global variables for the entire python applications? > >> Like I can call and set this variables in any .py files. >

Re: Updating values in a dictionary

2010-05-16 Thread Terry Reedy
On 5/16/2010 1:36 PM, Thomas wrote: Greetings I am having a darn awful time trying to update a matrix: row = dict([(x,0) for x in range(3)]) matrix = dict([(x,row) for x in range(-3,4,1)]) matrix[2][1] += 1 matrix[-1][2] += 1 Dicts are fine for sparse matrixes, but when filled in, a list of

Re: Access to comp.lang.python

2010-05-16 Thread Terry Reedy
On 5/16/2010 11:35 AM, Grant Edwards wrote: On 2010-05-16, cjw wrote: On 16-May-10 01:31 AM, James Mills wrote: On Sun, May 16, 2010 at 3:12 PM, Aahz wrote: It's also at least partly due to problems with mail<->news gateways and the differing fields used to maintain threading. Some blame

Re: Human word reader

2010-05-16 Thread CM
On May 16, 2:57 pm, CM wrote: > > > I need help with getting the useful information how do I get the place > > > if I don't now how long the string is? > > >         And is it supposed to handle > > >         for london give the weather to me > >         for the london weather give me > > > ... >

Re: Human word reader

2010-05-16 Thread CM
> > I need help with getting the useful information how do I get the place > > if I don't now how long the string is? > >         And is it supposed to handle > >         for london give the weather to me >         for the london weather give me > > ... > >         Do a search on "natural language

Re: Access to comp.lang.python

2010-05-16 Thread Robert Kern
On 2010-05-16 11:47 , Jim Byrnes wrote: Grant Edwards wrote: On 2010-05-16, cjw wrote: On 16-May-10 01:31 AM, James Mills wrote: On Sun, May 16, 2010 at 3:12 PM, Aahz wrote: It's also at least partly due to problems with mail<->news gateways and the differing fields used to maintain threading

imports and exec

2010-05-16 Thread Paul Carter
We are using python for our build system. Each subproject dir has a python script that builds it. Parent dirs have python scripts that recurse into their children and use exec to invoke the python scripts. Recently we discovered that one of the python scripts works when invoked directly, but fails

Re: Qt and progressBar - how to update

2010-05-16 Thread Robert Kern
On 2010-05-16 13:28 , OMS wrote: I am quite new to Python and Qt and need very urgently advice on how to update Qt progressBar while executing a process. I have went thrugh number of 'google' stuff and saw different solution, hence none worked for me. The best idea I have seen is the usage of QTh

Re: Updating values in a dictionary

2010-05-16 Thread Thomas
Chris Wow, that was a very fast response. Thank you, it works (of course)... Cheers "Chris Rebert" wrote in message news:mailman.264.1274032106.32709.python-l...@python.org... On Sun, May 16, 2010 at 10:36 AM, Thomas wrote: Greetings I am having a darn awful time trying to update a matri

Re: recursively remove all the directories and files which begin with '.'

2010-05-16 Thread Walter Wefft
Irmen de Jong wrote: On 16-5-2010 19:41, Sean DiZazzo wrote: On May 14, 8:27 am, albert kao wrote: On May 14, 11:01 am, J wrote: On Fri, May 14, 2010 at 10:53, albert kao wrote: C:\python>rmdir.py C:\test\com.comp.hw.prod.proj.war\bin ['.svn', 'com'] d .svn dotd C:\test\com.comp.hw.pr

Re: Using site-packages with alt-installed Python version

2010-05-16 Thread Tuomas Vesterinen
On 05/16/2010 02:38 PM, Alister wrote: On Sun, 16 May 2010 12:07:08 +0300, Tuomas Vesterinen wrote: I am testing an application GUI with Python 2.4, 2.5 and 2.6. The native Python (in Fedora 12) is 2.6. Versions 2.4 and 2.5 are alt-installed. Aplication GUI uses: import pygtk pygtk.require('2.

Qt and progressBar - how to update

2010-05-16 Thread OMS
I am quite new to Python and Qt and need very urgently advice on how to update Qt progressBar while executing a process. I have went thrugh number of 'google' stuff and saw different solution, hence none worked for me. The best idea I have seen is the usage of QThread and emiting signal from thread

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 4:00 AM, Krister Svanlund wrote: > On Sun, May 16, 2010 at 7:50 PM, AON LAZIO wrote: >>    How can I set up global variables for the entire python applications? >> Like I can call and set this variables in any .py files. >>    Think of it as a global variable in a single .

Re: joining files

2010-05-16 Thread Tuomas Vesterinen
On 05/16/2010 05:04 PM, Dave Angel wrote: (You forgot to include the python-list in your response. So it only went to me. Normally, you just do reply-all to the message) mannu jha wrote: On Sun, 16 May 2010 13:52:31 +0530 wrote mannu jha wrote: Hi, I have few files like this: file1: 22

Re: Updating values in a dictionary

2010-05-16 Thread Peter Otten
Chris Rebert wrote: > Nested comprehensions may be hard to understand, so you may wish to > write it using a function instead: > > def make_row(): > return dict([(x,0) for x in range(3)]) > > matrix = dict([(x,make_row()) for x in range(-3,4,1)]) Another way to skin the cat: >>> row = dict.fro

Re: Global variables for python applications

2010-05-16 Thread Chris Rebert
On Sun, May 16, 2010 at 10:50 AM, AON LAZIO wrote: > Hi, >    How can I set up global variables for the entire python applications? > Like I can call and set this variables in any .py files. >    Think of it as a global variable in a single .py file but this is for the > entire application. Thank

Re: Global variables for python applications

2010-05-16 Thread Krister Svanlund
On Sun, May 16, 2010 at 7:50 PM, AON LAZIO wrote: > Hi, >    How can I set up global variables for the entire python applications? > Like I can call and set this variables in any .py files. >    Think of it as a global variable in a single .py file but this is for the > entire application. >    Th

Re: recursively remove all the directories and files which begin with '.'

2010-05-16 Thread Irmen de Jong
On 16-5-2010 19:41, Sean DiZazzo wrote: On May 14, 8:27 am, albert kao wrote: On May 14, 11:01 am, J wrote: On Fri, May 14, 2010 at 10:53, albert kao wrote: C:\python>rmdir.py C:\test\com.comp.hw.prod.proj.war\bin ['.svn', 'com'] d .svn dotd C:\test\com.comp.hw.prod.proj.war\bin\.svn T

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 3:50 AM, AON LAZIO wrote: > Hi, >    How can I set up global variables for the entire python applications? > Like I can call and set this variables in any .py files. >    Think of it as a global variable in a single .py file but this is for the > entire application. If you

Re: Updating values in a dictionary

2010-05-16 Thread superpollo
Thomas ha scritto: Greetings I am having a darn awful time trying to update a matrix: row = dict([(x,0) for x in range(3)]) matrix = dict([(x,row) for x in range(-3,4,1)]) matrix[2][1] += 1 matrix[-1][2] += 1 """ Got: a 1 in all col 1 and 2 {-3: {0: 0, 1: 1, 2: 1}, -2: {0: 0, 1: 1, 2: 1}, -

Global variables for python applications

2010-05-16 Thread AON LAZIO
Hi, How can I set up global variables for the entire python applications? Like I can call and set this variables in any .py files. Think of it as a global variable in a single .py file but this is for the entire application. Thanks -- Aonlazio 'Peace is always the way.' NW -- http://mai

Re: Updating values in a dictionary

2010-05-16 Thread Chris Rebert
On Sun, May 16, 2010 at 10:36 AM, Thomas wrote: > Greetings > > I am having a darn awful time trying to update a matrix: > > row = dict([(x,0) for x in range(3)]) > matrix = dict([(x,row) for x in range(-3,4,1)]) All the columns refer to the very same row dict (`row` obviously). Python doesn't do

Re: recursively remove all the directories and files which begin with '.'

2010-05-16 Thread Sean DiZazzo
On May 14, 8:27 am, albert kao wrote: > On May 14, 11:01 am, J wrote: > > > > > On Fri, May 14, 2010 at 10:53, albert kao wrote: > > > > C:\python>rmdir.py > > > C:\test\com.comp.hw.prod.proj.war\bin > > > ['.svn', 'com'] > > > d .svn > > > dotd C:\test\com.comp.hw.prod.proj.war\bin\.svn > > > T

Updating values in a dictionary

2010-05-16 Thread Thomas
Greetings I am having a darn awful time trying to update a matrix: row = dict([(x,0) for x in range(3)]) matrix = dict([(x,row) for x in range(-3,4,1)]) matrix[2][1] += 1 matrix[-1][2] += 1 """ Got: a 1 in all col 1 and 2 {-3: {0: 0, 1: 1, 2: 1}, -2: {0: 0, 1: 1, 2: 1}, -1: {0: 0, 1: 1, 2: 1}

Object-oriented (was: Is Python a functional programming language?)

2010-05-16 Thread Teemu Likonen
* 2010-05-15 09:42 (-0700), travis wrote: > PS: Why do people call LISP object-oriented? Are they smoking crack? > No classes, no methods, no member variables... WTF? Maybe because Common Lisp has a strong support for object-oriented programming. Peter Seibel: Practical Common Lisp Ge

Re: Access to comp.lang.python

2010-05-16 Thread Jim Byrnes
Grant Edwards wrote: On 2010-05-16, cjw wrote: On 16-May-10 01:31 AM, James Mills wrote: On Sun, May 16, 2010 at 3:12 PM, Aahz wrote: It's also at least partly due to problems with mail<->news gateways and the differing fields used to maintain threading. Some blame goes on MUAs too :) T

Re: Access to comp.lang.python

2010-05-16 Thread John Bokma
cjw writes: > Is it possible to connect a newsreader to gmane? http://johnbokma.com/mexit/2005/01/14/gmane-mail-to-news.html > Is Thunderbird known to have problems? It worked good for me, but that was 5+ years ago. (Time flies) -- John Bokma

Re: Reading XML namespaces

2010-05-16 Thread Stefan Behnel
Martin v. Loewis, 16.05.2010 11:05: Maybe true technically, but false in practice. If I receive XML data from source XYZ or service XYZ the use of namespaces and their prefixes is extremely consistent [in practice] and very customary (for example: I've never seen the DSML namespace abbreviated a

Re: Access to comp.lang.python

2010-05-16 Thread Grant Edwards
On 2010-05-16, cjw wrote: > On 16-May-10 01:31 AM, James Mills wrote: >> On Sun, May 16, 2010 at 3:12 PM, Aahz wrote: >>> It's also at least partly due to problems with mail<->news gateways and >>> the differing fields used to maintain threading. >> >> Some blame goes on MUAs too :) > > Thanks fo

Re: Access to comp.lang.python

2010-05-16 Thread cjw
On 16-May-10 01:31 AM, James Mills wrote: On Sun, May 16, 2010 at 3:12 PM, Aahz wrote: It's also at least partly due to problems with mail<->news gateways and the differing fields used to maintain threading. Some blame goes on MUAs too :) Thanks for the responses. Is it possible to connect

Re: joining files

2010-05-16 Thread Aahz
In article , Chris Rebert wrote: > >-- > That's not funny. I'm sure I'd have little difficulty finding poor programmers of whatever demographic groups you belong to. Or perhaps you haven't noticed that PEBKACs are everywhere? -- Aahz (a...@pythoncraft.com) <*> http://www.pyt

Re: Picking a license

2010-05-16 Thread Ed Keith
--- On Sat, 5/15/10, Lawrence D'Oliveiro wrote: > From: Lawrence D'Oliveiro > Subject: Re: Picking a license > To: python-list@python.org > Date: Saturday, May 15, 2010, 11:06 PM > In message , > Ed Keith > wrote: > > > On Fri, 5/14/10, Lawrence D'Oliveiro > > > wrote: > > > >> In message ,

Re: joining files

2010-05-16 Thread Dave Angel
(You forgot to include the python-list in your response. So it only went to me. Normally, you just do reply-all to the message) mannu jha wrote: On Sun, 16 May 2010 13:52:31 +0530 wrote mannu jha wrote: Hi, I have few files like this: file1: 22 110.1 33 331.5 2

Re: Picking a license

2010-05-16 Thread Ed Keith
--- On Sat, 5/15/10, Robert Kern wrote: > From: Robert Kern > Subject: Re: Picking a license > To: python-list@python.org > Date: Saturday, May 15, 2010, 1:10 PM > On 2010-05-14 21:37 , Steven D'Aprano > wrote: > > On Fri, 14 May 2010 06:42:31 -0700, Ed Keith wrote: > > > >> I am not a lawyer,

Fw: Re: Re: joining files

2010-05-16 Thread mannu jha
Note: Forwarded message attached -- Original Message -- From: "mannu jha"mannu_0...@rediffmail.com To: da...@ieee.org Subject: Re: Re: joining files--- Begin Message --- On Sun, 16 May 2010 13:52:31 +0530 wrote >mannu jha wrote: > Hi, > > I have few files like this: > file1: > 22 110.1 > 3

Re: Using site-packages with alt-installed Python version

2010-05-16 Thread Alister
On Sun, 16 May 2010 12:07:08 +0300, Tuomas Vesterinen wrote: > I am testing an application GUI with Python 2.4, 2.5 and 2.6. The native > Python (in Fedora 12) is 2.6. Versions 2.4 and 2.5 are alt-installed. > > Aplication GUI uses: > import pygtk > pygtk.require('2.0') > import gtk > import gobj

Re: huh??? weird problem

2010-05-16 Thread Paul Hankin
On May 15, 3:41 am, Dave Angel wrote: > cerr wrote: > > Hi There, > > > I got following code: > > start=time.time() > > print 'warnTimeout '+str(WarnTimeout) > > print 'critTimeout '+str(CritTimeout) > > print 'start',str(start) > > while wait: > >     passed =  time.time()-start > >     print 'pa

Using site-packages with alt-installed Python version

2010-05-16 Thread Tuomas Vesterinen
I am testing an application GUI with Python 2.4, 2.5 and 2.6. The native Python (in Fedora 12) is 2.6. Versions 2.4 and 2.5 are alt-installed. Aplication GUI uses: import pygtk pygtk.require('2.0') import gtk import gobject I go to: $ cd /usr/local/lib/python2.4/site-packages and say: $ sudo l

Re: Reading XML namespaces

2010-05-16 Thread Martin v. Loewis
> Maybe true technically, but false in practice. If I receive XML data > from source XYZ or service XYZ the use of namespaces and their prefixes > is extremely consistent [in practice] and very customary (for example: > I've never seen the DSML namespace abbreviated as anything other than > "dsml"

Re: Setup global variables settings for the entire applications

2010-05-16 Thread Chris Rebert
On Fri, May 14, 2010 at 7:32 AM, AON LAZIO wrote: > Hi, >    Say I have an application which requires a global settings for the user. > When the user finishes setting those global variables for the app. Any class > can use that variables (which are the same for all), something like that. > What is

Re: joining files

2010-05-16 Thread Dave Angel
mannu jha wrote: Hi, I have few files like this: file1: 22 110.1 33 331.5 22.7 5 271.9 17.2 33.4 4 55.1 file1 has total 4 column but some of them are missing in few row. file2: 5 H 22 0 file3: 4 T 5 B 22 C 121 S in all these files first column is the main source of matching their entrie

Re: joining files

2010-05-16 Thread Chris Rebert
On Sun, May 16, 2010 at 12:02 AM, mannu jha wrote: > Hi, > > I have few files like this: > file1: > 22 110.1 > 33 331.5 22.7 > 5 271.9 17.2 33.4 > 4 55.1 > > file1 has total 4 column but some of them are missing in few row. > > file2: > 5 H > 22 0 > > file3: > 4 T > 5 B > 22 C > 121 S > > in all t

Re: parsing XML

2010-05-16 Thread Stefan Behnel
Jake b, 16.05.2010 09:40: Check out Amara: http://www.xml3k.org/Amara/QuickRef It looks promising. For a pythonic solution over sax / dom. >>> Iter(doc.team.player) # or >>> doc.team.player[0].name Ah, right, and there's also lxml.objectify: from lxml.objectify import parse root = p

[ANN] Oktest 0.3.0 released - a new style testing library

2010-05-16 Thread kwatch
Hi, I released Oktest 0.3.0. http://packages.python.org/Oktest/ http://pypi.python.org/pypi/Oktest/ Overview Oktest is a new-style testing library for Python. :: from oktest import ok ok (x) > 0 # same as assert_(x > 0) ok (s) == 'foo'# same as

Re: joining files

2010-05-16 Thread James Mills
On Sun, May 16, 2010 at 5:02 PM, mannu jha wrote: > Hi, > > I have few files like this: > file1: > 22 110.1 > 33 331.5 22.7 > 5 271.9 17.2 33.4 > 4 55.1 > > file1 has total 4 column but some of them are missing in few row. > > file2: > 5 H > 22 0 > > file3: > 4 T > 5 B > 22 C > 121 S > > in all th

Re: parsing XML

2010-05-16 Thread Jake b
Check out Amara: http://www.xml3k.org/Amara/QuickRef It looks promising. For a pythonic solution over sax / dom. >>> Iter(doc.team.player) # or >>> doc.team.player[0].name [ new to the list, so I'm not sure why my previous response failed. Is it on me? Because using iPod, vs thunderbird? Howeve

Re: Reading XML namespaces

2010-05-16 Thread Stefan Behnel
Martin v. Loewis, 16.05.2010 09:07: the approach that the OP is apparently trying to follow is clearly misguided. I completely agree. However, I recommend that we let him find out on his own. I suspect he has some idiomatic usage of XML, perhaps with all namespace prefixes defined in the root

Re: Reading XML namespaces

2010-05-16 Thread Martin v. Loewis
> Well, there's an "nsmap" property on each Element that provides the > mapping of prefixes to namespace URIs that form the scope of the > Element. However, while this is what the OP asked for, it is not what > the OP wants, simply because it doesn't solve the problem. Well, it solves the problem

joining files

2010-05-16 Thread mannu jha
Hi, I have few files like this: file1: 22 110.1 33 331.5 22.7 5 271.9 17.2 33.4 4 55.1 file1 has total 4 column but some of them are missing in few row. file2: 5 H 22 0 file3: 4 T 5 B 22 C 121 S in all these files first column is the main source of matching their entries. So What I want i

Re: Reading XML namespaces

2010-05-16 Thread Stefan Behnel
Adam Tauno Williams, 15.05.2010 23:04: On Sat, 2010-05-15 at 22:58 +0200, Stefan Behnel wrote: Adam Tauno Williams, 15.05.2010 22:40: On Sat, 2010-05-15 at 22:29 +0200, Stefan Behnel wrote: Adam Tauno Williams, 15.05.2010 20:37: Say I have an XML document that begins with: http://www.dsml.or

Re: Reading XML namespaces

2010-05-16 Thread Stefan Behnel
Adam Tauno Williams, 16.05.2010 06:00: Given that XML documents can be very large I'd rather avoid a parsing of the document [beyond what lxml/etree] has already done] just to retrieve the namespaces and their prefixes. In order to find out which prefixes are used in the document and which set