Re: string.atoi and string.atol broken?

2005-01-26 Thread Peter Otten
Dan Bishop wrote: >> def itoa(n, base): >>assert 2 <= base <= 16 > > Why have the restriction base <= 16?  int() allows up to 36.  All you > need to do is > > BASE36_DIGITS = string.digits + string.lowercase For no other reason than carelessness. I have not yet seen anything beyond base-16 in t

Re: python without OO

2005-01-26 Thread Alex Martelli
Davor <[EMAIL PROTECTED]> wrote: > no one ever had to document structured patterns - which definitely > exist - but seem to be obvious enough that there is no need to write a > book about them... You _gotta_ be kidding -- what do you think, e.g., Wirth's "Algorithms plus Data Structures Equals Pr

Re: script to search ebay?

2005-01-26 Thread Lance Hoffmeyer
Thanks for the script. I haven't been on ebay for a while. Wasn't aware of the Favorite searches. Favorite Search is probably the way to go. Thanks for the info. Lance On Tue, 25 Jan 2005 22:57:54 -0800, Kamilche wrote: > This script works. But why not make a 'Favorite Search' in ebay, and >

Re: is there better 32 clock() timing?

2005-01-26 Thread Bengt Richter
On Tue, 25 Jan 2005 15:46:30 +, Stephen Kellett <[EMAIL PROTECTED]> wrote: >In message <[EMAIL PROTECTED]>, Bengt Richter ><[EMAIL PROTECTED]> writes >>I believe that is quite wrong as a general statement. > >Actually my initial statement should have been written >"accessing a resource, the a

Re: string.atoi and string.atol broken?

