Re: ElementTree - Why not part of the core?

2005-12-08 Thread skip
>> ElementTree on the other hand provides incredibly easy access to XML >> elements and works in a more Pythonic way. Why has the API not been >> included in the Python core? I think the key here is ElementTree's Pythoninc API. While it's clearly possible to install it as a third-pa

Re: ElementTree - Why not part of the core?

2005-12-08 Thread skip
>> ElementTree on the other hand provides incredibly easy access to XML >> elements and works in a more Pythonic way. Why has the API not been >> included in the Python core? Magnus> I'd really like to see that too. Sure, it's fairly trivial to Magnus> install it, but each di

Re: Documentation suggestions

2005-12-08 Thread A.M. Kuchling
On 7 Dec 2005 05:51:45 -0800, Iain King <[EMAIL PROTECTED]> wrote: > Argh, you made me look at the html again - at least now I know *why* it > is so disgusting. I understand there's a new version coming out soon, > hopefully in html 4 strict or xhtml. I'm sure at that point it'll be > ea

Re: efficient 'tail' implementation

2005-12-08 Thread Jerry Sievers
[EMAIL PROTECTED] writes: > hi > > I have a file which is very large eg over 200Mb , and i am going to > use python to code a "tail" command to get the last few lines of the > file. What is a good algorithm for this type of task in python for > very big files? Initially, i thought of reading eve

Re: Python and OLAP?

2005-12-08 Thread Mike Thompson
Wolfgang Keller wrote: > Hello, > > does anyone know of Python modules for OLAP work? E.g. efficient > manipulation of large multi-dimensional structures (arrays) of arbitrary > (not only numeric) data? > > TIA, > > Sincerely, > > Wolfgang Keller > > Perhaps this might be useful: ht

Re: spawnle & umask

2005-12-08 Thread David Wahler
Yves Glodt wrote: > It does, I did like this: > > os.umask(0113) > newpid = > os.spawnl(os.P_NOWAIT,'/usr/local/bin/wine','/usr/local/bin/wine',executable) > > But I wanted to use spawnle and it's env argument, to avoid setting > umask manually... The umask is not part of the environment, so there

Encoding of file names

2005-12-08 Thread utabintarbo
Here is my situation: I am trying to programatically access files created on an IBM AIX system, stored on a Sun OS 5.8 fileserver, through a samba-mapped drive on a Win32 system. Not confused? OK, let's move on... ;-) When I ask for an os.listdir() of a relevant directory, I get filenames with em

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Magnus Lycka
Fredrik Lundh wrote: > but seriously, given how easy it is to build things with distutils, I don't > think your > configuration folks would have much trouble adding support for "anything that > has > a setup file, and is reasonably self-contained" to their build scripts. True. It's one more thin

Re: How to get the extension of a filename from the path

2005-12-08 Thread gene tani
Lad wrote: > Hello, > what is a way to get the the extension of a filename from the path? > E.g., on my XP windows the path can be > C:\Pictures\MyDocs\test.txt > and I would like to get > the the extension of the filename, that is here > txt > > > I would like that to work on Linux also > Thank

Re: pyparsing with nested table

2005-12-08 Thread astarocean
Paul McGuire wrote: > > Load Forward's with '<<' instead of '='. Change: > tablePattern = getMultiLevelPattern('table',trPattern) > to: > tablePattern << getMultiLevelPattern('table',trPattern) > > I think that is all you needed. > > Awesome job! (Also check out the pyparsing built-ins for ma

Re: How to get the extension of a filename from the path

2005-12-08 Thread Fredrik Lundh
"Lad" <[EMAIL PROTECTED]> wrote: > what is a way to get the the extension of a filename from the path? > E.g., on my XP windows the path can be > C:\Pictures\MyDocs\test.txt > and I would like to get > the the extension of the filename, that is here > txt > > I would like that to work on Linux a

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Giovanni Bajo
Giovanni Bajo wrote: > One thing I really fear about the otherwise great EasyInstall (and > Python Eggs) is that we could forget about... ... how important is to have a standard library. The fact that it's easy to install external modules shouldn't make us drop the standard library. A standard li

Re: How to get the extension of a filename from the path

2005-12-08 Thread Tom Anderson
On Thu, 8 Dec 2005, Lad wrote: > what is a way to get the the extension of a filename from the path? > E.g., on my XP windows the path can be > C:\Pictures\MyDocs\test.txt > and I would like to get > the the extension of the filename, that is here > txt You want os.path.splitext: >>> import os

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: >> I think some people were hoping that instead of adding these things >> to >> the standard library, we would come up with a better package manager >> that would make adding these things to your local library much >> simpler. >> >> STeVe >> >> [1]http://www.python.org/dev

