Re: How to learn OO of python?

2005-05-19 Thread Steven Bethard
could ildg wrote: > I think decorator is a function which return a function, is this right? > e.g. The decorator below if from http://www.python.org/peps/pep-0318.html#id1. > > def accepts(*types): > def check_accepts(f): > assert len(types) == f.func_code.co_argcount > def new

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

2005-05-19 Thread Roger Upole
The two you'll need to run makepy for are Microsoft Internet Controls and Microsoft HTML object Library. If you run them manually, you should be able to look at the generated code to get the guids. Here's a minimal example: import win32com.client ie_mod=win32com.client.gencache.EnsureModule('{EA

Re: ElementTree and xsi to xmlns conversion?

2005-05-19 Thread Fredrik Lundh
Matthew Thorley wrote: > Why does ElementTree.parse convert my xsi to an xmlns? because it is a namespace prefix, perhaps? > When I do this > from elementtree import ElementTree > > # Sample xml > mgac =""" > http://www.chpc.utah.edu/~baites/mgacML"; > xmlns:xsi="http://www.w3.org/2001/XMLSc

Re: Comparing 2 similar strings?

2005-05-19 Thread [EMAIL PROTECTED]
Could hit a few snags. Quick out-of-the-library compression using standards like zlib will have headers that will dilute the difference on short strings, and on long strings block compression (zlib, bzip2) will not pick up similarities because the similarities will be in different blocks. With bl

Re: newbie file/DB processing

2005-05-19 Thread Mike Meyer
"len" <[EMAIL PROTECTED]> writes: > I am in the process of learning python. I have bought Learning Python > by Mark Lutz, printed a copy of Dive into Python and various other > books and looked at several tutorials. I have started a stupid little > project in python and things are proceeding wel

urllib2 EOF occurred in violation of protocol with proxy

2005-05-19 Thread Bloke
I want to connect to a https server through an authenticating proxy like this: import urllib2 proxy_info = { 'user' : 'me', 'pass' : 'password', 'host' : 'mycompany.com.au', 'port' : 8008 } # build a new opener that uses a proxy requiring authorization proxy_support = urllib2.Pr

Re: processing a Very Large file

2005-05-19 Thread Gregory Bond
Mike Meyer wrote: > > Unknown. Python relies on the C alloc/free routines for handling > memory. del may immediately free() the memory (I don't know), but that > doesn't mean it gets released to the OS. None of the implementations > of alloc/free I'm aware of ever give the memory back to the OS.

Re: urllib2 EOF occurred in violation of protocol with proxy

2005-05-19 Thread Paul Rubin
"Bloke" <[EMAIL PROTECTED]> writes: > The site works fine if I do not go through the proxy, so it appears the > proxy is not returning an EOF. I been searching for an answer, and > found many other sites where people have had the same problem. Some > have suggested m2crypto. > > Is there a work

Re: soundcard readout on a windows system

2005-05-19 Thread Roger Upole
Take a look at the directsound module from Pywin32. I haven't used it myself, but it may be able to do what you need. Roger "Jan Wienhausen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I would like to read out the soundcard with python on a win system. Is > there

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

2005-05-19 Thread Fredrik Lundh
"Steve M" <[EMAIL PROTECTED]> wrote > http://mail.python.org/pipermail/python-dev/2005-January/051255.html > > discusses the problem with memory allocation in CPython. Apparently > CPython is not good at, or incapable of, releasing memory back to the > operating system. and unless your operating

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

2005-05-19 Thread bruno modulix
Ivan Van Laningham wrote: (snip) > > What you're going to run into are two major stumbling blocks. One, > Python's got no credibility with management types unless the > credibility's already there. "Python? Never heard of it. Tell me > about it. ... Oh, it's interpreted, is it? Interestin

Re: EpyDoc problem

2005-05-19 Thread Laszlo Zsolt Nagy
>EpyDoc is hosted in Sourceforge. This alone may answer your question >about a bug-tracker: > >http://sourceforge.net/tracker/?atid=405618&group_id=32455&func=browse > > Well, I wrote to the bug tracker some days ago but no answer so far. -- http://mail.python.org/mailman/listinfo/python-list

Re: logging problems

2005-05-19 Thread [EMAIL PROTECTED]
I thought I did, but when I checked today it seems I've screwed up and edited logging/__init__.py in 2.4 and tested with 2.3 So after fixing it in the correct place, it works nicely.. -- http://mail.python.org/mailman/listinfo/python-list

Re: self-promotion of the decorator module

2005-05-19 Thread Duncan Booth
Michele Simionato wrote: > with the following advantages: > > 1. one-level of nesting is saved ("flat is better than nested") > 2. name, docstring and dictionary of the original function are > preserved; > 3. the signature of the original function is preserved (this one is > nontrivial). >

Re: How to learn OO of python?

2005-05-19 Thread could ildg
Steven Bethard: Thank you so much! Your answer is very very helpful~ On 5/19/05, Steven Bethard <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I think decorator is a function which return a function, is this right? > > e.g. The decorator below if from > > http://www.python.org/peps/pep-0318.h

Re: What's the use of changing func_name?

2005-05-19 Thread could ildg
Thanks to Robert Kern. You mean that though we can change the func_name of a function, but we still can't call it by func_name, and the func_name is only useful in some other circumstances? I also think so now after I have tried so many times on this puzzled func_name property. On 5/19/05, Robert K

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

2005-05-19 Thread Fredrik Lundh
Paul Rubin wrote: > 2) If you want to display a gif image in tkinter, you can make a > frame object, put a canvas in it, and put a PhotoImage object > onto the canvas, which works fine. But if you use your own > subclass of frame (maybe to add your own gui stuff), for some >

datetime

2005-05-19 Thread Nader Emami
L.S., It is very simple question: Why doesn't work the next statments? import datetime today = datetime.date.today() and I get the next error: today = datetime.date.today() Traceback (most recent call last): File "", line 1, in ? AttributeError: time I can't understand it! -- http://mail.

Re: How to learn OO of python?

2005-05-19 Thread Mike Meyer
"Harlin Seritt" <[EMAIL PROTECTED]> writes: > I think I know what you mean. When I first started trying to learn the > OOP aspect of Python I thought it was strange since I had started with > OOP on Java and C++. Nonetheless, once you get the hang of it, OOP will > make way more sense than all of t

Re: datetime

2005-05-19 Thread Mike Meyer
Nader Emami <[EMAIL PROTECTED]> writes: > L.S., > > It is very simple question: Why doesn't work the next statments? > > import datetime > > today = datetime.date.today() > > and I get the next error: > > today = datetime.date.today() > Traceback (most recent call last): >File "", line 1, in ?

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

2005-05-19 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > did you read the PhotoImage documentation? see e.g. the note at the > bottom of this page: > > http://effbot.org/zone/tkinter-photoimage.htm Thanks! I hadn't seen that. It explains what otherwise seemed completely bizarre. > (this used to be e

Re: [pysqlite] pysqlite2.dbapi2.OperationalError: cannot commit transaction - SQL statements in progress

2005-05-19 Thread Gerhard Haering
On Wed, May 18, 2005 at 09:41:39PM +0200, F. GEIGER wrote: > I've troubles to let my app take off using pysqlite. > > What I wonder most for now is that "pysqlite2.dbapi2.OperationalError: > cannot commit transaction - SQL statements in progress" when I do this: > Urgh! I would have preferred si

Re: datetime

2005-05-19 Thread Mage
Nader Emami wrote: >L.S., > >It is very simple question: Why doesn't work the next statments? > >import datetime > >today = datetime.date.today() > > > Works on python 2.3.5 Mage -- http://mail.python.org/mailman/listinfo/python-list

Re: Markov chain with extras?

2005-05-19 Thread Max M
[EMAIL PROTECTED] wrote: I want to use it for music. So given list 1 (melody), list 2 (chords) could be generated by a Markov chain. Also, given the chords the melody could be generated again by a chain. I have this small module, that can be used for markov chains. -- hilsen/regards Max M, Denmark

Re: datetime

2005-05-19 Thread Sakesun Roykiattisak
> >Why doesn't work the next statments? > > You talk like Yoda.. >import datetime > >today = datetime.date.today() > >and I get the next error: > >today = datetime.date.today() >Traceback (most recent call last): > File "", line 1, in ? >AttributeError: time > >I can't understand it! > > U

Re: help with generators

2005-05-19 Thread George Sakkis
"Steven Bethard" wrote: > It would help if you explained what you expected. But here's code that > prints about the same as your non-generator function. > > py> def bin(n): > ... s = [] > ... def bin(n): > ... if n == 0: > ... yield s > ... else: > ...

What's the difference between str and 'hello' ?

2005-05-19 Thread hong Yu
I am new to python. I was confused: >>> a = list('hello') >>> a ['h', 'e', 'l', 'l', 'o'] I want to combine the items in the list into a string. So: >>> ''.join(a) 'hello' but: >>> str.join(a) Traceback (most recent call last): File "", line 1, in ? TypeError: descriptor 'join' requires a

Re: wxpython and wxtextctrl

2005-05-19 Thread Nicolas Pourcelot
Ok, as I guessed, it was Boa installation which changed the wxpython version used. I removed Boa... Thanks ! Nicolas Greg Krohn a écrit : > Nicolas Pourcelot wrote: > >> Hello, >> my script worked well until today : when I tried to launch it, I got >> the following : >> >> frame = MyFrame(N

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
Notice that the decorator module is at version 0.4 and I still consider it as experimental. The reason why I posted the link here is to get feedback and it seems I got it ;) I will upgrade to version 0.5 shortly, fixing the easily fixable bugs and documenting what cannot be easily fixed. Thanks f

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

2005-05-19 Thread Paul Rubin
Paul Rubin writes: > ... Do you think you > could mention it in your Tkinter doc? That would be a logical place > for it. Ehhh, specifically I meant it would be good to mention this in the PhotoImage example in Chapter 16 of "An Introduction to Tkinter" (The Canvas Ima

Re: datetime

2005-05-19 Thread Nader
I have the next on my machine: Python 2.3.3 (#1, Apr 6 2004, 01:47:39) [GCC 3.3.3 (SuSE Linux)] on linux2 Maybe this is a problem! Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the difference between str and 'hello' ?

2005-05-19 Thread Heiko Wundram
Am Donnerstag, 19. Mai 2005 11:27 schrieb hong Yu: > >>> str.join(a) > > Traceback (most recent call last): > File "", line 1, in ? > TypeError: descriptor 'join' requires a 'str' object but received a 'list' > > What's the difference between str and 'hello' ? str.join("",a) <=> "".join(a) (<=>

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

2005-05-19 Thread Magnus Lycka
john67 wrote: > The company I work for is about to embark on developing a commercial > application that will cost us tens-of-millions to develop. When all is > said and done it will have thousands of business objects/classes, Ok, that sounds like a big app, but does it really have to be like tha

Re: What's the difference between str and 'hello' ?

2005-05-19 Thread paulC
hong Yu wrote: > I am new to python. > I was confused: > > >>> a = list('hello') > > >>> a > ['h', 'e', 'l', 'l', 'o'] > > I want to combine the items in the list into a string. > So: > > >>> ''.join(a) > 'hello' > > but: > > >>> str.join(a) > Traceback (most recent call last): > File "", line 1

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

2005-05-19 Thread Ville Vainio
> "brian" == brian <[EMAIL PROTECTED]> writes: brian> to build expertise and confidence, etc. People are more brian> important than programming language. Or so you would think before writing sizeable software in C++. -- Ville Vainio http://tinyurl.com/2prnb -- http://mail.pytho

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
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 extremely unlikely to clash with any ide

Re: newbie file/DB processing

2005-05-19 Thread Magnus Lycka
len wrote: > 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 at > datafiles and I haven't really gotten my brain aro

ldaptor based LDAP server

2005-05-19 Thread Andy Leszczynski
Hi, I am looking for a Python barebones for a simple LDAP server project. It does not have to be Twisted based, but it would be wonderful if it is. I need a very simple server which is listening on some port and accepts following LDAP messages: -bind -search -unbind There a

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

2005-05-19 Thread Maurice LING
> >> You can >>see Python going down the sewer pipes, right on their faces. Two, >>security. "This python sounds pretty interesting. Tell me about the >>security. How can we prevent people from stealing our source code, >>which we just spent millions developing? ... Hmm, trust the developer

Re: Byte-operations.

2005-05-19 Thread Jeff Epler
In Python, "chr" gives a 1-byte string from a small integer, "ord" does the reverse. Strings are concatenated with "+" and substrings are taken with the slice operator, s[pos1:pos2]. I'm not a visual basic expert, but it looks like these are the operations the code below performs. Jeff pgpWpqb

Re: import cx_Oracle fails!

2005-05-19 Thread Paul D. Lusk
"Daniel" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hello from Brazil :-) > > I'm trying to bring cx_Oracle alive on my Python 2.4.1 @ HP-UX 11 > (suckz) and Oracle 10.1.0 64bits without success > > I've already tryied the suggestions from Bernard Delmée and Martin v. > Löwis (topic

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

2005-05-19 Thread Ellinghaus, Lance
That is why you can distribute only the .pyc files and not the .py files. This would be like distributing the .class files and not giving out the .java files. I had this issue at a company in the late 1980's and why I submitted the patches to make Python not require the .py files if the .pyc files

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

2005-05-19 Thread Roy Smith
"George Sakkis" <[EMAIL PROTECTED]> wrote: > Another issue that hasn't been mentioned so far is staffing. You can > find java programmers and software engineers a dime dozen, but for > python it will be harder. Yes, there are a lot more people out there who put Java on their resume than put Pytho

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

2005-05-19 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, vincent wehren <[EMAIL PROTECTED]> wrote: . . . >If the application is really huge, you should consider using >a set of programming languages that do the particular job best. >That is, go for a c

Re: Comparing 2 similar strings?

2005-05-19 Thread Chris Croughton
On Thu, 19 May 2005 06:38:59 +1000, John Machin <[EMAIL PROTECTED]> wrote: > On Wed, 18 May 2005 15:06:53 -0500, Ed Morton <[EMAIL PROTECTED]> > wrote: > >>William Park wrote: >> >>> How do you compare 2 strings, and determine how much they are "close" to >>> each other? Eg. >>> aqwerty

Re: Python forum

2005-05-19 Thread Peter Hansen
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"? -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for bored python newbies

2005-05-19 Thread CPUFreak91
Never mind this was a stupid question -- http://mail.python.org/mailman/listinfo/python-list

[no subject]

2005-05-19 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1636 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!newsfeeder.wxs.nl!textfeed1.on.meganewsservers.com!meganewsservers.com!feeder2.on.meganewsservers.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!

[no subject]

2005-05-19 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2056 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!fi.sn.net!newsfeed2.fi.sn.net!newsfeed3.funet.fi!newsfeed1.funet.fi!newsfeeds.funet.fi!newsfeed1.swip.net!swipnet!nntp.abs.net!attws2!ip.a

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

2005-05-19 Thread Peter Hansen
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 I pick it up, to pick-pocketi

Re: Python forum

2005-05-19 Thread Ivan Van Laningham
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 appreciate the sentiment, but "Yahoo" is neither

Re: socket programming and port scans

2005-05-19 Thread Peter Hansen
rbt wrote: > I don't fully understand sockets, I just know enough to be dangerous. > The below is not detected by nmap, but is affected by iptables or ipsec. > Can anyone explain why that is? > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > s.bind((ip_param, port_param)) >

Re: newbie file/DB processing

2005-05-19 Thread len
Thanks for the reply. I just read your response and will be taking your suggestion immediatly Len Sumnler -- http://mail.python.org/mailman/listinfo/python-list

ssl issues with socket timeout

2005-05-19 Thread Tarek Ziadé
Hello, anyone knows a way to deal with this problem ? http://sourceforge.net/tracker/index.php?func=detail&aid=1153016&group_id=5470&atid=105470 This bug has been fixed in 2.3 but there is a regression in 2.4 Tarek -- Tarek ZIADE, Nuxeo SARL: Zope Service Provider. Mail: [EMAIL PROTECTED] -

Convert from numbers to letters

2005-05-19 Thread rh0dium
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, c=3 ... z=26 aa=27 ab=28 etc.. Thanks -- http://mail.python.org/mailman/listinfo/p

Re: newbie file/DB processing

2005-05-19 Thread len
Thanks for the reply I think you might be right. I have been playing around with Linux at home. What I may have to do in switch my mindset from IBM/Microsoft to a more Unix way of thinking. Also thanks for the code samples. Len Sumnler -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie file/DB processing

2005-05-19 Thread len
Thanks for the reply Everyone seems to be saying the same thing which is jump into some RDBM. Len Sumnler -- http://mail.python.org/mailman/listinfo/python-list

Re: help with generators

2005-05-19 Thread Mayer
Thanks a lot! This clarified [I think] my misunderstanding about yield, and I also learned something about efficiency from George's code -- Thanks. So, The function tel(aString) takes a string (or a number) that denote a phone number, using digits or letters, and returns a generator for the set of

Re: help with generators

2005-05-19 Thread Steven Bethard
George Sakkis wrote: > "Steven Bethard" wrote: > >>py> def bin(n): >>... s = [] >>... def bin(n): >>... if n == 0: >>... yield s >>... else: >>... s.append(0) >>... for s1 in bin(n - 1): >>... yield s1 >>... s.p

Re: Convert from numbers to letters

2005-05-19 Thread Dan Sommers
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 (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = ra

Re: SSL (HTTPS) with 2.4

2005-05-19 Thread Andrew Bushnell
I am interested in any further progress with this, you may have made? I am facing a similar issue. In short, I need to connect to a https site (in this case a WSDL) that I need to access through an Http proxy. I have tried various things to no avail. I did find a couple recipes on the ASPN pyth

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,

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

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

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

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

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

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

  1   2   >