Re: readline module and white-space

2005-05-19 Thread Simon Percivall
Take a look at readline.get_completer_delims() and readline.set_completer_delims(). -- http://mail.python.org/mailman/listinfo/python-list

PyGame and Rotozoom (Sorry if OT)

2005-05-19 Thread J. W. McCall
I'm not sure if this is off-topic, since it doesn't deal with Python itself, but here goes: I'm messing around with writing a simple "game" where the player (a crudely drawn smiley face) moves by rotating and moving back or forward (think Resident Evil, but from an always-above view). After mu

[pysqlite] How do I use pysqlite in a multi-threading env.?

2005-05-19 Thread F. GEIGER
In my wxPython-app a part of it gathers data, when a button is pressed, and stores it into a db. The GUI part should display the stuff being stored in the db. When both parts work on the same connection, I get "SQL statements in progress errors". Seems ok to me, you can't do that. So, next step:

Re: Is Python suitable for a huge, enterprise size app?

2005-05-19 Thread Kay Schluehr
Dave Brueck wrote: > Overall it's been such a positive experience for us that nobody in the company - > from grunt testers up to the CTO - has any reservations about using Python in > production anymore (even though initially they all did). All of the developers > have previous experience with us

PIL and line drawing

2005-05-19 Thread Leonard J. Reder
Hello, I am using PIL to annotate some images with lines. I could not find anyway to make the line that is drawn from the ImageDraw object thicker. Does anyone have a suggestion or solution for solving this without to much hacking? Thanks for any replies, Len -- ==

PIL and fonts

2005-05-19 Thread Leonard J. Reder
Hello, I wrote a quick application to annotate some images and find that I would like to use different fonts. I am using Python 2.4 with the PIL extension to do this. Moreover I use the ImageDraw text method. I read the documentation on ImageFont and would like a pointer to some useful instruct

Re: Comparing 2 similar strings?

2005-05-19 Thread Patrick TJ McPhee
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: % None of the other approaches make the mistake of preserving the first % letter -- this alone is almost enough reason for jettisoning soundex. Metaphone does, at least in the case of Aaron and Erin. -- Patrick TJ McPhee

how to config a comserver in a customize dll?

2005-05-19 Thread ÒÊÃÉɽÈË
When i use the below code to create a comserver on Windows OS£¬i find that the com was configed in the file python23com.dll,why? if i want to config it in my customize dll,how should i do? thks class TestPythonCom: _public_methods_ = [ 'SplitString' ] _reg_progid_ = "TestPythonCom.Applicat

Re: newbie file/DB processing

2005-05-19 Thread jlach
Hi Len, If you want to still try this with a Windows programming language try OZEXE Lite at http://www.ozdevelopment.com. With built in support for ODBC and a simplified language you be up and running in no time. You could just use a datasource for a text file. It's free by the way. Regards,

Re: problem uploading ZIP file tp PyPI

2005-05-19 Thread John Machin
On Fri, 20 May 2005 13:04:21 +1200, "Tony Meyer" <[EMAIL PROTECTED]> wrote: >>> So (if the former is what you meant) would a workaround for >>> now be to do something like: >>> >>> setup.py sdist --format=gztar upload >> >> (1) error: command 'tar' failed: No such file or directory > >I was ass

Re: Extracting multiple zip files in a directory

2005-05-19 Thread Lorn
Ok, I probably should have seen this coming. Working with small zip files is no problem with the above script. However, when opening a 120+ MB compressed file that uncompresses to over 1GB, I unfortunately get memory errors. Is this because python is holding the extracted file in memory, as opposed

RE: problem uploading ZIP file tp PyPI

2005-05-19 Thread Tony Meyer
>> So (if the former is what you meant) would a workaround for >> now be to do something like: >> >> setup.py sdist --format=gztar upload > > (1) error: command 'tar' failed: No such file or directory I was assuming that tar and gzip were available. There are various tar/gzip applications avai

Re: SSL (HTTPS) with 2.4

2005-05-19 Thread Bloke
Ideally, we should aim at a 'fix' that can be included in the distribution. I am going to look at what communication goes on between the proxy server and a working browser by monitoring the traffic. From what i understand, the proxy needs to be told first to set up a secure connection with the we

