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

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: 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: 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: 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: 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: 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"

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: 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

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: 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: 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: 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: 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
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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: 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

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: 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

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 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 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
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 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: 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 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: 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

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: 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

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: 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: 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: 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: 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: Python web publishing framework like Cocoon?

2005-12-08 Thread Paul Boddie
Dan M wrote: > Dennis Benzinger wrote: > > Is there a Python web publishing framework like Cocoon? > > How about: [List of the usual suspects] > just to name a few of my favorites. Take a look at > http://wiki.python.org/moin/WebProgramming for a more complete list. Although it is good advice to

Dr. Dobb's Python-URL! - weekly Python news and links (Dec 7)

2005-12-08 Thread Cameron Laird
QOTW: "... and to my utter surprise it worked." - Andrew Nagel on his move from wxPython to programming Tkinter in desperation "Python has more web application frameworks than keywords." - Skip Montanaro (but probably others going back years) Frithiof Andreas Jensen writes frankly on use o

Re: spawnle & umask

2005-12-08 Thread Yves Glodt
David Wahler wrote: > 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

Re: newbie Q on sdtin word completion

2005-12-08 Thread Fischer
Thanks, exactly what I was looking for. I should go and buy you book ;-) Bernd Fredrik Lundh wrote: > "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

Re: How do you create a custom QCursor in Python Qt?

2005-12-08 Thread Steegg
Thanks Phil, Good idea, I had failed to notice these code examples and been struggling the "qt3" examples from pyqtsrc.tgz for months. So, I found my mistake, I was using a 8*8 bitmap, I have now corrected it and use a 16*16 bitmap (which is the standard size on Mac OS X) read in from a "PNG" fil

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

2005-12-08 Thread Peter Hansen
Fredrik Lundh wrote: > on the other hand, for maximum portability, you can use > > f, e = os.path.splitext(filename) > if e.startswith(os.extsep): > e = e[len(os.extsep):] > if e == "txt": > ... Is there ever a time when the original `e` could evaluate True, yet not s

Re: Encoding of file names

2005-12-08 Thread Peter Hansen
utabintarbo wrote: > 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 >

Re: efficient 'tail' implementation

2005-12-08 Thread Nick Craig-Wood
Gerald Klix <[EMAIL PROTECTED]> wrote: > 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. Excellent idea. It'll blow up for large >2GB files on a 32bit OS though. -- Nick C

Re: Documentation suggestions

2005-12-08 Thread A.M. Kuchling
On Wed, 07 Dec 2005 12:10:18 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > OK I'll bite. That Beginners Guide page has bugged me for a long time. > It's a wiki page but it is marked as immutable so I can't change it. > Here are some immediate suggestions: Good suggestions; thanks! I

Is there anything that pickle + copy_reg cannot serialize?

2005-12-08 Thread Maurice LING
Hi, I need to look into serialization for python objects, including codes, recursive types etc etc. Currently, I have no idea exactly what needs to be serialized, so my scope is to be as wide as possible. I understand that marshal is extended by pickle to serialize class instances, shared elem

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

2005-12-08 Thread Dave Hansen
On 8 Dec 2005 08:17:14 GMT in comp.lang.python, Antoon Pardon <[EMAIL PROTECTED]> wrote: [...] >I just think braces are the worst solution for it, as python is >concerned. Agreed. A model like Modula-2's would be much preferable, and in fact is supported (but not enforced) today (as long as you

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Jeremy Hylton
> I still hope that the standard distribution will, in a not too distant future, > bundle more external libraries. as things are today, "including something > in the core" means that you have to transfer code and rights to the PSF. Your description of how to include something in the core isn't en

Re: Mutability of function arguments?

2005-12-08 Thread Mike Meyer
Kent Johnson <[EMAIL PROTECTED]> writes: > 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

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

2005-12-08 Thread Lad
Thank you ALL for help Regards, L. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bitching about the documentation...

2005-12-08 Thread Rocco Moretti
Fredrik Lundh wrote: > Rocco Moretti wrote: > > >>Insert punctuation & capitalization to make the following a correct and >>coherent (if not a little tourtured). >> >>fred where guido had had had had had had had had had had had a better >>effect on the reader > > > punctuation, including quote

Re: Encoding of file names