2005-01-26 Thread Peter Otten
Nick Coghlan wrote: > Huh - you remind me that I forgot to put the "show_base" Bengt and I came > up with into the ASPN cookbook. . . > > Py> def show_base(val, base, min_digits=1, complement=False, > ...   digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"): > ...   if base > len(digits):

Re: snakespell and myspell

2005-01-26 Thread Fuzzyman
Jarek Zgoda wrote: > Fuzzyman wrote: > > > I'm looking to implement a plugin spell checker. > > > > I'm probably going to go with PyEnchant, as it looks to be the most > > promising currently maintained spell checker. > > > > I just wondered if anyone knew what happened to snakespell and myspell.

Re: py2exe problem

2005-01-26 Thread Harald Massa
Grant Edwards > LookupError: no codec search functions registered: can't find encoding > Googling for the error message will find you the answer. http://starship.python.net/crew/theller/moin.cgi/Py2Exe carries within "encodings" and "encodings again" receipes to get it working. A software d

Re: Maximum Number of Class Attributes

2005-01-26 Thread Sylvain Thenault
On Wed, 26 Jan 2005 02:03:12 +, Bob Parnes wrote: > In its default configuration, my version of pylint (0.5.0) sets the > maximum number of class attributes at 7. This seems low to me, but I can > see how an excessive number might make maintenance more difficult. Is this > indeed the best valu

Re: need help on generator... (re)

2005-01-26 Thread Peter Otten
Joh wrote: >> def gen(iterable, start, end): >>it = iter(iterable) >>while True: >>it, a = tee(it) >>a = tuple(islice(a, end-1)) >>for sz in xrange(start, len(a)+1): >>yield a[:sz] >>it.next() >> >> if __name__ == "__main__": >>print list(gen(range(1, 5), 2, 4)) > > please, this one looks interes

Re: MySQLdb

2005-01-26 Thread Daniel Bowett
Dennis Lee Bieber wrote: On Tue, 25 Jan 2005 20:43:54 +, Daniel Bowett <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: As a test I have written a script that executes 3000 insert statements on a table. The table contains 10 fields with a mix of text and numbers - its a produ

Re: Help! Host is reluctant to install Python

2005-01-26 Thread Premshree Pillai
There are quite a few hosts who offer Python support, no? Maybe you could change hosts. Pair offers Python, AFAIK. On Tue, 25 Jan 2005 13:15:45 -0500, Daniel Bickett <[EMAIL PROTECTED]> wrote: > I've been trying to convince my host to install python/mod_python on > his server for a while now, how

Re: how to ncurses on win32 platform

2005-01-26 Thread Josef Meile
Hi Brane, I was wondering about the same thing some days ago. I found the following alternatives: * Curses for Windows for Python (It was previously mentioned on a follow-up. there are some missing features): http://flangy.com/dev/python/curses/ * PDCurses (It looks promissing): http://pdcurses.sou

Re: python without OO

2005-01-26 Thread Claudio Grondi
I can't resist to point here to the Re: How to input one char at a time from stdin? posting in this newsgroup to demonstrate, what this thread is about. Claudio > >On Tue, 25 Jan 2005 12:38:13 -0700, Brent W. Hughes > ><[EMAIL PROTECTED]> wrote: > >> I'd like to get a character from stdin, perf

Re: how to write a tutorial

2005-01-26 Thread Keith Thompson
"Xah Lee" <[EMAIL PROTECTED]> writes: [snip] > Following is a tutorial on Python's classes. [snip] Please stop posting this to comp.lang.c. I'm sure the folks in most of the other newsgroup aren't interested either -- or if they are, they can find it in comp.lang.python. Followups redirected. -

Re: how to write a tutorial

2005-01-26 Thread Charlton Wilbur
> "XL" == Xah Lee <[EMAIL PROTECTED]> writes: XL> I've used the Python tutorial's chapter on class as XL> an example. I've indicated that proper tutorial should be XL> simple, covering just common cases, be self-contained, and be XL> example based. "Correct" is not in your li

Re: Tuple slices

2005-01-26 Thread jfj
Jeff Shannon wrote: So, what problem is it, exactly, that you think you'd solve by making tuple slices a view rather than a copy? I think views are good for 1) saving memory 2) saving time (as you don't have to copy the elements into the new tuple) And they are worth it. However, (as in other

Re: Python with no significant whitespace

2005-01-26 Thread Jeremy Sanders
On Wed, 26 Jan 2005 11:31:18 +0800, mep wrote: > Hi,all > Is there anybody trying to release a modification version to current > python source code with no significant whitespace, say replacing whitespace > by {} > like C or java. I do *NOT* mean whitespace is good or bad, just > want to know.

RELEASED Python 2.3.5, release candidate 1

2005-01-26 Thread Anthony Baxter
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.3.5 (release candidate 1). Python 2.3.5 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for details of the bugs squi

Re: python without OO

2005-01-26 Thread Fuzzyman
It's perfectly possible to write good python code without using classes. (and using functions/normal control flow). You will have a problem with terrminology though - in python everything is an object (more or less). Common operations use attributes and methods of standard objects. For example :

Re: Tuple slices

2005-01-26 Thread Bengt Richter
On Tue, 25 Jan 2005 19:25:55 -0500, "George Sakkis" <[EMAIL PROTECTED]> wrote: >"Jeff Shannon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> George Sakkis wrote: >> >> > An iterator is perfectly ok if all you want is to iterate over the >> > elements of a view, but as you noted, i

Re: MySQLdb

2005-01-26 Thread nobody
> How many indices? Just the primary key (id). -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe problem

2005-01-26 Thread Thomas Heller
Harald Massa <[EMAIL PROTECTED]> writes: > Grant Edwards > >> LookupError: no codec search functions registered: can't find encoding >> Googling for the error message will find you the answer. > > http://starship.python.net/crew/theller/moin.cgi/Py2Exe > > carries within "encodings" and "encodi

"pickle" vs. f.write()

2005-01-26 Thread Johan Kohler
Hi, I have a class with attributes that are string, integer and list. eg. class person: name ="" age = 0 friends=[] comment="" me = person() I want to save a whole bunch of instances to a file, a classic "records" file I/O. To write the file, I can do f.write

Re: python without OO

2005-01-26 Thread Premshree Pillai
On 25 Jan 2005 13:49:48 -0800, Davor <[EMAIL PROTECTED]> wrote: > Is it possible to write purely procedural code in Python, or the OO > constructs in both language and supporting libraries have got so > embedded that it's impossible to avoid them? Also, is anyone aware of > any scripting language t

Re: MySQLdb

2005-01-26 Thread Daniel Bowett
Daniel Bowett wrote: I have just started playing around with MySQLdb for a project I am planning. As a test I have written a script that executes 3000 insert statements on a table. The table contains 10 fields with a mix of text and numbers - its a product table for a website eg UPC, ProductNam

Re: building Python: up arrow broken on SuSE Linux 8.2

2005-01-26 Thread Peter Maas
Erik Johnson schrieb: I am trying to upgrade my Python installation. After downloading sources and building Python 2.3.4, I am unable to use the command history editing feature in the interactive interpreter (where the up-arrow would previously give you the last command line to edit, it now jus

Re: python without OO

2005-01-26 Thread Miki Tebeka
Hello Davor, > Also, is anyone aware of any scripting language that could be considered > as "Python minus OO stuff"? Maybe Lisp (http://clisp.cons.org/, http://www.paulgraham.com/onlisp.html) or Scheme (http://www.plt-scheme.org/software/mzscheme/, http://mitpress.mit.edu/sicp/full-text/book/boo

Re: Tuple slices

2005-01-26 Thread Bengt Richter
On Wed, 26 Jan 2005 11:55:59 -0800, jfj <[EMAIL PROTECTED]> wrote: >Jeff Shannon wrote: > >> >> >> So, what problem is it, exactly, that you think you'd solve by making >> tuple slices a view rather than a copy? >> > >I think views are good for > 1) saving memory > 2) saving time (as you don

Re: re Insanity

2005-01-26 Thread Tim Daneliuk
Aahz wrote: In article <[EMAIL PROTECTED]>, Tim Daneliuk <[EMAIL PROTECTED]> wrote: Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried this: y=re.compile(r'\[PROMPT:.*\]') Which works fine when the text is exactly "[PROMPT:w

Re: string.atoi and string.atol broken?

2005-01-26 Thread TZOTZIOY
On Wed, 26 Jan 2005 08:58:45 +0100, rumours say that Peter Otten <[EMAIL PROTECTED]> might have written: >By the way, does anyone know the Greek name for 36? triakontahexadecimal would be a nice compromise of greek and the "hexadecimal" convention of having six before ten -- "ÎÎÎ" ("hexi") is six

Re: python without OO

2005-01-26 Thread Neil Benn
Davor wrote: Is it possible to write purely procedural code in Python, or the OO constructs in both language and supporting libraries have got so embedded that it's impossible to avoid them? Also, is anyone aware of any scripting language that could be considered as "Python minus OO stuff"? (As you

Re: Tuple slices

2005-01-26 Thread Nick Coghlan
jfj wrote: Jeff Shannon wrote: So, what problem is it, exactly, that you think you'd solve by making tuple slices a view rather than a copy? I think views are good for 1) saving memory 2) saving time (as you don't have to copy the elements into the new tuple) 1. Applies only if you are making

Re: string.atoi and string.atol broken?

2005-01-26 Thread TZOTZIOY
On Wed, 26 Jan 2005 02:10:44 +0100, rumours say that "Fredrik Lundh" <[EMAIL PROTECTED]> might have written: >Mike Moum wrote: >> s.atoi('4',3) should result in 11 >> >> s.atoi('13',4) should result in 31 >> >> s.atoi('12',4) should result in 30 >> >> s.atoi('8',4) is legitimate, but it generates

Re: string.atoi and string.atol broken?

2005-01-26 Thread Peter Otten
Peter Otten wrote: > def itoa(n, base): > assert 2 <= base <= 16 > if n < 0: > digits = ["-"] > n = -n > else: > digits = [] > while n: > n, m = divmod(n, base) > digits.append(string.hexdigits[m]) > digits.r

Re: string.atoi and string.atol broken?

2005-01-26 Thread Peter Otten
Christos TZOTZIOY Georgiou wrote: > On Wed, 26 Jan 2005 08:58:45 +0100, rumours say that Peter Otten > <[EMAIL PROTECTED]> might have written: > >>By the way, does anyone know the Greek name for 36? > > triakontahexadecimal would be a nice compromise of greek and the > "hexadecimal" convention o

Re: Tuple slices

2005-01-26 Thread Nick Coghlan
jfj wrote: Actually, i think that slices with step, is a bad feature in general and i think I will write a PEP to suggest their removal in python3k. I wouldn't bother. Extended slicing was added to support those doing serious numerical work in Python, and it won't get removed for all the reasons i

wx.Image: Couldn't add an image to the image list.

2005-01-26 Thread Laszlo Zsolt Nagy
I would like to load image from a directory right into an image list. I wrote a simple library that loads the images in the directory and resizes them as needed before adding to the wx.ImageList. This is not the same code but some snippets. I resize the image this way (using Python Imaging Library)

Re: threading.py Condition wait overflow error

2005-01-26 Thread Mark English
> Date: Wed, 26 Jan 2005 00:10:31 -0500 > From: Tim Peters <[EMAIL PROTECTED]> > The most common cause for "impossible exceptions" > is flawed C code in an extension that fails to > check a Python C API call for an error return. Yes, I use a lot of C modules which I wrote. It could certainly be on

Re: Question: "load"ing a shared object in python

2005-01-26 Thread Simon Brunning
On Tue, 25 Jan 2005 23:19:01 +0200, Pro Grammer <[EMAIL PROTECTED]> wrote: > Hello, all, > I am not sure if this is the right place to ask, but could you kindly > tell me how to "load" a shared object (like libx.so) into python, so > that the methods in the .so can be used? That too, given that the

Re: "pickle" vs. f.write()

2005-01-26 Thread Peter Maas
Johan Kohler schrieb: class person: name ="" age = 0 friends=[] comment="" me = person() Otherwise, what is the best "Python" way to write and read this data structure? import pickle class person: name ="" age = 0 friends=[] comment="" me = person() # store

Re: add indexes on the fly to lists

2005-01-26 Thread Diez B. Roggisch
> If you want only "search and found" element, look dictionnary ; if you > want also to have the order, see the module set. Erg - no. Sets are mathematically defined as having no order. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: string.atoi and string.atol broken?

2005-01-26 Thread Fredrik Lundh
Christos TZOTZIOY Georgiou wrote: >>the function's named "atoi", not "atoitoa". > > cool. can I have a copy of your script? reminds me that I have a few patches in the inqueue. I wonder what this one does? ;-) hmm ;-) guess I can tune that later ;-) and what about that other patch? ;-) let

Re: OT

2005-01-26 Thread Diez B. Roggisch
> However, i know for a fact that phr is _not_ a user at > sextans.lowell.edu. > > Is this a problem with my dns? Most probably - he shows up as [EMAIL PROTECTED] for me. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: OT

2005-01-26 Thread phr
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > Is this a problem with my dns? > > Most probably - he shows up as [EMAIL PROTECTED] for me. It's my news client configuration. Normally I post from a different machine but that one is temporarily down. I haven't bothered to configure this one p

FTP Server

2005-01-26 Thread michele . simionato
What's the simplest way to write an FTP Server in Python? A short research on the newsgroup and on the Cookbook did not bring out anything relevant (but I hear a little voice in the back of my head saying Twisted, Twisted! ...) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-l

Re: execute python code from db

2005-01-26 Thread Laszlo Zsolt Nagy
robert wrote: Hello, Anybody knows if it's possible to execute python code from an db. db=MySQLdb.connect(host="localhost",user="r",passwd="j",db="v") c=db.cursor() c.execute("""SELECT * FROM table WHERE id = %s""", (id,)) for python_code in c.fetchall(): execute (python_code) Maybe f

Re: execute python code from db

2005-01-26 Thread Damjan
> for python_code in c.fetchall(): > execute (python_code) > > Maybe feed python with stdin??. eval -- damjan -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-26 Thread Peter Maas
Davor schrieb: so initially I was hoping this is all what Python is about, but when I started looking into it it has a huge amount of additional (mainly OO) stuff which makes it in my view quite bloated now. So you think f.write('Hello world') is bloated and file_write(f,'Hello world') is not? T

Re: FTP Server

2005-01-26 Thread John Abel
[EMAIL PROTECTED] wrote: If you're after a simple FTP server, have a look at medusa. Uhm ... Medusa does not seem actively maintained nowadays. M.S. AFAIK, it's maintained to the extent, that if you find bugs/enhance it and let the medusa-dev list know, it more than likely will get fi

Re: HAVE YOU HEARD THE GOOD NEWS!

2005-01-26 Thread StvB
I felt very evil after trying to figure out why my py program wouldn't work when I began a year ago: I do Delphi at work, and at home I was missing the () after the functions. I was ready to sell my sou.. well nevermind.. it's all good now. <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTE

Re: is there better 32 clock() timing?

2005-01-26 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Bengt Richter <[EMAIL PROTECTED]> writes >>QueryPerformanceCounter is 47 times slower to call than clock() on my >>1Ghz Athlon. >That really makes me wonder. Perhaps the Athlon handles RDTSC by way of >an illegal instruction trap and faking the pentium instruction?

Re: FTP Server

2005-01-26 Thread John Abel
If you're after a simple FTP server, have a look at medusa. Regards John [EMAIL PROTECTED] wrote: What's the simplest way to write an FTP Server in Python? A short research on the newsgroup and on the Cookbook did not bring out anything relevant (but I hear a little voice in the back of my head say

execute python code from db

2005-01-26 Thread robert
Hello, Anybody knows if it's possible to execute python code from an db. db=MySQLdb.connect(host="localhost",user="r",passwd="j",db="v") c=db.cursor() c.execute("""SELECT * FROM table WHERE id = %s""", (id,)) for python_code in c.fetchall(): execute (python_code) Maybe feed pyt

4suite XSLT thread safe ?

2005-01-26 Thread Ola Natvig
Anybody out there who knows if the 4suite implementation of XSLT are a threadsafe one? -- -- Ola Natvig <[EMAIL PROTECTED]> infoSense AS / development -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP Server

2005-01-26 Thread michele . simionato
Do you have a code snippet/pointer so I have an idea of how to use it? M.S. -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP Server

2005-01-26 Thread michele . simionato
> If you're after a simple FTP server, have a look at medusa. Uhm ... Medusa does not seem actively maintained nowadays. M.S. -- http://mail.python.org/mailman/listinfo/python-list

Re: execute python code from db

2005-01-26 Thread Nick Coghlan
robert wrote: Hello, Anybody knows if it's possible to execute python code from an db. db=MySQLdb.connect(host="localhost",user="r",passwd="j",db="v") c=db.cursor() c.execute("""SELECT * FROM table WHERE id = %s""", (id,)) for python_code in c.fetchall(): execute (python_code) Maybe

Re: "pickle" vs. f.write()

2005-01-26 Thread Johan Kohler
Thanks... works like a charm :-) On Wed, 26 Jan 2005 12:55:38 +0100, Peter Maas <[EMAIL PROTECTED]> wrote: Johan Kohler schrieb: class person: name ="" age = 0 friends=[] comment="" me = person() Otherwise, what is the best "Python" way to write and read this data structure

PyCon: Early Bird Deadline two days away [really]!

2005-01-26 Thread Steve Holden
Pythonistas: If you have been putting off your registration, stop putting it off! Last year the early bird deadline was extended because we were a little late getting the program together. This year the program was published two weeks in advance of the deadline for early bird registrations, which

Freeze with wxpython on python 2.3 or python 2.4 on Win32 with Thread

2005-01-26 Thread Tsubasa[Hokage]
first problem: With Idle environnement under Win32, all freeze after with bunch of code: #!/usr/bin/python import threading,time class T (threading.Thread) : def __init__(self,_a,_b) : threading.Thread.__init__(self) self.a = _a self.b = _b def run(self) :

Re: 4suite XSLT thread safe ?

2005-01-26 Thread Diez B. Roggisch
Ola Natvig wrote: > Anybody out there who knows if the 4suite implementation of XSLT are a > threadsafe one? What do you mean by that? You can of course transform xml using xslt in as many threads as you like - but what do you want with two or more threads in _one_ transformation? You start it, a

fast list lookup

2005-01-26 Thread Klaus Neuner
Hello, what is the fastest way to determine whether list l (with len(l)>3) contains a certain element? Klaus -- http://mail.python.org/mailman/listinfo/python-list

Re: fast list lookup

2005-01-26 Thread Simon Brunning
On Wed, 26 Jan 2005 06:45:29 -0800 (PST), Klaus Neuner <[EMAIL PROTECTED]> wrote: > what is the fastest way to determine whether list l (with > len(l)>3) contains a certain element? If the list isn't sorted, I doubt you'll do better than if an_element in my_list: # do whatever If the lis

Re: 4suite XSLT thread safe ?

2005-01-26 Thread Istvan Albert
Diez B. Roggisch wrote: What do you mean by that? You can of course transform xml using xslt in as many threads as you like It is not unthinkable that some parts of the library would not be threadsafe. They could have some internal shared global variable that keeps track of an intermediate state.

Re: 4suite XSLT thread safe ?

2005-01-26 Thread Ola Natvig
Diez B. Roggisch wrote: Ola Natvig wrote: Anybody out there who knows if the 4suite implementation of XSLT are a threadsafe one? What do you mean by that? You can of course transform xml using xslt in as many threads as you like - but what do you want with two or more threads in _one_ transformat

Re: fast list lookup

2005-01-26 Thread Alex Martelli
Klaus Neuner <[EMAIL PROTECTED]> wrote: > what is the fastest way to determine whether list l (with > len(l)>3) contains a certain element? "if thecertainelement in l:" is the fastest way unless there are properties of l which you're not telling us about, or unless what you need is not just

Re: 4suite XSLT thread safe ?

2005-01-26 Thread Ola Natvig
Istvan Albert wrote: Diez B. Roggisch wrote: What do you mean by that? You can of course transform xml using xslt in as many threads as you like It is not unthinkable that some parts of the library would not be threadsafe. They could have some internal shared global variable that keeps track of

Re: 4suite XSLT thread safe ?

2005-01-26 Thread Diez B. Roggisch
> It is not unthinkable that some parts of the library would not be > threadsafe. They could have some internal shared global variable > that keeps track of an intermediate state. > Some C string processing functions are not thread safe either. While the only one how can answer this is Uche himsel

Re: fast list lookup

2005-01-26 Thread Marco Aschwanden
what is the fastest way to determine whether list l (with len(l)>3) contains a certain element? Either a sorted list (in conjunction with the bisect-module) or a dictionary is your friend... Regards, Marco -- http://mail.python.org/mailman/listinfo/python-list

Re: fast list lookup

2005-01-26 Thread Kent Johnson
Klaus Neuner wrote: Hello, what is the fastest way to determine whether list l (with len(l)>3) contains a certain element? If you can use a set or dict instead of a list this test will be much faster. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: 4suite XSLT thread safe ?

2005-01-26 Thread Diez B. Roggisch
> If a thread that are using a XSLT processor looses the GIL within the > transformation process and another one starts processing on the same > processor will this work? > > Will the half-way finished thread be in the way of the one starting the > processing before the stoped thread are done. >

Sorry for the multiple posts !!

2005-01-26 Thread Jose Rivera
My broswser stoped working when I posted, and I tought it didn't work, so I tried a more times until did not report an error. Bye -- http://mail.python.org/mailman/listinfo/python-list

Re: 4suite XSLT thread safe ?

2005-01-26 Thread Diez B. Roggisch
> While the only one how can answer this is Uche himself, I'm confident that > this is not the case - modern OO-style apis associate state usually on a > per-object base. And 4suite is heavily OO-styled. I should have added that this means that using a api like 4suite where you can get a processor

Re: is there better 32 clock() timing?

2005-01-26 Thread Peter Hansen
Stephen Kellett wrote: that time.clock() is inaccurate. The problem is that the "time.clock()" statement takes several hundred microseconds to execute. The statement is incorrect. clock() itself isn't slow, but it is accessing a resource, the accuracy of which is no better than 1ms. There are va

detect tk mainloop

2005-01-26 Thread John Hunter
In matplotlib using the tkagg backend, the tk mainloop is started at the end of a python script by issuing a call to a "show" function, which realizes all the created figure windows and the calls Tkinter.mainloop(). This can cause problems if the mainloop was started by another module (eg idle).

cookielib and urllib2: thread-safe?

2005-01-26 Thread Alex Hunsley
I'm writing a test script in python for pulling web pages from a web server using urllib2 and cookielib. Since the main thing I am testing is what happens when concurrent requests are made to the web server, I need to make several requests concurrently, which I'll do from different threads in m

Re: smtplib bug with Windows XP

2005-01-26 Thread Peter Hansen
Steve Christensen wrote: In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: thank Peter, elbert, for the suggestions. I hadn't thought of using telnet to try to connect to the SMTP server. and when I do try, telnet can't connect either, at least on port 25. On port 110, it has no problem.

Re: python without OO

2005-01-26 Thread Thomas Bartkus
"Davor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On the other hand, this does beggar for a reason to bother with Python at > > all. It seems you could be happy doing BASH scripts for Linux or DOS batch > > files for Windows. Both are "nice&simple" scripting languages free

Re: Tuple slices

2005-01-26 Thread George Sakkis
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 26 Jan 2005 11:55:59 -0800, jfj <[EMAIL PROTECTED]> wrote: > > >Jeff Shannon wrote: > > > >> > >> > >> So, what problem is it, exactly, that you think you'd solve by making > >> tuple slices a view rather than a c

Re: FTP Server

2005-01-26 Thread Kartic
Michele - Listen to your inner voice :-) If simple is all you want, try twisted. You can use mktap to create a simple ftp server and be ready to serve in a few minutes. And if you are upto it, get buried in the documents and you can customize your ftp server. If you are looking for something sim

access private field in python 2.4

2005-01-26 Thread [EMAIL PROTECTED]
Hello, I'm new to python, How can I access private field in python. thanks -- http://mail.python.org/mailman/listinfo/python-list

re.search - just skip it

2005-01-26 Thread rasdj
Input is this: SET1_S_W CHAR(1) NOT NULL, SET2_S_W CHAR(1) NOT NULL, SET3_S_W CHAR(1) NOT NULL, SET4_S_W CHAR(1) NOT NULL, ; .py says: import re, string, sys s_ora = re.compile('.*S_W.*') lines = open("y.sql").readlines() for i in range(len(lines)): try: if s_ora.search(lines[i]): del lines[i] e

Help With Python

2005-01-26 Thread Judi Keplar
I am currently taking a course to learn Python and was looking for some help. I need to write a Python statement to print a comma- separated repetition of the word, "Spam", written 511 times ("Spam, Spam, … Spam"). Can anybody help me get started? I am completely new to programming! Thanks in

Wow!

2005-01-26 Thread Bernie
That is clever, gives a lot of insight into how the __dict__ == the object. This is somewhat like the solution I am using from the Cookbook, an Empty object copy. This is cleaner and very much more concise. Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: access private field in python 2.4

2005-01-26 Thread Ola Natvig
[EMAIL PROTECTED] wrote: Hello, I'm new to python, How can I access private field in python. thanks In python there realy are not private fields. There are those fields that you start with a double underline (__) theese are translated to ___ Withouth the < and > markers, but there are not good p

Re: re.search - just skip it

2005-01-26 Thread Duncan Booth
wrote: > Input is this: > > SET1_S_W CHAR(1) NOT NULL, > SET2_S_W CHAR(1) NOT NULL, > SET3_S_W CHAR(1) NOT NULL, > SET4_S_W CHAR(1) NOT NULL, > ; > > .py says: > > import re, string, sys > s_ora = re.compile('.*S_W.*') > lines = open("y.sql").readlines() > for i in range(len(lines)): > try: >

Re: Help With Python

2005-01-26 Thread Thomas Guettler
Am Wed, 26 Jan 2005 15:55:28 + schrieb Judi Keplar: > > I am currently taking a course to learn Python and was looking for > some help. I need to write a Python statement to print a comma- > separated repetition of the word, "Spam", written 511 times ("Spam, > Spam, … Spam"). > > Can anyb

Re: Help With Python

2005-01-26 Thread Peter Maas
Judi Keplar schrieb: I am currently taking a course to learn Python and was looking for some help. I need to write a Python statement to print a comma- separated repetition of the word, "Spam", written 511 times ("Spam, Spam, … Spam"). Can anybody help me get started? I am completely new to pr

Re: re.search - just skip it

2005-01-26 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > but output is: > > SET2_S_W CHAR(1) NOT NULL, > SET4_S_W CHAR(1) NOT NULL, > > It should delete every, not every other! for i in range(len(lines)): try: if s_ora.search(lines[i]): del lines[i] except IndexError: ... when you loop over a range,

Re: import hook, overwrite import?

2005-01-26 Thread Kartic
Hi Torsten, If you want to use other methods to import (other than good ole file system), yes, you can create an importer class and register it as an importer module, that import will use to search and import. For example, it is possible to use zip imports (this functionality is already builtin)

Re: limited python virtual machine (WAS: Another scripting language implemented into Python itself?)

2005-01-26 Thread Alexander Schremmer
On Tue, 25 Jan 2005 22:08:01 +0100, I wrote: sys.safecall(func, maxcycles=1000) > could enter the safe mode and call the func. This might be even enhanced like this: >>> import sys >>> sys.safecall(func, maxcycles=1000, allowed_domains=['file-IO', 'net-IO', 'devices', 'gui'

Re: Help With Python

2005-01-26 Thread Simon Brunning
On Wed, 26 Jan 2005 15:55:28 -, Judi Keplar <[EMAIL PROTECTED]> wrote: > I am currently taking a course to learn Python and was looking for > some help. I need to write a Python statement to print a comma- > separated repetition of the word, "Spam", written 511 times ("Spam, > Spam, â Spam").

Re: re.search - just skip it

2005-01-26 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Input is this: SET1_S_W CHAR(1) NOT NULL, SET2_S_W CHAR(1) NOT NULL, SET3_S_W CHAR(1) NOT NULL, SET4_S_W CHAR(1) NOT NULL, ; .py says: import re, string, sys s_ora = re.compile('.*S_W.*') lines = open("y.sql").readlines() for i in range(len(lines)): try: if s_ora.search(lin

Re: Help With Python

2005-01-26 Thread Will McGugan
Judi Keplar wrote: I am currently taking a course to learn Python and was looking for some help. I need to write a Python statement to print a comma- separated repetition of the word, "Spam", written 511 times ("Spam, Spam, … Spam"). Can anybody help me get started? I am completely new to prog

Re: module for 'po' files

2005-01-26 Thread David Fraser
Sara Fwd wrote: Hi all Is there a module for processing & handling '.po' files in python? If you want to do anything beyond standard gettext (which is handled by the gettext module) there's lots of code at translate.sourceforge.net ... David -- http://mail.python.org/mailman/listinfo/python-lis

unknown protocol error when connecting to an server via ssl

2005-01-26 Thread christian_stengel
Hi *, I have just started to learn python and I am having a problem with an python client connecting to a perl server using ssl (I tried this with pyOpenSSL and with the build in SSL Module). I don't want to check a cerificate, so i simply tried a from OpenSSL import SSL s = socket.socket(so

Re: Help With Python

2005-01-26 Thread Will McGugan
>>> print "Spam, " * 510 + "Spam" Or if you have 2.4.. >>> print ", ".join( "Spam" for _ in xrange( 511 ) ) Although, the replys with links will ultimately be more helpful! Will McGugan -- http://mail.python.org/mailman/listinfo/python-list

Re: Help With Python

2005-01-26 Thread Kartic
Py>>> print "Spam, " * 115 Spam, Spam, Spam, Spam, Spam, . Spam, Multiplies (repeats) the string 115 times. To eliminate the last ", " (that is, a comma followed by space), you can do it using the slice notation and say: Py>>> print ("Spam, " * 115) [:-2] Spam, Spam, Spam, Spam, S

Re: Help With Python

2005-01-26 Thread Steven Bethard
Thomas Guettler wrote: Am Wed, 26 Jan 2005 15:55:28 + schrieb Judi Keplar: I am currently taking a course to learn Python and was looking for some help. I need to write a Python statement to print a comma- separated repetition of the word, "Spam", written 511 times ("Spam, Spam, ï Spam").

Re: Help With Python

2005-01-26 Thread Kent Johnson
Thomas Guettler wrote: # No comma at the end: mylist=[] for i in range(511): mylist.append("Spam") or just mylist = ["Spam"] * 511 Kent print ", ".join(mylist) Thomas -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >