Re: what are the most frequently used functions?

2006-10-28 Thread Theerasak Photha
On 28 Oct 2006 22:55:29 -0700, Xah Lee <[EMAIL PROTECTED]> wrote: > Barry Margolin wrote: > « For Lisp, just look for symbols that are immediately preceded by ( > ...» > > Thanks a lot! great thought. An even cleaner way to do this would be to iterate over the list s-exprs in any given lisp source

Re: question about True values

2006-10-28 Thread Chetan
Georg Brandl <[EMAIL PROTECTED]> writes: > Chetan wrote: >>> Steven D'Aprano wrote: >>> > On Sat, 28 Oct 2006 03:13:42 +0100, Steve Holden wrote: >>> > >>> >>> Finally, while True/False is a good mental mapping for numeric >>> >>> comparisons, >>> >>> take the following: >>> >>> >>> >>> >>> if

Re: question about True values

2006-10-28 Thread Georg Brandl
Chetan wrote: >> Steven D'Aprano wrote: >> > On Sat, 28 Oct 2006 03:13:42 +0100, Steve Holden wrote: >> > >> >>> Finally, while True/False is a good mental mapping for numeric >> >>> comparisons, >> >>> take the following: >> >>> >> >>> >>> if "Cliff is a pillar of the open source community": >>

logo design

2006-10-28 Thread Xah Lee
recently on #emacs irc of freenode, there's a discussion of a logo of planet emacsen site. I made some comments about such logo: http://paste.lisp.org/display/28901 I have brought this topic here here before... that i think LISP really need to have a logo. I'm aware of “made with alien technolog

Re: question about True values

2006-10-28 Thread Chetan
Gabriel Genellina <[EMAIL PROTECTED]> writes: > At Friday 27/10/2006 23:13, Steve Holden wrote: > >>J. Clifford Dyer wrote: >> > the one thing that Ms. Creighton points out that I can't get past is >> > that Python, even with its bool type, *still* evaluates somethingness >> > and nothingness, and

Re: what are the most frequently used functions?

2006-10-28 Thread Xah Lee
Barry Margolin wrote: « For Lisp, just look for symbols that are immediately preceded by ( ...» Thanks a lot! great thought. I've done accordingly, which counts satisfactorily. http://xahlee.org/emacs/function-frequency.html Will take a break and think about Perl, Python, Java later... For Pyth

Re: Python crashed when importing SOAPpy, printing out 'usage:copy source destination'

2006-10-28 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > I still can't understand it. If i rename the 'copy.py' to 'a.py', > > there will be no problem. > > hint: when it works, try typing the following into the interpreter: > > >>> import copy > >>> copy.__file__ > > I know, the copy modu

random module

2006-10-28 Thread Moishy Gluck
HiI am using the random module to generate a session tracker. I use this code to generate a random number "random.random() * 1" The session is stored in a mysql database under the field session_id. The problem is when I try to submit the random number into my database I get this err

Re: What's the best IDE?

2006-10-28 Thread Theerasak Photha
On 10/27/06, Ramon Diaz-Uriarte <[EMAIL PROTECTED]> wrote: > Actually, I've read similar things before and I don't quite get it. I > guess all of us are Emacs begginers the first time we try emacs. > Actually, I started using Emacs about 1 month after installing Linux; > what hooked me was the pos

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] > BTW, there is a mailing list specifically for mod_python. You might be > better off asking questions directly there, as we have seen most > problems. You can also search the mailing list archives from the > mod_python site. > > BTW, the quadruple backslashes is ind

Re: Sending mouse events on Windows

2006-10-28 Thread Roger Upole
Radu Ciurlea wrote: > Hello, > I want to write a program that can generate mouse events. I'd like to > actually be able to control the pointer and generate clicks. Any > pointers on modules I could use for doing this? Any suggestions are > welcome. > tia > > Radu Take a look at win32api.mouse_eve

Re: Name bindings for inner functions.

2006-10-28 Thread James Stroud
Andrea Griffini wrote: > [EMAIL PROTECTED] wrote: > >> The following code: >> >> def functions(): >> l=list() >> for i in range(5): >> def inner(): >> return i >> l.append(inner) >> return l >> >> >> print [f() for f in functions()] >> >> >> returns [4,4,4,4

Re: Name bindings for inner functions.

2006-10-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > The following code: > > def functions(): > l=list() > for i in range(5): > def inner(): > return i > l.append(inner) > return l > > > print [f() for f in functions()] > > > returns [4,4,4,4,4], rather than the hoped for [0,1,2

Re: unescape HTML entities

2006-10-28 Thread Fredrik Lundh
Rares Vernica wrote: > How can I unescape HTML entities like " "? run it through an HTML parser. or use something like this: http://effbot.org/zone/re-sub.htm#strip-html (if you want to keep elements, change the regular expression in the re.sub call to "(?s)&#?\w+;") > I know about xml.

Re: Name bindings for inner functions.

2006-10-28 Thread trevor_morgan
Thanks, that's exactly what I needed. Andrea Griffini wrote: > [EMAIL PROTECTED] wrote: > > The following code: > > > > def functions(): > > l=list() > > for i in range(5): > > def inner(): > > return i > > l.append(inner) > > return l > > > > > > print [f()

Re: http call.

2006-10-28 Thread haiyun
Steve Holden 写道: > Kirt wrote: >> Hi! >> >> I have a php program (test.php) on a server. eg: >> http://abc.xyz.com/test.php >> >> I need my python scripts to make a http call to these program pass some >> data and get back a secret key from the php program.. >> >> Could anyone help me this, what wi

Re: Safely renaming a file without overwriting

2006-10-28 Thread Diez B. Roggisch
Wolfgang Draxinger schrieb: > Steven D'Aprano wrote: > >> But the source file always exists, otherwise there is nothing >> to rename! Do you mean, open the destination filename? > > Of course I meant the destination file. Someone please spill some > ice chilled water over me to get me awake again

Metaclasses are not called in subclasses. What did I wrong?

2006-10-28 Thread Létező
I use Python 2.4.4. Please read the code below: --- from new import classobj def mymeta(name,bases,clsdict): print 'meta: %s'%name return classobj(name,bases,clsdict) class A(object): __metaclass__=mymeta class B(A): pass

Re: question about True values

2006-10-28 Thread Chetan
> Steven D'Aprano wrote: > > On Sat, 28 Oct 2006 03:13:42 +0100, Steve Holden wrote: > > > >>> Finally, while True/False is a good mental mapping for numeric > >>> comparisons, > >>> take the following: > >>> > >>> >>> if "Cliff is a pillar of the open source community": > >>> print "t

Re: Safely renaming a file without overwriting

2006-10-28 Thread Wolfgang Draxinger
Steven D'Aprano wrote: > But the source file always exists, otherwise there is nothing > to rename! Do you mean, open the destination filename? Of course I meant the destination file. Someone please spill some ice chilled water over me to get me awake again. Time to go to bed :-P before I make mo

Metaclasses are not called in subclasses. What did I wrong?

2006-10-28 Thread Létező
I use Python 2.4.4. Please read the code below: --- from new import classobj def mymeta(name,bases,clsdict): print 'meta: %s'%name return classobj(name,bases,clsdict) class A(object): __metaclass__=mymeta class B(A): pass

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread grahamd
dan84 wrote: > I don't understand this error , in the (Apache) errorlog I read this > message : > > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import > mod_python.apache.\n > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being > used "['C:Python24python2

Re: What is the cleanest way to for a module to access objects from the script that imports it?

2006-10-28 Thread ggmailalias-cgag
robert ha escrito: > [EMAIL PROTECTED] wrote: > > Hi, > > > > I am new to python and am currently writing my first application. One > > of the problems I quickly ran into, however, is that python's imports > > are very different from php/C++ includes in the sense that they > > completely wrap the

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread skip
dan> I don't understand this error , in the (Apache) errorlog I read dan> this message : dan> [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import dan> mod_python.apache.\n dan> [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being dan> used

Re: Name bindings for inner functions.

2006-10-28 Thread Andrea Griffini
[EMAIL PROTECTED] wrote: > The following code: > > def functions(): > l=list() > for i in range(5): > def inner(): > return i > l.append(inner) > return l > > > print [f() for f in functions()] > > > returns [4,4,4,4,4], rather than the hoped for [0,1,2,

Re: Safely renaming a file without overwriting

2006-10-28 Thread Steven D'Aprano
On Sun, 29 Oct 2006 00:29:06 +0200, Wolfgang Draxinger wrote: > Steven D'Aprano wrote: > >> Open "the" file? There are potentially two files -- the source >> and destination. I only want to do the rename if the >> destination *doesn't* exist, so there is no destination file to >> open. How will i

Re: ANN compiler2 : Produce bytecode from Python 2.5 Abstract Syntax Trees

2006-10-28 Thread Martin v. Löwis
sébastien martini schrieb: > I don't know if it can hide some bugs or if the module has just never > been updated to support this bytecode but LIST_APPEND is never emitted. > In the module compiler, list comprehensions are implemented without > emitting this bytecode, howewer the current implementa

Re: Safely renaming a file without overwriting

2006-10-28 Thread Wolfgang Draxinger
Steven D'Aprano wrote: > Open "the" file? There are potentially two files -- the source > and destination. I only want to do the rename if the > destination *doesn't* exist, so there is no destination file to > open. How will it help me to lock the source file? Have I > misunderstood? I forgot to

Re: latest numpy & scipy - incompatible ?

2006-10-28 Thread Robert Kern
robert wrote: > I'm using latest numpy & scipy. What is this problem ? : > import scipy.stats > RuntimeError: module compiled against version 102 of C-API but this > version of numpy is 109 The scipy binary available on sourceforge has not been recompiled for numpy 1.0. All you ne

Re: Regular Expression help for parsing html tables

2006-10-28 Thread Stefan Behnel
Hi Steve, [EMAIL PROTECTED] wrote: > I am having some difficulty creating a regular expression for the > following string situation in html. I want to find a table that has > specific text in it and then extract the html just for that immediate > table. Any reason why you can't use a real HTML pa

Re: Safely renaming a file without overwriting

2006-10-28 Thread Steven D'Aprano
On Sat, 28 Oct 2006 16:48:37 +0200, Diez B. Roggisch wrote: > Where does that help for new files? The OP was right in assuming that a > race condition could occur when he tests for a file & then tries to > create it, as in the meantime it could have been created. Ah! "Race condition" -- that wa

Re: Safely renaming a file without overwriting

2006-10-28 Thread Steven D'Aprano
On Sat, 28 Oct 2006 13:38:14 +0200, Wolfgang Draxinger wrote: >> But on a multi-user system, it is possible that dest is created >> in the time period between checking if it exists and attempting >> the rename. >> >> Is there any way to prevent this? Or do I just try to keep the >> check and the

Re: question about True values

2006-10-28 Thread Steven D'Aprano
On Sat, 28 Oct 2006 03:24:50 -0700, Carl Banks wrote: > Not all objects that have a state of emptiness consider emptiness to be > false. In which case they should define __nonzero__ appropriately. In which case, calling code that assumes that len(obj) is a substitute for truth-testing will do th

Name bindings for inner functions.

2006-10-28 Thread trevor_morgan
The following code: def functions(): l=list() for i in range(5): def inner(): return i l.append(inner) return l print [f() for f in functions()] returns [4,4,4,4,4], rather than the hoped for [0,1,2,3,4]. I presume this is something to do with the varia

Re: unescape HTML entities

2006-10-28 Thread Klaus Alexander Seistrup
Rares Vernica wrote: > How can I unescape HTML entities like " "? > > I know about xml.sax.saxutils.unescape() but it only deals with > "&", "<", and ">". > > Also, I know about htmlentitydefs.entitydefs, but not only this > dictionary is the opposite of what I need, it does not have > " ". How

Regular Expression help for parsing html tables

2006-10-28 Thread steve551979
Hello, I am having some difficulty creating a regular expression for the following string situation in html. I want to find a table that has specific text in it and then extract the html just for that immediate table. the string would look something like this: ...stuff here... ...stuff here...

Re: question about True values

2006-10-28 Thread J. Clifford Dyer
Steven D'Aprano wrote: > On Sat, 28 Oct 2006 03:13:42 +0100, Steve Holden wrote: > >>> Finally, while True/False is a good mental mapping for numeric >>> comparisons, take the following: >>> >>> >>> if "Cliff is a pillar of the open source community": >>> print "thank you" >>> e

Get pexpect to work

2006-10-28 Thread Jurian Sluiman
Hi all, I'm trying to build a program to set up a vpn connection. I'm using pexpect to handle this, but I can't get it to work. The sendline() is causing troubles. I tested it in the interactive promt, with these results: >>> import pexpect >>> child = pexpect.spawn("vpnc-connect tudelft\ nop

Re: ANN compiler2 : Produce bytecode from Python 2.5 Abstract Syntax Trees

2006-10-28 Thread sébastien martini
Hi, > I was primarily talking about language support. For quite some time, > the compiler package wasn't able to compile the Python standard library, > until Guido van Rossum (and others) brought it back to work at the last > PyCon. It would simply reject certain more recent language constructs. >

Re: unescape HTML entities

2006-10-28 Thread Jim
Rares Vernica wrote: > How can I unescape HTML entities like " "? Can I ask what you mean by "unescaping"? Do you mean converting into numeric references? Into Unicode? Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: question about True values

2006-10-28 Thread Georg Brandl
J. Clifford Dyer wrote: > Georg Brandl wrote: >> J. Clifford Dyer wrote: >> >>> >>> (1 > 0) < 1 >>> False >>> >>> 1 > 0 < 1 >>> True >>> >>> 1 > (0 < 1) >>> False >>> >>> 10 > (0 < 1) >>> True >> >> I hope you know why this works the way it does. >> >> Georg > > Yes, I do understand why it

Re: question about True values

2006-10-28 Thread J. Clifford Dyer
Georg Brandl wrote: > J. Clifford Dyer wrote: > >> >>> (1 > 0) < 1 >> False >> >>> 1 > 0 < 1 >> True >> >>> 1 > (0 < 1) >> False >> >>> 10 > (0 < 1) >> True > > I hope you know why this works the way it does. > > Georg Yes, I do understand why it works. I couldn't have crafted it if I did

unescape HTML entities

2006-10-28 Thread Rares Vernica
Hi, How can I unescape HTML entities like " "? I know about xml.sax.saxutils.unescape() but it only deals with "&", "<", and ">". Also, I know about htmlentitydefs.entitydefs, but not only this dictionary is the opposite of what I need, it does not have " ". It has to be in python 2.4. Thank

Re: correct parameter usage for "select * where id in ..."

2006-10-28 Thread saniac
paul wrote: > Frank Millman schrieb: > > If you want it to handle a variable number of values, you will have to > > programmatically construct the sql statement with the appropriate > > number of parameters. Yes, I should have made it clear it was the variable part that was hard. > >>> vals = (1,

Re: gettext on Windows

2006-10-28 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Leo Kislov wrote: > >> Try msgunfmt >> http://www.gnu.org/software/gettext/manual/html_node/gettext_128.html#SEC128 >> to see if it can convert your files back to text. > > Just tried it, and it was able to convert each of the .mo files back to > text without any prob

Re: what is "@param" in docstrings?

2006-10-28 Thread Georg Brandl
[EMAIL PROTECTED] wrote: > I'm starting to read about twisted and I keep seeing things like: > [from twisted/internet/app.py] > > def __init__(self, name, uid=None, gid=None, authorizer=None, > authorizer_=None): > """Initialize me. > If uid and gid arguments are not provided,

Re: what is "@param" in docstrings?

2006-10-28 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > What does the "@param" mean? It looks like something meant to be > machine readable. Alas, googling on "@param" doesn't work... It looks > at first like a decorator, but that doesn't make much sense. It's Epydoc's Epytext markup: . --

what is "@param" in docstrings?

2006-10-28 Thread georgeryoung
I'm starting to read about twisted and I keep seeing things like: [from twisted/internet/app.py] def __init__(self, name, uid=None, gid=None, authorizer=None, authorizer_=None): """Initialize me. If uid and gid arguments are not provided, this application will default t

Re: stripping parts of elements in a list

2006-10-28 Thread Paul Rubin
"CSUIDL PROGRAMMEr" <[EMAIL PROTECTED]> writes: > ['amjad\n', 'kiki\n', 'jijiji\n'] > I am trying to get rid of '\n' after each name. > to get list as > ['amjad','kiki','jijiji'] > > But list does not have a strip function as string does have. > > is there any solutions a = ['amjad\n', 'kiki\n

stripping parts of elements in a list

2006-10-28 Thread CSUIDL PROGRAMMEr
folks, I am new to python. I have a list made of elements ['amjad\n', 'kiki\n', 'jijiji\n'] I am trying to get rid of '\n' after each name. to get list as ['amjad','kiki','jijiji'] But list does not have a strip function as string does have. is there any solutions Is there a way this can be

Re: Safely renaming a file without overwriting

2006-10-28 Thread Chetan
Steven D'Aprano <[EMAIL PROTECTED]> writes: > I want to rename a file, but only if the destination file name doesn't > already exist. > > I can do this: > > if os.path.exists(dest): > # skip file, raise an exception, make a backup... > do_something_else() > else: > os.rename(src, de

Re: ANN: wxPython 2.7.1.3

2006-10-28 Thread Tim N. van der Leeuw
Hendrik van Rooyen wrote: > "Johann C. Rocholl" <[EMAIL PROTECTED]>wrote: > > 8<-- > > > Oh, it's fun to be a speling fanatic! :-) > > > six munce ago I could not even spell 'fatanic' - and now I are one... > > I wander what a speling fanatic is? > Someone who

Re: Where is __builtin__

2006-10-28 Thread Michel Claveau
Hi! >> http://www.effbot.org/pyfaq/where-is-the-math-py-socket-py-regex-py-etc-source-file.htm Yeaaahh!!!Finally a genuine URL;o) -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: wxPython 2.7.1.3

2006-10-28 Thread Hendrik van Rooyen
"Johann C. Rocholl" <[EMAIL PROTECTED]>wrote: 8<-- > Oh, it's fun to be a speling fanatic! :-) six munce ago I could not even spell 'fatanic' - and now I are one... I wander what a speling fanatic is? - Hendrik -- http://mail.python.org/mailman/listinfo/p

Re: Where do nested functions live?

2006-10-28 Thread Diez B. Roggisch
> If I may turn the issue around, I could see a need for an inner function > to be able to access the variables of the outer function, the same way a > function can access globals. Why? Because inner functions serve to > de-multiply code segments one would otherwise need to repeat or to > provi

Re: Where do nested functions live?

2006-10-28 Thread Frederic Rentsch
Fredrik Lundh wrote: > Steven D'Aprano wrote: > > >> I defined a nested function: >> >> def foo(): >> def bar(): >> return "bar" >> return "foo " + bar() >> >> which works. Knowing how Python loves namespaces, I thought I could do >> this: >> >> > foo.bar() >

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Fredrik Lundh
frankie_85 wrote: > Hmmmafter more trials and errors, I think what I did wrong is along > on these lines: > > a_1 = math.sqrt(math.fabs(a)) + 5((math.pow(a,3))) > b_2 = math.sqrt(math.fabs(b)) + 5((math.pow(b,3))) > c_3 = math.sqrt(math.fabs(c)) + 5((math.pow(c,3))) > d_4 = math.sqrt(math.fab

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Paul Rubin
"frankie_85" <[EMAIL PROTECTED]> writes: > e_5 = math.sqrt(math.fabs(e)) + 5((math.pow(e,3))) > > but I still don't understand though why the variable a, b, c, d, e > becomes an int type even though I have already specified the user input > to be floating point? if you want to multiply two number

Re: Safely renaming a file without overwriting

2006-10-28 Thread Wolfgang Draxinger
Diez B. Roggisch wrote: >> 1: Open the file with os.open >> >> 2: Lock the file exclusively -> no other process can now >> access it. >> >> 3: Use rename to rename the file; this causes a file system >> level implicit unlink of the old file (it dissappears from the >> file system) but the openin

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread J. Clifford Dyer
dan84 wrote: > I don't understand this error , in the (Apache) errorlog I read this > message : > > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import > mod_python.apache.\n > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being > used "['C:Python24python

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread frankie_85
Thanks for some of the helps guys. Hmmmafter more trials and errors, I think what I did wrong is along on these lines: a_1 = math.sqrt(math.fabs(a)) + 5((math.pow(a,3))) b_2 = math.sqrt(math.fabs(b)) + 5((math.pow(b,3))) c_3 = math.sqrt(math.fabs(c)) + 5((math.pow(c,3))) d_4 = math.sqrt(math.

Re: Where is __builtin__

2006-10-28 Thread Fredrik Lundh
ArdPy wrote: > Most of the other modules have an accompanying python source file. But > that is not the case with __builtin__. What might be the reason? Isn't > __builtin__ written in python? http://www.effbot.org/pyfaq/where-is-the-math-py-socket-py-regex-py-etc-source-file.htm -- http://mai

Where is __builtin__

2006-10-28 Thread ArdPy
Most of the other modules have an accompanying python source file. But that is not the case with __builtin__. What might be the reason? Isn't __builtin__ written in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Fredrik Lundh
Steven D'Aprano wrote: > I don't think the restrictions against collusion are meant to prohibit > simple "what does this error message mean?" type questions. It would be > a funny sort of learning process that forced students to live in a > vacuum, never discussing their topic with anyone else, ne

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread Chetan
"dan84" <[EMAIL PROTECTED]> writes: > I don't understand this error , in the (Apache) errorlog I read this > message : > > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import > mod_python.apache.\n > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being > used "['C

Re: change keybindings for pygtk treeview

2006-10-28 Thread Fabian Braennstroem
Hi, * Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, > > I am just testing pygtk/glade out and wonder, if I am able > to change the keybindings. E.g. the treeview searches by > default for the entries beginning with the typed keystroke; > moving to the next row works as usual with the Down k

Re: Python crashed when importing SOAPpy, printing out 'usage:copy source destination'

2006-10-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I still can't understand it. If i rename the 'copy.py' to 'a.py', > there will be no problem. hint: when it works, try typing the following into the interpreter: >>> import copy >>> copy.__file__ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python crashed when importing SOAPpy, printing out 'usage:copy source destination'

2006-10-28 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > > this is how things work: Python doesn't distinguish between script > files and module files; a module is simply a script that defines a > bunch of things. > > if you want to create something that can work both as a script and a > module, see: > > http://effbot.org/pyfa

latest numpy & scipy - incompatible ?

2006-10-28 Thread robert
I'm using latest numpy & scipy. What is this problem ? : >>> import scipy.stats RuntimeError: module compiled against version 102 of C-API but this version of numpy is 109 Traceback (most recent call last): File "", line 1, in ? File "C:\PYTHON23\Lib\site-packages\scipy\stats\__init__

Re: Safely renaming a file without overwriting

2006-10-28 Thread Diez B. Roggisch
Wolfgang Draxinger schrieb: > Steven D'Aprano wrote: > >> I want to rename a file, but only if the destination file name >> doesn't already exist. >> >> I can do this: >> >> if os.path.exists(dest): >> # skip file, raise an exception, make a backup... >> do_something_else() >> else: >>

Re: what are the most frequently used functions?

2006-10-28 Thread Barry Margolin
In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: > I had a idea today. > > I wanted to know what are the top most frequently used functions in the > emacs lisp language. I thought i can write a quick script that go thru > all the elisp library locations and get a word-frequen

Re: Reading standard input

2006-10-28 Thread Fredrik Lundh
MindClass wrote: > The program shows a license text, then the user has to accept the > license (or not). > Is there another way to get text from console? (that using > sys.stdin.read) http://effbot.org/pyref/raw_input.htm > I also would to trap the KeyboardInterrupt for that doesn't show that >

Re: Where do nested functions live?

2006-10-28 Thread Andrea Griffini
Fredrik Lundh wrote: > Ben Finney wrote: > >> If you want something that can be called *and* define its attributes, >> you want something more complex than the default function type. Define >> a class that has a '__call__' attribute, make an instance of that, and >> you'll be able to access attrib

Re: using mmap on large (> 2 Gig) files

2006-10-28 Thread Chetan
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Martin v. Löwis wrote: > > sturlamolden schrieb: > > > > > And why doesn't Python's mmap take an offset argument to handle large > > > files? > > > > I don't know exactly; the most likely reason is that nobody has > > contributed code to make it su

Re: question about True values

2006-10-28 Thread Antoon Pardon
On 2006-10-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 17:35:58 +, Antoon Pardon wrote: > >> On 2006-10-27, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> So >> it seems that python has generalised the len function to provide >> the number of elements in the containe

Re: question about True values

2006-10-28 Thread Antoon Pardon
On 2006-10-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 18:22:28 +, Antoon Pardon wrote: > And how do I express that a number has to be greater than 100 into a Nothing vs Something dichotomy? Declare all greater numbers as Something and the rest as Nothing

Re: Mass-Renaming folders win32

2006-10-28 Thread Tim Chase
> I've a folder structure like this : > > "Folder A" > |--> "1" > |--> "2" > ---> "3" > > "Folder B" > |--> "4" > ---> "5" > > And I want to obtain a structure like this : > > "Folder A - 1" > "Folder A - 2" > "Folder A - 3" > "Folder B - 4" > "Folder B - 5" > > Can someone help me ? I am pyth

Re: Sending mouse events on Windows

2006-10-28 Thread Radu Ciurlea
Looks good, but I downloaded it and it's not that helpful. It can only simulate clicks to interface objects. I need to actually move the mouse pointer around. I just want to write a small app that'll enable me to use my mobile phone as a mouse via Bluetooth, but not being able to move the pointer k

PROBLEM with MOD_PYTHON

2006-10-28 Thread dan84
I don't understand this error , in the (Apache) errorlog I read this message : [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import mod_python.apache.\n [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being used "['C:Python24python24.zip', '.DLLs', '.\\\

Reading standard input

2006-10-28 Thread MindClass
The program shows a license text, then the user has to accept the license (or not). Is there another way to get text from console? (that using sys.stdin.read) foo = sys.stdin.read(3) if foo != 'yes' sys.exit(0) I also would to trap the KeyboardInterrupt for that doesn't show that message. How

Re: PyQt-x11-gpl-3.16 compile error

2006-10-28 Thread David Boddie
On Saturday 28 October 2006 06:42, [EMAIL PROTECTED] wrote: > here is th output : > > [EMAIL PROTECTED] PyQt-x11-gpl-3.16]# python configure.py -q > /usr/lib/qt-3.3/ -w [...] > Checking to see if the qtcanvas module should be built... > /usr/bin/ld: cannot find -lXext > collect2: ld returned 1

Re: what are the most frequently used functions?

2006-10-28 Thread Dr.Ruud
robert schreef: > read more of the context and answer to the OP That OP is invisible in most relevant contexts. -- Affijn, Ruud "Gewoon is een tijger." -- http://mail.python.org/mailman/listinfo/python-list

Mass-Renaming folders win32

2006-10-28 Thread evaisse
I've a folder structure like this : "Folder A" |--> "1" |--> "2" ---> "3" "Folder B" |--> "4" ---> "5" And I want to obtain a structure like this : "Folder A - 1" "Folder A - 2" "Folder A - 3" "Folder B - 4" "Folder B - 5" Can someone help me ? I am python beginner -- http://mail.python.org

Re: Leo 4.4.2 final released: config bug

2006-10-28 Thread Edward K. Ream
Drat. Leo does not remember recent files unless .leoRecentFiles.txt exists in Leo's config directory. Alas, that file is (on purpose) not part of the distribution, and Leo only creates .leoRecentFiles.txt in the users home directory. So most users will have to create .leoRecentFiles.txt in Le

Re: gettext on Windows

2006-10-28 Thread russ . phillips . nospam
Leo Kislov wrote: > Try msgunfmt > http://www.gnu.org/software/gettext/manual/html_node/gettext_128.html#SEC128 > to see if it can convert your files back to text. Just tried it, and it was able to convert each of the .mo files back to text without any problems. Russ -- http://mail.python.org/

Re: Import if condition is correct

2006-10-28 Thread Steve Holden
MindClass wrote: > Steve Holden wrote: > >>I'm guessing that you think this might be necessary to avoid importing >>the same module multiple times: it's not. Python only runs the module's >>code the first time the module is imported into a program. A further >>import statement effectively does not

Re: what are the most frequently used functions?

2006-10-28 Thread robert
Jürgen Exner wrote: >> Xah Lee wrote: >>> I had a idea today. > > Oh, really? You should mark your calendar and celebrate the day annually!!! > >>> I wanted to know what are the top most frequently used functions in >>> the emacs lisp language. > > And the relationship with Perl, Python, Java is

Re: python GUIs comparison (want)

2006-10-28 Thread Jarek Zgoda
Christophe napisał(a): >> PyGtk: >> Pro: Sophisticated GUI's, cross-platform (Linux and Win32); very popular >> on some platforms; active development community >> Con: Not native on OS X > > You forgot that it is rather buggy on Win32 ( in my experience ) Didn't observe any W32-specific bugy beh

Re: What is the cleanest way to for a module to access objects from the script that imports it?

2006-10-28 Thread robert
[EMAIL PROTECTED] wrote: > Hi, > > I am new to python and am currently writing my first application. One > of the problems I quickly ran into, however, is that python's imports > are very different from php/C++ includes in the sense that they > completely wrap the imported script in a module objec

ANN: Leo 4.4.2 final released

2006-10-28 Thread Edward K. Ream
Leo 4.4.2 final is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 This release fixes a few bugs and adds support for controlling Leo from Emacs using pymacs. There are no known significant bugs in this version of Leo. Leo is a text editor, data orga

subprocess decoding?

2006-10-28 Thread MC
Hi! On win-XP (french), when I read subprocess (stdout), I must use differents decoding (cp1252,cp850,cp437, or no decoding), depending of the "launch mode" of the same Python's script: - from command-line - from start+run - from icon - by Python-COM-server - etc. (.py & .pyw can also

Re: Safely renaming a file without overwriting

2006-10-28 Thread Wolfgang Draxinger
Steven D'Aprano wrote: > I want to rename a file, but only if the destination file name > doesn't already exist. > > I can do this: > > if os.path.exists(dest): > # skip file, raise an exception, make a backup... > do_something_else() > else: > os.rename(src, dest) > > > But on a m

Re: what are the most frequently used functions?

2006-10-28 Thread J�rgen Exner
> Xah Lee wrote: >> I had a idea today. Oh, really? You should mark your calendar and celebrate the day annually!!! >> I wanted to know what are the top most frequently used functions in >> the emacs lisp language. And the relationship with Perl, Python, Java is exactly what? jue -- http://

Re: Import if condition is correct

2006-10-28 Thread MindClass
Steve Holden wrote: > I'm guessing that you think this might be necessary to avoid importing > the same module multiple times: it's not. Python only runs the module's > code the first time the module is imported into a program. A further > import statement effectively does noting, because the inte

Re: what are the most frequently used functions?

2006-10-28 Thread robert
Xah Lee wrote: > I had a idea today. > > I wanted to know what are the top most frequently used functions in the > emacs lisp language. I thought i can write a quick script that go thru > all the elisp library locations and get a word-frequency report i want. > > I started with a simple program:

Re: question about True values

2006-10-28 Thread Steven D'Aprano
On Sat, 28 Oct 2006 11:42:42 +0200, Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Steven > D'Aprano wrote: > >> On Fri, 27 Oct 2006 11:25:09 -0700, Carl Banks wrote: >> >>> Iterators do have overlapping uses with lists, but the "if a:" doesn't >>> work for them, so it's moot. >> >>

Re: Import if condition is correct

2006-10-28 Thread Steve Holden
MindClass wrote: > Georg Brandl wrote: > >>MindClass wrote: >> >>>Is possible import a library according to a condition? >>> >>>if Foo == True: >>>import bar >>> >> >>Why don't you try it? >> > > I thinked that could be another way for import statement. > > In that case I'll have to set a gl

Re: Arrays? (Or lists if you prefer)

2006-10-28 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: >> As an example of using pyparsing, I chose a simple text adventure >> application, and had to create a 2-D grid of rooms. The presentation >> materials are online at http://www.python.org/pycon/2006/papers/4/, and

Re: Import if condition is correct

2006-10-28 Thread MindClass
Georg Brandl wrote: > MindClass wrote: > > Is possible import a library according to a condition? > > > > if Foo == True: > > import bar > > > > Why don't you try it? > I thinked that could be another way for import statement. In that case I'll have to set a global variable before of the impo

Re: correct parameter usage for "select * where id in ..."

2006-10-28 Thread paul
Frank Millman schrieb: > If you want it to handle a variable number of values, you will have to > programmatically construct the sql statement with the appropriate > number of parameters. >>> vals = (1,2,3,4,5) >>> sql = "select * from table where value in ("+','.join("?"*len(vals))+")" >>> print s

  1   2   >