2005-12-08 Thread Peter Otten
utabintarbo wrote: > 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

Re: efficient 'tail' implementation

2005-12-08 Thread Nick Craig-Wood
Gerald Klix <[EMAIL PROTECTED]> wrote: > 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. Actually mmap doesn't appear to have an rfind method :-( Here is a tested solution

Post-modernism, Academia, and the Tech Geeking fuckheads

2005-12-08 Thread Xah Lee
Post-modernism, Academia, and the Tech Geeking fuckheads • the Sokal Affair http://en.wikipedia.org/wiki/Sokal_Affair • SCIGen and World Multi-Conference on Systemics, Cybernetics and Informatics   http://pdos.csail.mit.edu/scigen/ • What are OOP's Jargons and Complexities, Xah Lee http://xahl

Re: Encoding of file names

2005-12-08 Thread Kent Johnson
utabintarbo wrote: > 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 d

Re: JPEG decoder not available in PIL

2005-12-08 Thread Paul Dickson
On 6 Dec 2005 14:02:37 -0800, Peter wrote: > I have a problem which seems to come up from time to time but I can't > find anything relevant in the archives. I have used PIL v1.1.5 with no > problem on Windows for some time but now wish to put it on Linux (Suse > Linux v10.0). I obtained and built

Re: Documentation suggestions

2005-12-08 Thread A.M. Kuchling
On Wed, 07 Dec 2005 12:58:36 -0800, Michael Spencer <[EMAIL PROTECTED]> wrote: > I experimented with some more re-organization, but I don't see away > to attach the resulting file in the SF comments, so I'll post it > here instead. I've attached your file to the patch. Some comments: >

Re: Bitching about the documentation...

2005-12-08 Thread Dave Hansen
On Wed, 07 Dec 2005 12:33:07 -0600 in comp.lang.python, Rocco Moretti <[EMAIL PROTECTED]> wrote: [...] >fred where guido had had had had had had had had had had had a better >effect on the reader I've seen this before as bill had had had but will had had had had had had or had had been correct

Re: Documentation suggestions

2005-12-08 Thread BartlebyScrivener
Andrew, The site changes for the new-to-Python person are a big improvement in terms of the sequence of exposures, but from a marketing perspective, the first thing they read about Python is still aimed at a programmer. The bulleted points in BeginnersGuide/Overview are, again, things that are imp

Re: Documentation suggestions

2005-12-08 Thread Kent Johnson
A.M. Kuchling wrote: > On Wed, 07 Dec 2005 12:10:18 -0500, > Kent Johnson <[EMAIL PROTECTED]> wrote: > >>OK I'll bite. That Beginners Guide page has bugged me for a long time. >>It's a wiki page but it is marked as immutable so I can't change it. >>Here are some immediate suggestions: >

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