XML Newbie needing some serious help..

2005-05-19 Thread rh0dium
HI all, I am looking to parse a unix tool called lshw ( http://ezix.sourceforge.net/software/lshw.html ). Now this provides a nice XML output which looks similar to the bottom of this message.. Now I want to parse and get some information from it so here is what I have.. class HWParser: def

Re: Twisted an several CPUs

2005-05-19 Thread Jp Calderone
On 19 May 2005 17:01:11 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >Jp Calderone <[EMAIL PROTECTED]> writes: >> Distributing load across multiple machines scales better than >> distributing it over multiple CPUs in a single machine. If you have >> serious scalability requirements

Re: problem uploading ZIP file tp PyPI

2005-05-19 Thread John Machin
On Fri, 20 May 2005 11:28:14 +1200, "Tony Meyer" <[EMAIL PROTECTED]> wrote: >> setup.py sdist --format=zip > > Try without the --format arg. The code is being too paranoid. Oh, so even without --format, a ZIP source dist file is produced anyway? If this is the case, ple

Re: Twisted an several CPUs

2005-05-19 Thread Paul Rubin
Jp Calderone <[EMAIL PROTECTED]> writes: > Distributing load across multiple machines scales better than > distributing it over multiple CPUs in a single machine. If you have > serious scalability requirements, SMP is a minor step in the wrong > direction (unless you're talking about something l

Re: Tkinter special math chars

2005-05-19 Thread Paul Rubin
phil <[EMAIL PROTECTED]> writes: > Using Tkinter to teach high school geometry. Sorta committed to > Tkinter at least for now. Would like to use some special chars like > limits, infinity, square root, cube root and a buch more. If you want to get really fancy, you could do what Wikimedia does:

Re: import cx_Oracle fails!

2005-05-19 Thread Daniel
And, completing my answer, I'm sending you all how I finally got the Python 2.4.1 and cx_Oracle-4.1 running on my HP-UX (sukz) box: Box: HP-UX B.11.11 Compiling Python 2.4.1 with gcc 3.4.3 = ./configure --with-libs='-lcl' Added Makefile options: CC=

Re: problem uploading ZIP file tp PyPI

2005-05-19 Thread John Machin
On Fri, 20 May 2005 08:27:28 +1000, richard <[EMAIL PROTECTED]> wrote: >John Machin wrote: >> On Mon, 16 May 2005 22:11:49 +1000, richard >>>John Machin wrote: setup.py sdist --format=zip >>> >>>Try without the --format arg. The code is being too paranoid. >> >> Result: (A) produces a zip fi

Re: import cx_Oracle fails!

2005-05-19 Thread Daniel
Yes dude, it worked! :-) Thank you very much (Muito obrigado!!!) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python suitable for a huge, enterprise size app?

2005-05-19 Thread Maurice LING
Peter Hansen wrote: > Maurice LING wrote: > >> It makes big difference (legally) to if the codes are there and >> someone sees it, to if the codes are locked in some packaged or zipped >> form and someone reverse-engineer it. It is legally as different as if >> you drop money on the ground and

Re: Is Python suitable for a huge, enterprise size app?

2005-05-19 Thread Maurice LING
Peter Hansen wrote: > Maurice LING wrote: > >> It makes big difference (legally) to if the codes are there and >> someone sees it, to if the codes are locked in some packaged or zipped >> form and someone reverse-engineer it. It is legally as different as if >> you drop money on the ground and

RE: problem uploading ZIP file tp PyPI

2005-05-19 Thread Tony Meyer
> setup.py sdist --format=zip Try without the --format arg. The code is being too paranoid. >>> >>> Oh, so even without --format, a ZIP source dist file is produced >>> anyway? If this is the case, please file a bug against PyPI. >> >> How is this a bug? sdist is meant to produce a

Re: Shift-JIS to UTF-8 conversion

2005-05-19 Thread Jeff Epler
I think you do something like this (untested): import codecs def transcode(infile, outfile, incoding="shift-jis", outcoding="utf-8"): f = codecs.open(infile, "rb", incoding) g = codecs.open(outfile, "wb", outcoding) g.write(f.read()) # If the file is so large that it can't be

Process monitoring

2005-05-19 Thread gsteff
Hey, I'm working on a Python program that will launch some other non-Python process using os.spawn (in the os.P_NOWAIT mode) and then basically wait for it to finish (while doing some other stuff in the interim). Normally, the new process will signal that it's done by writing to a file, but I'd li

readline module and white-space

2005-05-19 Thread MackS
Dear all, I'm trying to use Python's readline module but I'm having some trouble. In particular, autocompletion seems to "get stuck" on white spaces. Please take a look at this code snippet: import readline def completer(text, state): text = text list = ['a dog', 'artsy'] if len

Re: Convert from numbers to letters

2005-05-19 Thread Mike Meyer
"rh0dium" <[EMAIL PROTECTED]> writes: > Now can you reverse this process tuple2coord?? You didn't provide enough context to know who you're asking, but here's the inverse of my coord2tuple2 function: from string import uppercase def tuple2coord(number): if 1 > number or number > 26: ra

RE: problem uploading ZIP file tp PyPI

2005-05-19 Thread Tony Meyer
setup.py sdist --format=zip >>> >>> Try without the --format arg. The code is being too paranoid. >> >> Result: (A) produces a zip file with only minor differences >> (presumably a timestamp): > > Oh, so even without --format, a ZIP source dist file is > produced anyway? If this is the cas

Re: Comparing 2 similar strings?

2005-05-19 Thread John Machin
On Fri, 20 May 2005 01:47:15 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Thu, 19 May 2005 14:09:32 +1000, John Machin wrote: > >> None of the other approaches make the mistake of preserving the first >> letter -- this alone is almost enough reason for jettisoning soundex. > >Off-topic no

Re: [Tutor] kernel serie

2005-05-19 Thread Jonas Melian
Max Noel wrote: > > The [:2] is unnecessary, as you're limiting the number of splits to > 2, so the resulting list from split() can't have more than 3 elements. > Without the [:2], it fails > Also, note that this code will likely cause the program to crash on > any system that isn't L

Re: problem uploading ZIP file tp PyPI

2005-05-19 Thread richard
John Machin wrote: > On Mon, 16 May 2005 22:11:49 +1000, richard >>John Machin wrote: >>> setup.py sdist --format=zip >> >>Try without the --format arg. The code is being too paranoid. > > Result: (A) produces a zip file with only minor differences > (presumably a timestamp): Oh, so even without

Re: Convert from numbers to letters

2005-05-19 Thread rh0dium
Now can you reverse this process tuple2coord?? Thats what I'm really after :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread rh0dium
Wow - now that is ugly.. But it is effective. I would love a cleaner version - but I did say brevity :) Nice work. -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing 2 similar strings?

2005-05-19 Thread Chris Croughton
On Fri, 20 May 2005 01:47:15 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 19 May 2005 14:09:32 +1000, John Machin wrote: > >> None of the other approaches make the mistake of preserving the first >> letter -- this alone is almost enough reason for jettisoning soundex. > > Off-

Re: How to receive events (eg. user mouse clicks) from IE

2005-05-19 Thread Roger Upole
Usually you get that error if you try to access the Document object before the page has loaded. Try adding a delay after ie.Navigate, something like while ie.ReadyState<>4: time.sleep(0.5) There are some constants that show up in win32com.client.constants that represent the ReadyState's, but

Re: Comparing 2 similar strings?

2005-05-19 Thread Dan Bishop
Steven D'Aprano wrote: > On Thu, 19 May 2005 14:09:32 +1000, John Machin wrote: > > > None of the other approaches make the mistake of preserving the first > > letter -- this alone is almost enough reason for jettisoning soundex. > > Off-topic now, but you've made me curious. > > Why is this a bad

Re: Is Python suitable for a huge, enterprise size app?

2005-05-19 Thread Paul Rubin
[EMAIL PROTECTED] (Aahz) writes: > Send e-mail to [EMAIL PROTECTED] -- actually, you can have commit > privs if you want. I think I'm going to enter an SF bug on the issue if there isn't already one. It's not obvious to me whether a reasonable fix is possible, but at least it should be tracked.

Re: How to receive events (eg. user mouse clicks) from IE