Re: How to get the extension of a filename from the path

2005-12-08 Thread Dale Strickland-Clark
Lad wrote: > Hello, > what is a way to get the the extension of a filename from the path? > E.g., on my XP windows the path can be > C:\Pictures\MyDocs\test.txt > and I would like to get > the the extension of the filename, that is here > txt > > > I would like that to work on Linux also > Tha

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Fuzzyman
Fredrik Lundh wrote: > Steven Bethard wrote: > > > > ElementTree on the other hand provides incredibly easy access to XML > > > elements and works in a more Pythonic way. Why has the API not been > > > included in the Python core? > > > > While I fully agree that ElementTree is far more Pythonic

How to get the extension of a filename from the path

2005-12-08 Thread Lad
Hello, what is a way to get the the extension of a filename from the path? E.g., on my XP windows the path can be C:\Pictures\MyDocs\test.txt and I would like to get the the extension of the filename, that is here txt I would like that to work on Linux also Thank you for help L. -- http://ma

Re: sql escaping module

2005-12-08 Thread Steve Holden
Fredrik Lundh wrote: > Frank Millman wrote: > > >>Each of the API's includes the capability of passing commands in the >>form of 'string + parameters' directly into the database. This means >>that the data values are never embedded into the SQL command at all, >>and therefore there is no possibil

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Fredrik Lundh
Magnus Lycka wrote: > We're deploying our software on a number of different platforms. We > certainly depend on Python, so a standard Python install will always > be included. Using standard library modules is for free. Using yet > another third party library has a cost, even if some Cheese Shop o

Re: spawnle & umask

2005-12-08 Thread Yves Glodt
Fredrik Lundh wrote: > Yves Glodt wrote: > >> I tried something like this but the umask part does not work clearly...: >> >> newpid = >> os.spawnle(os.P_NOWAIT,'/usr/bin/touch','/usr/bin/touch','xyz','umask 0113') >> >> What would be the correct syntax for setting the umask for the created >> proc

Re: spawnle & umask

2005-12-08 Thread Fredrik Lundh
Yves Glodt wrote: > I tried something like this but the umask part does not work clearly...: > > newpid = > os.spawnle(os.P_NOWAIT,'/usr/bin/touch','/usr/bin/touch','xyz','umask 0113') > > What would be the correct syntax for setting the umask for the created > process...? not sure, but something

Re: newbie Q on sdtin word completion

2005-12-08 Thread Fredrik Lundh
"Bernd" wrote: > I'm on a Linux env and try to get > word completion form sdtin done, > like Perl's > $stdin = Complete( "\t: ", @choices ); > > What I have so far shows me the directory listing > on the second hit on TAB and not the list of > choices on the first like I wanted to have. your com

Re: Mutability of function arguments?

2005-12-08 Thread Kent Johnson
Mike Meyer wrote: > "ex_ottoyuhr" <[EMAIL PROTECTED]> writes: > >>I'm trying to create a function that can take arguments, say, foo and >>bar, and modify the original copies of foo and bar as well as its local >>versions -- the equivalent of C++ funct(&foo, &bar). > > > C++'s '&' causes an argum

spawnle & umask

2005-12-08 Thread Yves Glodt
Hi, I tried something like this but the umask part does not work clearly...: newpid = os.spawnle(os.P_NOWAIT,'/usr/bin/touch','/usr/bin/touch','xyz','umask 0113') What would be the correct syntax for setting the umask for the created process...? Best regards, Yves -- http://mail.python.org/

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > ElementTree on the other hand provides incredibly easy access to XML > elements and works in a more Pythonic way. Why has the API not been > included in the Python core? I'd really like to see that too. Sure, it's fairly trivial to install it, but each different package

Re: Another newbie question

2005-12-08 Thread John Bushnell
I think that's supposed to be [(i + j) % 2] for the index to the ("green","red") tuple (since i*8 is always even). [EMAIL PROTECTED] wrote: > Mike, > > Thanks for your insight. It has been a big help. > > I guess I was trying to learn too much with my original code. Trying to > implement inheritan

Re: sql escaping module

2005-12-08 Thread Fredrik Lundh
Frank Millman wrote: > Each of the API's includes the capability of passing commands in the > form of 'string + parameters' directly into the database. This means > that the data values are never embedded into the SQL command at all, > and therefore there is no possibility of injection attacks. a

Re: first post: new to pythong. some questions.

2005-12-08 Thread Simon Brunning
On 12/8/05, shawn a <[EMAIL PROTECTED]> wrote: > Hello. Im brand new to this list and to python. Ive recently started > reading about it > and am now in the tinkering stage. Welcome to Python! > I have a script im working on that i > need some > asistance debugging. Its super small and shoul

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-08 Thread Steve Holden
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >>>All joking aside, when I have names (temporary variables or scaffolding >>>functions) that I need to initialise a module or data structure, but then >>>outlive their usefulness, I del the name afterwards. Am I the only one? I >>>can