2005-12-08 Thread gene tani
Lad wrote: > Thank you ALL for help > Regards, > L. addendum: ASPN Python cookbook often has something relevant / modifiable for your needs: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81931 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52661 (in this case code from 2001 /

Re: Is there anything that pickle + copy_reg cannot serialize?

2005-12-08 Thread Jean-Paul Calderone
On Thu, 08 Dec 2005 22:42:32 +0800, Maurice LING <[EMAIL PROTECTED]> wrote: >Hi, > >I need to look into serialization for python objects, including codes, >recursive types etc etc. Currently, I have no idea exactly what needs to >be serialized, so my scope is to be as wide as possible. > >I underst

Re: Documentation suggestions

2005-12-08 Thread A.M. Kuchling
On Wed, 07 Dec 2005 10:36:52 -0600, A.M. Kuchling <[EMAIL PROTECTED]> wrote: > of the seealso environment. I'll talk to Fred about it and begin > assembling a patch. Patch #1376361: http://www.python.org/sf/1376361 . I still need to talk to Fred about this. --amk -- http://mail.python

Re: Encoding of file names

2005-12-08 Thread Fredrik Lundh
"utabintarbo" wrote: > 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

Re: Mutability of function arguments?

2005-12-08 Thread Fredrik Lundh
Mike Meyer wrote: > Your description of "passes references by value" is a description of > call by reference. C passes all arguments by value, to pass a > reference, the C programmer creates the reference to the value "by > hand", then dereferences it by hand at the other end. So C's > "call-by-re

Re: how to put form and display its result(data from database) on the same window?

2005-12-08 Thread lli
Hi Peter, Could you give me detailed information about your idea. Thanks, Laya -- http://mail.python.org/mailman/listinfo/python-list

Re: Documentation suggestions

2005-12-08 Thread Fredrik Lundh
A.M. Kuchling wrote: > > of the seealso environment. I'll talk to Fred about it and begin > > assembling a patch. > > Patch #1376361: http://www.python.org/sf/1376361 . I still need to talk > to Fred about this. cool. can you post a sample page somewhere? -- http://mail.python.org/mailma

Re: Documentation suggestions

2005-12-08 Thread skip
amk> I wonder if the Internet chapter should be split into "HTTP/Web amk> Tools" (webbrowser, cgi, cgitb, httplib, urllib) and "Non-Web amk> Protocols" (ftplib, gopherlib, smtp, all the rest). Note that cgitb works just fine in a non-web environment. I would actually prefer it be ren

Re: spawnle & umask

2005-12-08 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Yves Glodt <[EMAIL PROTECTED]> wrote: > David Wahler wrote: > > 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',executabl > >> e) > >> > >> But I wanted t

Re: Encoding of file names

2005-12-08 Thread utabintarbo
Fredrik, you are a God! Thank You^3. I am unworthy I believe that may do the trick. Here is the results of running your code: >>> DIR = os.getcwd() >>> files = os.listdir(DIR) >>> file = files[-1] >>> file 'L07JS41C.04389525AA.QTR\xa6INR.E\xa6C-P.D11.081305.P2.KPF.model' >>> print file L07JS41C.

Re: Bitching about the documentation...

2005-12-08 Thread Sion Arrowsmith
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>> "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo." > >S >P >O >I >L >E >R > >S >P >A >C >E > (Good grief, I've not done that in *years*.) >Buffalo from the city of Buffalo, which are intimidated by buffalo >from Buffalo, also inti

Re: Bitching about the documentation...

2005-12-08 Thread Neil Schemenauer
François Pinard <[EMAIL PROTECTED]> wrote: >[AMK] >> You may suggest that I should process my e-mail more promptly. > > No, I'm not suggesting you how to work, no more that I would accept that > you force me into working your way. If any of us wants to force the > other to speak through robots,

Re: Is there anything that pickle + copy_reg cannot serialize?

2005-12-08 Thread Maurice LING
> Since copy_reg lets you specify arbitrary code to serialize arbitrary > objects, you shouldn't run into any single object that you cannot > serialize to a pickle. In http://www.effbot.org/librarybook/pickle.htm, it specifically mentions that code objects cannot be pickled and require the use

newby question: Splitting a string - separator

2005-12-08 Thread Thomas Liesner
Hi all, i am having a textfile which contains a single string with names. I want to split this string into its records an put them into a list. In "normal" cases i would do something like: > #!/usr/bin/python > inp = open("file") > data = inp.read() > names = data.split() > inp.close() The probl

Re: efficient 'tail' implementation

2005-12-08 Thread Neal Becker
[EMAIL PROTECTED] wrote: > 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 ev

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > I think the key here is ElementTree's Pythoninc API. While it's clearly > possible to install it as a third-party package, I think there's a clear > best-of-breed aspect here that suggests it belongs in the standard > distribution simply to discourage continued use of DO

Re: How to ping in Python?

2005-12-08 Thread Chris Miles
You could also try the ping module that the Eddie monitoring tool has been using successfully, cross-platform, for many years. http://dev.eddie-tool.net/trac/browser/eddie/trunk/lib/common/Directives/pinger.py Cheers, Chris Nico Grubert wrote: > I could not find any "ping" Class or Handler in p

Images & Connected Component labeling

2005-12-08 Thread Jim
Does anyone know where I can find a 'connected component' image processing function? I don't see it in numarray or scipy core... In matlab the function is called bwlabel(bw,4); and step 8 on this page is an example of what I'm trying to do: http://www.mathworks.com/access/helpdesk_r13/help/tool

Re: sql escaping module

2005-12-08 Thread David Bear
Fredrik Lundh wrote: > 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 injectio

Re: Is there anything that pickle + copy_reg cannot serialize?

2005-12-08 Thread Jean-Paul Calderone
On Fri, 09 Dec 2005 02:17:10 +0800, Maurice LING <[EMAIL PROTECTED]> wrote: > >> Since copy_reg lets you specify arbitrary code to serialize arbitrary >> objects, you shouldn't run into any single object that you cannot >> serialize to a pickle. > > [snip - example of pickling code objects] > > >I

Re: newby question: Splitting a string - separator

2005-12-08 Thread Michael Spencer
Thomas Liesner wrote: > Hi all, > > i am having a textfile which contains a single string with names. > I want to split this string into its records an put them into a list. > In "normal" cases i would do something like: > >> #!/usr/bin/python >> inp = open("file") >> data = inp.read() >> names =

Re: newby question: Splitting a string - separator

2005-12-08 Thread Noah
Thomas Liesner wrote: > ... > The only thing i can rely on, ist that the > recordseparator is always more than a single whitespace. > > I thought of something like defining the separator for split() by using > a regex for "more than one whitespace". RegEx for whitespace is \s, but > what would i

Re: newby question: Splitting a string - separator

2005-12-08 Thread Jim
Hi Tom, > a regex for "more than one whitespace". RegEx for whitespace is \s, but > what would i use for "more than one"? \s+? For more than one, I'd use \s\s+ -Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest and non-.py files

2005-12-08 Thread Michael Hoffman
[Michael Hoffman] >>Hi. I am trying to use unittest to run a test suite on some >>scripts that do not have a .py extension. [Sybren Stuvel] > I'd move the functionality of the script into a separate file that > does end in .py, and only put the invocation into the .py-less > script. That's what I

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

2005-12-08 Thread Scott David Daniels
Steve Holden wrote: > Paul Rubin wrote: >> I think it's a Python weakness that you can't declare a local var like >> in other languages, to go out of scope at the end of the current block, e.g.: >> >> if cond: >> my x = 7# make a new scope for x, goes out of scope at end of if >>

Re: how to put form and display its result(data from database) on the same window?

2005-12-08 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Could you give me detailed information about your idea. I believe I just did. Really, as I said, this is "non-trivial". I can't give you a three minute tutorial that will help you at all, especially if you haven't read the information I pointed you to. (The page I p

Re: Post-modernism, Academia, and the Tech Geeking fuckheads

2005-12-08 Thread bradb
I don't know about anyone else, but you'd impress me much more if you didn't swear in your posts. I am personally not offended, but it does lower your credibility in my eyes. Just a tip. Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Bitching about the documentation...

2005-12-08 Thread BartlebyScrivener
The actress Margaret Anglin left this note in the dressing froom of another actress: 'Margaret Anglin says Mrs. Fiske is the best actress in America.' Mrs. Fiske added two commas and returned the note: 'Margaret Anglin, says Mrs. Fiske, is the best actress in America.' Or this, from a George Wil

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

2005-12-08 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > > if cond: > > my x = 7# make a new scope for x, goes out of scope at end of if > > > If this genuinely troubles you then you can always isolate the scope > with a function, though of course you also no longer have the code > inline then. > >>I d

Re: Unexpected behavior of read only attributes and super

2005-12-08 Thread Samuel M. Smith
> > > P.S. Note that there is an additional complication resulting from the > fact that functions are descriptors: > class C(dict): > ... pass > ... C.__iter__ > C().__iter__ > > > Even though the C instance is accessing the __iter__ function on the > class, it gets back a diff

Dynamically add Class to Modules

2005-12-08 Thread callmebill
I'm trying to add a class to a module at runtime. I've seen examples of adding a method to a class, but I haven't been able to suit it to my needs. As part of a testsuite, I have a main process X that searches recursively for python test files. Those files typically have a global "isSupported" m

Re: Another newbie question

2005-12-08 Thread Steven D'Aprano
On Wed, 07 Dec 2005 23:58:02 -0500, Mike Meyer wrote: > "solaris_1234" <[EMAIL PROTECTED]> writes: > >> 1) The stmt "board.Blist[10].DrawQueen(board.Blist[10].b1)" seems >> awkward. Is there another way (cleaner, more intuitive) to get the >> same thing done? > > Yes. Reaching through objects t

Re: sql escaping module - Frank Millman Followup

2005-12-08 Thread David Bear
>Steve Holden wrote: > 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, >>>an

  1   2   >