2005-05-19 Thread cal_2pac
Thanks for your prompt responses and the code. However, when I run the code I get com error d=win32com.client.DispatchWithEvents(ie.Document, Doc_Events) File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 199, in __getattr__ return getattr(self._obj_, attr) File "C:\Pyt

ANN: Veusz 0.6 - a scientific plotting package

2005-05-19 Thread Jeremy Sanders
Veusz 0.6 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2005 Jeremy Sanders <[EMAIL PROTECTED]> Licenced under the GPL (version 2 or greater) Veusz is a scientific plotting package written in Python (currently 100% Pyt

Re: Byte-operations.

2005-05-19 Thread Dan Bishop
Dave Rose wrote: > I hope someone can please help me. A few months ago, I found a VBS file, > MonitorEDID.vbs on the internet. ...[snip]... > Anyway, the functions from VBS I don't know how to translate to Python are: > > #location(0)=mid(oRawEDID(i),0x36+1,18) > #location(1)=mid(o

Shift-JIS to UTF-8 conversion

2005-05-19 Thread PyTJ
Hello everybody, I need to convert a Japanese Shift-JIS CSV file to Unicode UTF-8. My machine is a Windows 98 english computer with Python 2.3.4 Any hints?. -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Jason Drew
Oh yeah, oops, thanks. (I mean the line continuations, not the alleged sin against man and nature, an accusation which I can only assume is motivated by jealousy :-) Or fear? They threw sticks at Frankenstein's monster too. And he turned out alright. My elegant "line" of code started out without t

Re: Convert from numbers to letters

2005-05-19 Thread Steven Bethard
Gary Wilson Jr wrote: > Gary Wilson Jr wrote: > >>alpha = 'abcdefghijklmnopqrstuvwxyz'.upper() >>pairs = [x for x in alpha] + [''.join((x,y)) for x in alpha for y in alpha] > > I forget, is string concatenation with '+' just as fast as join() > now (because that would look even nicer)? Certain l

Re: Twisted an several CPUs

2005-05-19 Thread Mike Meyer
Jp Calderone <[EMAIL PROTECTED]> writes: >>Has anyone experience high load and twisted? > Distributing load across multiple machines scales better than distributing > it over multiple CPUs in a single machine. If you have serious scalability > requirements, SMP is a minor step in the wrong di

Re: Convert from numbers to letters

2005-05-19 Thread Steven Bethard
Jason Drew wrote: > z = lambda cp: (int(cp[min([i for \ > i in xrange(0, len(cp)) if \ > cp[i].isdigit()]):])-1, > sum(((ord(cp[0:min([i for i in \ > xrange(0, len(cp)) if \ > cp[i].isdigit()])][x])-ord('A')+1) \ > * (26 ** (len(cp[0:min([i for i in \ > xrange(0, len(cp)

Re: Convert from numbers to letters

2005-05-19 Thread Mike Meyer
Bill Mill <[EMAIL PROTECTED]> writes: > On 19 May 2005 11:59:00 -0700, rh0dium <[EMAIL PROTECTED]> wrote: >> This is great but backwards... >> >> Ok because you all want to know why.. I need to convert Excel columns >> A2 into , [1,0] and I need a simple way to do that.. >> >> ( The way this wo

Re: Convert from numbers to letters

2005-05-19 Thread Gary Wilson Jr
Gary Wilson Jr wrote: > alpha = 'abcdefghijklmnopqrstuvwxyz'.upper() > pairs = [x for x in alpha] + [''.join((x,y)) for x in alpha for y in alpha] I forget, is string concatenation with '+' just as fast as join() now (because that would look even nicer)? -- http://mail.python.org/mailman/listinfo

Re: Convert from numbers to letters

2005-05-19 Thread Jason Drew
We weren't really backwards; just gave a full solution to a half-stated problem. Bill, you've forgotten the least-lines-of-code requirement :-) Mine's still a one-liner (chopped up so line breaks don't break it): z = lambda cp: (int(cp[min([i for \ i in xrange(0, len(cp)) if \ cp[i].isdi

where to look for python employees/contractors?

2005-05-19 Thread Steven Arnold
Where are some of the better places to look for Python developers? I'm aware of the employer's job board on python.org; are there any other places that are especially recommended? I appreciate any thoughts or suggestions, steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Peter Otten
Peter Otten wrote: [Something stupid] You are right. I finally got it. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to receive events (eg. user mouse clicks) from IE

2005-05-19 Thread Roger Upole
Here's a few more lines that hook the document's onactivate event. import win32com.client ie_mod=win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-C05BAE0B}' ,0, 1, 1) doc_mod=win32com.client.gencache.EnsureModule('{3050F1C5-98B5-11CF-BB82-00AA00BDCE0B}' ,0 ,4, 0) class IE_E

Re: Convert from numbers to letters

2005-05-19 Thread Peter Otten
Bill Mill wrote: >> By the way, sorted() can be removed from your original post. >> >> Code has no effect :-) > > I'm gonna go ahead and disagree with you: > sorted([''.join((x, y)) for x in alpha \ > ...for y in [''] + [z for z in alpha]], key=len) == \ > ... [''.join((x,y)) for x in

Re: NaN support etc.

2005-05-19 Thread Andreas Beyer
/Sébastien Boisgérault wrote:/ > But, practically, I have never found a platform where > the following fpconst-like code did not work: > > import struct > cast = struct.pack > > big_endian = cast('i',1)[0] != '\x01' > if big_endian: >nan = cast('d', '\x7F\xF8\x00\x00\x00\x00\x00\x00')[0] > els

Re: Convert from numbers to letters

2005-05-19 Thread Gary Wilson Jr
Bill Mill wrote: > On 5/19/05, Peter Otten <[EMAIL PROTECTED]> wrote: > >>Bill Mill wrote: >> >> Traceback (most recent call last): File"",line1,in? NameError: name 'sorted' is not defined I think you're probably using 2.4 ?? >>> >>>Yes, sorted() is new in python 2.4 .You coul

store mac address

2005-05-19 Thread [EMAIL PROTECTED]
Hello, I am trying to fill an array with source and destination mac address. The first 6 bytes hold the destination mac address and the next six bytes hold the source mac address. Here's a snippet for filling in broadcast address for the destination mac. # Get destination address data = array('B',

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 5/19/05, Peter Otten <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > >> Traceback (most recent call last): > >>File"",line1,in? > >> NameError: name 'sorted' is not defined > >> > >> I think you're probably using 2.4 ?? > > > > Yes, sorted() is new in python 2.4 .You could use a very lightly

Re: Self-modifying Code

2005-05-19 Thread Do Re Mi chel La Si Do
Hi, you, also ! A view, with a little difference : def titi(par): if par>222: return par*2 else: return par*10 print titi(123) print titi(1234) #now, change the function, "on instant" txt="""def titi(par): if par>222: return str(par)*2 else: retu

Re: Convert from numbers to letters

2005-05-19 Thread Peter Otten
Bill Mill wrote: >> Traceback (most recent call last): >>File "", line 1, in ? >> NameError: name 'sorted' is not defined >> >> I think you're probably using 2.4 ?? > > Yes, sorted() is new in python 2.4 .You could use a very lightly > tested pure-python partial replacement: By the way, sorted(

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 19 May 2005 12:20:03 -0700, rh0dium <[EMAIL PROTECTED]> wrote: > Python 2.3.5 (#1, Mar 20 2005, 20:38:20) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin > > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'sorted' is not defined > > I think you'

Re: Self-modifying Code

2005-05-19 Thread Peter Hansen
[EMAIL PROTECTED] wrote: [regarding "self-modifying code"] > fNew =open("newModule.py",'w') > lNew=['print 123\n','print 454\n','print 789\n'] > fNew.writelines(lNew) > fNew.close() > from newModule import * This isn't really self-modifying code (unless you are talking about this being a small pa

Re: How to receive events (eg. user mouse clicks) from IE

2005-05-19 Thread Roger Upole
ie.Document will give you the document object. That's where the Html object library comes in, it contains the early-binding code for the Document interface. Then you can hook one of the event classes for the Document (I see several in the generated file) using the same methodology as shown for th

Re: Self-modifying Code

2005-05-19 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: > [...] > Also Python can (writing and running a module, in-line): > > fNew =open("newModule.py",'w') > lNew=['print 123\n','print 454\n','print 789\n'] > fNew.writelines(lNew) > fNew.close() > from newModule import * > [...] You don't even need a file for this. Try: e

Re: Convert from numbers to letters

2005-05-19 Thread rh0dium
Python 2.3.5 (#1, Mar 20 2005, 20:38:20) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Traceback (most recent call last): File "", line 1, in ? NameError: name 'sorted' is not defined I think you're probably using 2.4 ?? -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 19 May 2005 11:59:00 -0700, rh0dium <[EMAIL PROTECTED]> wrote: > This is great but backwards... > > Ok because you all want to know why.. I need to convert Excel columns > A2 into , [1,0] and I need a simple way to do that.. > > ( The way this works is A->0 and 2->1 -- Yes they interchange --

Re: How to receive events (eg. user mouse clicks) from IE

2005-05-19 Thread cal_2pac
Hi Thanks for the response and for the code. However, I want to trap events like mouse click on the HTML document loaded by the web browser control. The code mentioned below provides events from the web browser control. I need to find out on which particular HTML tag did the user click for example.

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 19 May 2005 11:52:30 -0700, rh0dium <[EMAIL PROTECTED]> wrote: > Call me crazy.. But it doesn't work.. > What doesn't work? What did python output when you tried to do it? It is python 2.4 specific, it requires some changes for 2.3, and more for earlier versions of python. > for i, digraph i

Re: Convert from numbers to letters

2005-05-19 Thread rh0dium
This is great but backwards... Ok because you all want to know why.. I need to convert Excel columns A2 into , [1,0] and I need a simple way to do that.. ( The way this works is A->0 and 2->1 -- Yes they interchange -- So B14 == [13,1] ) So my logic was simple convert the A to a number and the

Re: Convert from numbers to letters

2005-05-19 Thread rh0dium
Call me crazy.. But it doesn't work.. for i, digraph in enumerate(sorted([''.join((x, y)) for x in alpha for y in [''] + [z for z in alpha]], key=len)): globals()[digraph]=i+1 How do you implement this sucker?? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter special math chars

2005-05-19 Thread Jeff Epler
On Thu, May 19, 2005 at 12:56:12PM -0500, phil wrote: > Why is it so slow? (RH Linux, 2.4.20, 1.6Ghz AMD) > 3/4 second slower to display widget w/unicode, > even if I encode u'\u221e' u'\u221e' vs u'\N{INFINITY}' should make no noticible run-time difference--they both specify exactly the same stri

Re: Markov chain with extras?

2005-05-19 Thread temp
Hi Gentlemen, First off, thanks for the work/time you've put into this - much appreciated! Let me play around with the code and I'll get back to you tomorrow. Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Byte-operations.

2005-05-19 Thread GMane Python
For anyone who cares out there, I tried a slice with hex values: IDLE 1.0.3 >>> a =['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17 ','18','19','20'] >>> print a[3:4] ['4'] >>> print a[0xa:0xc] ['11', '12'] >>> print a[0xa:0xa+5] ['11', '12', '13', '14', '15'] -Dave "J

Re: Convert from numbers to letters

2005-05-19 Thread qwweeeit
Hi rh0dium, Your request gives me the opportunity of showing a more realistic example of the technique of "self-modification coding". Although the coding is not as short as that suggested by the guys who replayed to you, I think that it can be interesting # newVars.py lCod=[] for n in range(

Re: Tkinter special math chars

2005-05-19 Thread phil
> text=u"As the function approaches \N{INFINITY}, \N{HORIZONTAL > ELLIPSIS}") Never mind, works in a Text widget, my bad. Why is it so slow? (RH Linux, 2.4.20, 1.6Ghz AMD) 3/4 second slower to display widget w/unicode, even if I encode u'\u221e' Works though, this is great. -- http:/

Re: SSL (HTTPS) with 2.4

2005-05-19 Thread pyguy2
If you need some help, send me an email and if we figure this out we can post a resolution. I have used both approaches (having authored them). Or at least let me know what site you are going to and I will try them on a windows box and see if I can debug that the [EMAIL PROTECTED]@ is going on.

Re: Is Python suitable for a huge, enterprise size app?

2005-05-19 Thread Aahz
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >(this used to be explained in the Python FAQ too, but it looks as if that >was lost in the great FAQ reorganization). Send e-mail to [EMAIL PROTECTED] -- actually, you can have commit privs if you want. -- Aahz ([EMAIL PR

Re: Twisted an several CPUs

2005-05-19 Thread Jp Calderone
On Thu, 19 May 2005 17:22:31 +0200, Thomas Guettler <[EMAIL PROTECTED]> wrote: >Hi, > >Out of sheer curiosity: > >Does Twisted scale if the server has several CPUs? > No more than any other single-process Python application (no less, either). Unless you run multiple processes... >As far as I

Re: ElementTree and xsi to xmlns conversion?

2005-05-19 Thread Matthew Thorley
Thanks for the reply I am understanding it better now. Please forgive my ignorance. So the xsi is just an arbitrary name space prefix, I get that now. And it make sense to me why it gets converted to an xmlns. What I really need to know is why it is not inherited by the child elements? From what I

Re: What's the use of changing func_name?

2005-05-19 Thread Michael Hudson
Robert Kern <[EMAIL PROTECTED]> writes: > could ildg wrote: > > Thank you for your help. > > I know the function g is changed after setting the func_name. > > But I still can't call funciton g by using f(), when I try to do > > this, error will occur: > > > > > g.func_name="f" > print g

Re: SSL (HTTPS) with 2.4

2005-05-19 Thread Andrew Bushnell
Thanks for the feedback. andreas. I am looking into how to work my own connection logic into the code. Google has quickly become my friend and I am actually poking at cURL (pyCurl) to see what benefit it will be. Thanks again. [EMAIL PROTECTED] wrote: > Hi! > > HTTPS over a proxy (CONNECT) h

Re: Tkinter special math chars

2005-05-19 Thread phil
So far, on RedHat Linux: I have used your method successfully in a Label and in Canvas Text. very slow.?? In A Text box I just get \N{INFINITY}. But thanks, I will investigate Text Box more. Jeff Epler wrote: > I wrote the following code: > import Tkinter > t = Tkinter.Label() > t.c

Re: SSL (HTTPS) with 2.4

2005-05-19 Thread andreas
Hi! HTTPS over a proxy (CONNECT) hasn't worked for a long time in python (actually it has never worked). A quick glance at the 2.4 Changelog doesn't suggest that this has been fixed. So basically you've got the following options: a) redo your own http/https support. b) look around on the net for

Self-modifying Code

2005-05-19 Thread qwweeeit
Hi all, when I was young I programmed in an interpreted language that allowed to modify itself. Also Python can (writing and running a module, in-line): fNew =open("newModule.py",'w') lNew=['print 123\n','print 454\n','print 789\n'] fNew.writelines(lNew) fNew.close() from newModule import * Runn

Re: SSL (HTTPS) with 2.4

2005-05-19 Thread Andrew Bushnell
Thanks for the update. I will/can keep you posted. I know for a fact we use a Squid proxy which sounds like what you are using. I am going to check out the faq you sent and see what it comes up with. I have also been perusing the net a bit and looking at other client packages and see if they wo

Re: SSL (HTTPS) with 2.4

2005-05-19 Thread Bloke
Andrew, It seems I'm not the only one going nuts here. I have just spent the last 4 hrs stepping through the code in the debugger. It seems to get stuck somewhere in the socket module (when it calls ssl) but haven't as yet figured out exactly where. I am _very_ interested to find that you have

Re: Convert from numbers to letters

2005-05-19 Thread Steven Bethard
Bill Mill wrote: >py> alpha = 'abcdefghijklmnopqrstuvwxyz' >py> for i, digraph in enumerate(sorted([''.join((x, y)) for x in alpha > ...for y in [''] + [z for z in alpha]], key=len)): > ... locals()[digraph] = i + i > ... It would probably be better to get in the habit of writing glob

Re: Tkinter special math chars

2005-05-19 Thread Jeff Epler
I wrote the following code: import Tkinter t = Tkinter.Label() t.configure( text=u"As the function approaches \N{INFINITY}, \N{HORIZONTAL ELLIPSIS}") t.pack() t.mainloop() It worked for me on Windows NT 4.0 with Python 2.4, and on RedHat 9 with a self-compiled Python 2.

Re: Python forum

2005-05-19 Thread Steve Holden
Ivan Van Laningham wrote: > Hi All-- > > Peter Hansen wrote: > >>Ivan Van Laningham wrote: >> >>>Robert Kern wrote: >>> dict.org says _forums_. I used _fora_, but I'm silly. >>> >>>It also says "appendixes" and "indexes" are OK. Yahoos. >> >>Should that be "Yaha"? >> > > > Nope. I

Re: Convert from numbers to letters

2005-05-19 Thread Jason Drew
It seems strange to want to set the values in actual variables: a, b, c, ..., aa, ab, ..., aaa, ..., ... Where do you draw the line? A function seems more reasonable. "In terms of lines of code" here is my terse way of doing it: nrFromDg = lambda dg: sum(((ord(dg[x])-ord('a')+1) * (26 ** (len(dg

Re: newbie running IDLE with command line arguments

2005-05-19 Thread zsolt-public4516
Hmm, I submitted an earlier message, but something seems to have gone wrong. Try this: import sys usingIdle = 0 for eachPath in sys.path: if eachPath.find("idlelib"): usingIdle = 1 break if usingIdle: host="localhost" port="2000" msg="Hello world" else: host, port,

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
Yep, I was wondering about irrelevant things, there is no problem in this case, actually. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: self-promotion of the decorator module

2005-05-19 Thread Duncan Booth
Michele Simionato wrote: > Duncan Booth: >> Fortunately you have a list of >> argument names readily available so it shouldn't be too >> hard to generate unique names to use in their place. > > It does not look too simple either. Whereas I can easily > build valid Python identifiers which are ext

Re: Comparing 2 similar strings?

2005-05-19 Thread Steven D'Aprano
On Thu, 19 May 2005 14:09:32 +1000, John Machin wrote: > None of the other approaches make the mistake of preserving the first > letter -- this alone is almost enough reason for jettisoning soundex. Off-topic now, but you've made me curious. Why is this a bad idea? How would you handle the case

Twisted an several CPUs

2005-05-19 Thread Thomas Guettler
Hi, Out of sheer curiosity: Does Twisted scale if the server has several CPUs? As far as I know twisted uses one interpreter. This means a prefork server modul might be better to server database driven web-apps. Has anyone experience high load and twisted? Thomas -- Thomas Güttler, http://w

Re: Comparing 2 similar strings?

2005-05-19 Thread Steven D'Aprano
On Thu, 19 May 2005 07:07:56 +1000, John Machin wrote: > On Wed, 18 May 2005 13:45:30 -0700, Don <[EMAIL PROTECTED]> > wrote: > >>http://www.personal.psu.edu/staff/i/u/iua1/python/apse/ > > The above is broken, not meeting one of the elementary conditions for > a distance metric: > > distance(a

Tkinter special math chars

2005-05-19 Thread phil
Using Tkinter to teach high school geometry. Sorta committed to Tkinter at least for now. Would like to use some special chars like limits, infinity, square root, cube root and a buch more. in Text Box and Cancas Is there some package I can integrate with Tkinter to do this. Even better would a '

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
I have uploaded version 0.5 that should fix all the subtle bugs you pointed out, but there could be others (I would not be surprised in that case ;). I will add a test suite for various corner cases tomorrow. BTW, I cannot decide if exotic function signatures are a feature or an accident ...

Re: newbie file/DB processing

2005-05-19 Thread Paul Watson
"len" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am an old time > cobol programmer from the IBM 360/370 eria and this ingrained idea of > file processing using file definition (FD's) I believe is causing me > problems because I think python requires a different way of looking

Re: Is Python suitable for a huge, enterprise size app?

2005-05-19 Thread Dave Brueck
Paul Rubin wrote: > "Kay Schluehr" <[EMAIL PROTECTED]> writes: >>To answer Your initial question: there is probably no technical reason >>against Python as a language or the CPython runtime. Both are very >>stable and mature. > > > I'd like to agree with this but I just can't. Python is a great

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 19 May 2005 06:56:45 -0700, rh0dium <[EMAIL PROTECTED]> wrote: > Hi All, > > While I know there is a zillion ways to do this.. What is the most > efficient ( in terms of lines of code ) do simply do this. > > a=1, b=2, c=3 ... z=26 > > Now if we really want some bonus points.. > > a=1, b=2,

  1   2   >