Re: sql escaping module

2005-12-08 Thread Frank Millman
David Bear wrote: > Being new to pgdb, I'm finding there are lot of things I don't understand > when I read the PEP and the sparse documentation on pgdb. > > I was hoping there would be a module that would properly escape longer text > strings to prevent sql injection -- and other things just make

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-08 Thread Steve Holden
Steven D'Aprano wrote: > On Wed, 07 Dec 2005 10:59:09 +0100, Sybren Stuvel wrote: [...] > But then you have all these small functions lying around in your module. > If you intend to use them multiple times, then obviously you should > keep them. But if they are intended to be used once, and once on

Re: pyparsing with nested table

2005-12-08 Thread Paul McGuire
astarocean wrote: > using pyparsing to deal with nested tables , wanna keep table's > structure and propertys . > but program was chunked with the tag of inner table. > > have any ideas? > > here's the program > > > from pyparsing import * <... snip ...> > > tablePattern = Forward() <... sn

Re: Bitching about the documentation...

2005-12-08 Thread Steve Holden
Michael Spencer wrote: [...] > Allowing quotation, almost anything is possible, e.g., > > > Fred! Where Guido had had "had", Had had had "had had". "Had had" had a > better > effect on the reader > > or simply > > "fred", where Guido had "had had had had had had had had had", had a better >

Re: Mutability of function arguments?

2005-12-08 Thread bruno at modulix
ex_ottoyuhr wrote: > I'm trying to create a function that can take arguments, say, foo and > bar, and modify the original copies of foo and bar as well as its local > versions -- the equivalent of C++ funct(&foo, &bar). This is already what you have. In Python, all you have are references to objec

Re: Is Python string immutable?

2005-12-08 Thread Steve Holden
Frank Potter wrote: > Thank you very much. > Steve Holden, I post my soucecode at my blog here: > http://hiparrot.wordpress.com/2005/12/08/implementing-a-simple-net-spider/ > > I wish you can read and give me some suggest

pyparsing with nested table

2005-12-08 Thread astarocean
using pyparsing to deal with nested tables , wanna keep table's structure and propertys . but program was chunked with the tag of inner table. have any ideas? here's the program from pyparsing import * mytable = """ system art

Re: Documentation suggestions

2005-12-08 Thread Ben Sizer
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > I suspect I'd have a harder time living without the sys module than with > > many of the builtins. Then there's os, re, math, ... Some modules, like > > thread and sys, have to be linked into the interpreter. Are they "core" or > > "add on"

Re: python24.dll and encodings ?

2005-12-08 Thread Martin v. Löwis
Bugs wrote: > I believe I read in a relatively recent thread that the reason > python24.dll is so large compared to previous releases is that all the > language encodings are linked into the library? Not only that (but also). In addition, it also contains modules that were previously implemented

RE: hi i have some doubts on a volume and the file system

2005-12-08 Thread Tim Golden
[EMAIL PROTECTED] > i want to check the position of a volume in a particular > drive. say for example in a disk i have 3 different drives: > C:\ , D:\ and E:\. > Now if i want to check what position is the D:\ in, how > can i write the code. Means whether its in a 0th position > or 1st positi

Re: sql escaping module

2005-12-08 Thread Tim Roberts
David Bear <[EMAIL PROTECTED]> wrote: >Being new to pgdb, I'm finding there are lot of things I don't understand >when I read the PEP and the sparse documentation on pgdb. > >I was hoping there would be a module that would properly escape longer text >strings to prevent sql injection -- and other

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-08 Thread Antoon Pardon
Op 2005-12-07, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Wed, 07 Dec 2005 15:26:59 +, Zeljko Vrba wrote: > >> Braces are very convenient to match block start and end. Open a C program >> in the VI editor, and press % in command mode on some brace.. It will take >> you to its matching br

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-08 Thread Antoon Pardon
Op 2005-12-07, Zeljko Vrba schreef <[EMAIL PROTECTED]>: > On 2005-12-07, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> >> What I don't understand is, that most people who have a problem >> with scope by indentation, want to introduce braces. I think >> braces are the worst solution. >> > Braces are v

Re: efficient 'tail' implementation

2005-12-08 Thread Gerald Klix
As long as memory mapped files are available, the fastest method is to map the whole file into memory and use the mappings rfind method to search for an end of line. The following code snippets may be usefull: reportFile = open( filename ) length = os.fstat( reportFile.fileno() ).st_size

<    1   2