Select weirdness

2007-04-21 Thread Ron Garret
Here's my code. It's a teeny weeny little HTTP server. (I'm not really trying to reinvent the wheel here. What I'm really doing is writing a dispatching proxy server, but this is the shortest way to illustrate the problem I'm having): from SocketServer import * from socket import * from sele

Namespaces/introspection: collecting sql strings for validation

2007-04-21 Thread Martin Drautzburg
I would like to validate sql strings, which are spread all over the code, i.e. I run ("prepare") them against a database to see if it happy with the statements. Spelling errors in sql have been a major pain for me. The statements will not be assembled from smaller pieces, but they will not neccess

Re: Handy short cut for formatting elapsed time in floating point seconds

2007-04-21 Thread Steven D'Aprano
On Sat, 21 Apr 2007 18:09:01 -0700, Paul McGuire wrote: > I am doing some simple timing of some elements of Python scripts, and > the simplest is to just call time.time() before and after key elements > of the script: > > t1 = time.time() > > # do lengthy operation > > t2 = time.time() > print

python cgi problem with textarea

2007-04-21 Thread Adrian Smith
This may be more a cgi thing than a Python one, but I'm trying to get this page: http://adrian10.phpwebhosting.com/trial.html consisting basically of this: ...to print out the contents of the textarea with this cgi script: #!/usr/bin/python import cgi print "Content-type: text/html\n" form

Re: Can __init__ not return an object?

2007-04-21 Thread Steven D'Aprano
On Sat, 21 Apr 2007 22:36:42 -0400, Steven W. Orr wrote: > When I go to create an object I want to be able to decide whether the > object is valid or not in __init__, and if not, I want the constructor to > return something other than an object, (like maybe None). None is an object, like everyt

Re: Support for new items in set type

2007-04-21 Thread Steven D'Aprano
On Sat, 21 Apr 2007 20:13:44 -0700, Prateek wrote: > I have a bit of a specialized request. > > I'm reading a table of strings (specifically fixed length 36 char > uuids generated via uuid.uuid4() in the standard library) from a file > and creating a set out of it. > Then my program is free to ma

Re: Support for new items in set type

2007-04-21 Thread Alex Martelli
Prateek <[EMAIL PROTECTED]> wrote: > I have a bit of a specialized request. > > I'm reading a table of strings (specifically fixed length 36 char > uuids generated via uuid.uuid4() in the standard library) from a file > and creating a set out of it. > Then my program is free to make whatever modi

Re: Problem redefining __getitem__ for str subclass

2007-04-21 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I do not think I am understanding how to redefine the getitem function > for string. Why does the following not work: > > class NStr(str): > def __getitem__(self,idx): > print "NStr:getitem",idx,type(idx) > return str.__getitem__(self,idx) > > s=N

Re: Returning a date as string

2007-04-21 Thread Björn Keil
On 22 Apr., 02:26, John Machin <[EMAIL PROTECTED]> wrote: > On Apr 22, 6:59 am, Björn Keil <[EMAIL PROTECTED]> wrote: > > > Hello pythons, > > > I have little problem with understanding conversions in python. I've > > written a little class - nothing much, just to try out Python a little > > - cont

Re: Problem redefining __getitem__ for str subclass

2007-04-21 Thread Carsten Haese
On 21 Apr 2007 20:36:13 -0700, tsm8015 wrote > I do not think I am understanding how to redefine the getitem > function for string. Why does the following not work: > > class NStr(str): > def __getitem__(self,idx): > print "NStr:getitem",idx,type(idx) > return str.__getitem__(

Re: Flat DB seeking speed

2007-04-21 Thread Alex Martelli
Jia Lu <[EMAIL PROTECTED]> wrote: > Hello all > > I see there are lots of flat db or db-like modules in the standard > python modules. > What about the keywords seeking speed of them ? > > (I want to put about 1 articles with 1 IDs, and I can do > searching keywords with them) > > T

Re: Python "robots.txt" parser broken since 2003

2007-04-21 Thread Terry Reedy
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | This was reported in 2003, and a patch was uploaded in 2005, but the patch | never made it into Python 2.4 or 2.5. If the patch is still open, perhaps you could review it. tjr -- http://mail.python.org/mailman/listi

Flat DB seeking speed

2007-04-21 Thread Jia Lu
Hello all I see there are lots of flat db or db-like modules in the standard python modules. What about the keywords seeking speed of them ? (I want to put about 1 articles with 1 IDs, and I can do searching keywords with them) The db-like modules are : dbm, gdbm, dbhash,anydbm, pi

Re: Python's handling of unicode surrogates

2007-04-21 Thread Josiah Carlson
On Apr 20, 7:34 pm, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > On Apr 20, 6:21 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > > > I don't believe this specific variant has been discussed. > > Now that you clarify it: no, it hasn't been discussed. I find that > > not surprising - this proposal

Re: Problem redefining __getitem__ for str subclass

2007-04-21 Thread Michel Claveau
Hi! Same result, with Python 2.5.1 on win-XP; I have compassion with you. -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Problem redefining __getitem__ for str subclass

2007-04-21 Thread tsm8015
I do not think I am understanding how to redefine the getitem function for string. Why does the following not work: class NStr(str): def __getitem__(self,idx): print "NStr:getitem",idx,type(idx) return str.__getitem__(self,idx) s=NStr("abcde") print s[1] print s[1:4:2] print

Support for new items in set type

2007-04-21 Thread Prateek
I have a bit of a specialized request. I'm reading a table of strings (specifically fixed length 36 char uuids generated via uuid.uuid4() in the standard library) from a file and creating a set out of it. Then my program is free to make whatever modifications to this set. When I go back to save t

Re: using tkinter to display html

2007-04-21 Thread Stephen M. Gava
On Sat, 21 Apr 2007 09:57:09 -0400, Kevin Walzer wrote: > Stephen M. Gava wrote: >> On Fri, 20 Apr 2007 03:28:22 -0700, Rob Wolfe wrote: > The following thread has various ideas in it: > http://mail.python.org/pipermail/python-list/2001- October/107989.html thanks mike, i found that t

Re: No speedup on multi-processor machine?

2007-04-21 Thread Robert Kern
John Nagle wrote: > There's a numerics library > for Python called NumPy, but it doesn't have a convolution function, > although it has an FFT, which may be useful. In [1]: from numpy import * In [2]: convolve? Type: function Base Class: Namespace: Interactive File: /Library/F

Re: Can __init__ not return an object?

2007-04-21 Thread Carsten Haese
On Sat, 2007-04-21 at 22:36 -0400, Steven W. Orr wrote: > When I go to create an object I want to be able to decide whether the > object is valid or not in __init__, and if not, I want the constructor to > return something other than an object, (like maybe None). > [...] > Or would raising an

Re: No speedup on multi-processor machine?

2007-04-21 Thread Grant Edwards
On 2007-04-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am using Python Thread library for my parallel processing > course project. I am doing matrix convolution on a > multi-processor machine running Solaris. I just found out that > no speed-up is obtained with threading. It is probably b

Can __init__ not return an object?

2007-04-21 Thread Steven W. Orr
When I go to create an object I want to be able to decide whether the object is valid or not in __init__, and if not, I want the constructor to return something other than an object, (like maybe None). I seem to be having problems. At the end of __init__ I say (something like) if self.s

Give me the google group address in Chinese.

2007-04-21 Thread 坏蛋
It's really annoying to find there are all English language posts here because I wanna talk about something about the Chinese related programs. Could you give me some ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Handy short cut for formatting elapsed time in floating point seconds

2007-04-21 Thread George Sakkis
On Apr 21, 9:09 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > I am doing some simple timing of some elements of Python scripts, and > the simplest is to just call time.time() before and after key elements > of the script: > > t1 = time.time() > > # do lengthy operation > > t2 = time.time() > print

Another Python Game Programming Challenge concludes

2007-04-21 Thread Richard Jones
The fourth Python Game Programming Challenge (PyWeek) has now concluded with judges (PyWeek being peer-judged) declaring the winners: Individual: Which way is up? by Hectigo http://www.pyweek.org/e/Hectic/ Team: Bubble Kong by The Olde Battleaxe http://www.pyweek.org/e/toba4/ Congratula

Re: Handy short cut for formatting elapsed time in floating point seconds

2007-04-21 Thread John Machin
On Apr 22, 11:09 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > I am doing some simple timing of some elements of Python scripts, and > the simplest is to just call time.time() before and after key elements > of the script: > > t1 = time.time() > > # do lengthy operation > > t2 = time.time() > print

Handy short cut for formatting elapsed time in floating point seconds

2007-04-21 Thread Paul McGuire
I am doing some simple timing of some elements of Python scripts, and the simplest is to just call time.time() before and after key elements of the script: t1 = time.time() # do lengthy operation t2 = time.time() print "That took %f seconds" % (t2-t1) Unfortunately, this gives very ugly timing

Re: '\\' in regex affects the following parenthesis?

2007-04-21 Thread John Machin
On Apr 22, 9:56 am, [EMAIL PROTECTED] wrote: > Could someone tell me why: > > >>> import re > >>> p = re.compile('\\.*\\(.*)') Short answer: *ALWAYS* use raw strings for regexes in Python source files. Long answer: '\\.*\\(.*)' is equivalent to r'\.*\(.*)' So what re.compile is seeing is: \. -

Re: '\\' in regex affects the following parenthesis?

2007-04-21 Thread Paul McGuire
On Apr 21, 6:56 pm, [EMAIL PROTECTED] wrote: > Could someone tell me why: > > >>> import re > >>> p = re.compile('\\.*\\(.*)') > > Fails with message: > > Traceback (most recent call last): > File "", line 1, in > re.compile('\\dir\\(file)') > File "C:\Python25\lib\re.py", line 180, in com

Re: Returning a date as string

2007-04-21 Thread John Machin
On Apr 22, 6:59 am, Björn Keil <[EMAIL PROTECTED]> wrote: > Hello pythons, > > I have little problem with understanding conversions in python. I've > written a little class - nothing much, just to try out Python a little > - containing the following method: > > def __repr__(self): > """

Re: No speedup on multi-processor machine?

2007-04-21 Thread Fuzzyman
On Apr 22, 1:03 am, Neil Hodgson <[EMAIL PROTECTED]> wrote: > Fuzzyman: > > > IronPython is *definitely* not restricted by the GIL. > > IronPython is currently mostly slower than CPython although the > particular problem should be tested to see if IronPython helps. > > Some recent benchmark

Re: No speedup on multi-processor machine?

2007-04-21 Thread Neil Hodgson
Fuzzyman: > IronPython is *definitely* not restricted by the GIL. IronPython is currently mostly slower than CPython although the particular problem should be tested to see if IronPython helps. Some recent benchmarks between IronPython and CPython: http://sparcs.kaist.ac.kr/~tinuviel/py

Re: Python for Vcard Parsing in UTF16

2007-04-21 Thread Alex Martelli
R Wood <[EMAIL PROTECTED]> wrote: ... > alias Linus_Torvalds Linus Torvalds <[EMAIL PROTECTED]> > > To me this was a natural task for Perl. Turns out however, there's a catch. > Apple exports the file in UTF-16 to ensure anyone with Chinese characters in > their addressbook gets a legitimate V

'\\' in regex affects the following parenthesis?

2007-04-21 Thread voxiac
Could someone tell me why: >>> import re >>> p = re.compile('\\.*\\(.*)') Fails with message: Traceback (most recent call last): File "", line 1, in re.compile('\\dir\\(file)') File "C:\Python25\lib\re.py", line 180, in compile return _compile(pattern, flags) File "C:\Python25\lib\

Re: Suggestion: str.itersplit()

2007-04-21 Thread Dustan
On Apr 21, 4:18 pm, Dustan <[EMAIL PROTECTED]> wrote: > On Apr 21, 7:58 am, Dustan <[EMAIL PROTECTED]> wrote: > > > >From my searches here, there is no equivalent to java's > > > StringTokenizer in python, which seems like a real shame to me. > > > However, str.split() works just as well, except fo

Re: No speedup on multi-processor machine?

2007-04-21 Thread John Nagle
Caleb Hattingh wrote: > On Apr 21, 11:02 pm, [EMAIL PROTECTED] wrote: > >>Hi, >>I am using Python Thread library for my parallel processing course >>project. I am doing matrix convolution on a multi-processor machine >>running Solaris. I just found out that no speed-up is obtained with >>threading

Re: Suggestion: str.itersplit()

2007-04-21 Thread Dustan
On Apr 21, 4:54 pm, [EMAIL PROTECTED] wrote: > On Apr 21, 5:58 am, Dustan <[EMAIL PROTECTED]> wrote: > > > >From my searches here, there is no equivalent to java's > > > StringTokenizer in python, which seems like a real shame to me. > > > However, str.split() works just as well, except for the fac

Python for Vcard Parsing in UTF16

2007-04-21 Thread R Wood
Greetings - A recent Perl experiment hasn't turned out so well, which has piqued my interest in Python. The project is this: take a Vcard file exported from Apple's Addressbook and use a language that is good at parsing text to convert it into a mutt alias file. There are better ways to use Mutt

Re: No speedup on multi-processor machine?

2007-04-21 Thread Caleb Hattingh
On Apr 21, 11:02 pm, [EMAIL PROTECTED] wrote: > Hi, > I am using Python Thread library for my parallel processing course > project. I am doing matrix convolution on a multi-processor machine > running Solaris. I just found out that no speed-up is obtained with > threading. It is probably because of

Re: CGI Script using Python

2007-04-21 Thread Fuzzyman
On Apr 21, 10:02 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > "Ralf" <[EMAIL PROTECTED]> wrote: > > >is there anybody who can help me. > >I would like to use a Python Script to download Files from a Server to the > >Client, to update the Client. > > Remember, though, that a CGI script cannot actual

Re: No speedup on multi-processor machine?

2007-04-21 Thread Fuzzyman
On Apr 21, 10:53 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 21 Apr 2007 14:02:12 -0700, [EMAIL PROTECTED] declaimed the > following in comp.lang.python: > > > Hi, > > I am using Python Thread library for my parallel processing course > > project. I am doing matrix convolution on a multi-

Re: Newbie question regarding string.split()

2007-04-21 Thread Karthik Gurusamy
On Apr 20, 11:51 am, kevinliu23 <[EMAIL PROTECTED]> wrote: > Hey guys, > > So I have a question regarding the split() function in the string > module. Let's say I have an string... > > input = "2b 3 4bx 5b 2c 4a 5a 6" > projectOptions = (input.replace(" ", "")).split('2') > print projectOptions > >

Re: Easy make money!

2007-04-21 Thread John Nagle
Dustan wrote: > On Apr 21, 3:45 pm, GPcapital <[EMAIL PROTECTED]> wrote: > >>Lately I've been surfing trought some web pages and got this one >>www.gpcapitalgroup.com. It looks quite interesting, it may be a great >>chance to invest. > > advertisement.delete() I couldn't resist. I ran

Re: Returning a date as string

2007-04-21 Thread 7stud
On Apr 21, 2:59 pm, Björn Keil <[EMAIL PROTECTED]> wrote: > Hello pythons, > > I have little problem with understanding conversions in python. I've > written a little class - nothing much, just to try out Python a little > - containing the following method: > > def __repr__(self): > """

Re: Building browser-like GET request

2007-04-21 Thread Gilles Ganault
On 21 Apr 2007 14:47:55 -0700, Björn Keil <[EMAIL PROTECTED]> wrote: >Well, I am brand new to Python, so it takes me a lot of guessing, but >since it seems you're using urlib2: Thanks. Indeed, it looks like urlib2 is the way to go when going through a proxy. For those interested, here's how to d

Re: how to transfer integer on socket?

2007-04-21 Thread Irmen de Jong
Frank Potter wrote: > Is there any easy way to transfer 4 bit integer on socket? I think you mean a 4-byte integer? Look at the struct module, anyway. --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: str.itersplit()

2007-04-21 Thread Alex Martelli
Dustan <[EMAIL PROTECTED]> wrote: > On Apr 21, 7:58 am, Dustan <[EMAIL PROTECTED]> wrote: > > >From my searches here, there is no equivalent to java's > > > > StringTokenizer in python, which seems like a real shame to me. > > > > However, str.split() works just as well, except for the fact that i

Re: Suggestion: str.itersplit()

2007-04-21 Thread Jorge Godoy
Dustan <[EMAIL PROTECTED]> writes: > If anybody could inform me on how to get my hands on the python source > code, I might even be able to come up with an example of how it could > be implemented. I have no idea how to unzip that tgz or tar.bz2 file > on a windows machine, though (and that's not

Re: Suggestion: str.itersplit()

2007-04-21 Thread attn . steven . kuo
On Apr 21, 5:58 am, Dustan <[EMAIL PROTECTED]> wrote: > >From my searches here, there is no equivalent to java's > > StringTokenizer in python, which seems like a real shame to me. > > However, str.split() works just as well, except for the fact that it > creates it all at one go. I suggest an iter

Re: Building browser-like GET request

2007-04-21 Thread Björn Keil
On 21 Apr., 23:28, Gilles Ganault <[EMAIL PROTECTED]> wrote: > I'd like to download pages from a site, but it checks whether > the requests are coming from a live user or a script; If the latter, > the server returns a blank page. > > Using a proxy (Paros), I can see what information my script and

Building browser-like GET request

2007-04-21 Thread Gilles Ganault
Hello I'd like to download pages from a site, but it checks whether the requests are coming from a live user or a script; If the latter, the server returns a blank page. Using a proxy (Paros), I can see what information my script and FireFox send, and there are a lot of information that P

Re: Suggestion: str.itersplit()

2007-04-21 Thread Dustan
On Apr 21, 7:58 am, Dustan <[EMAIL PROTECTED]> wrote: > >From my searches here, there is no equivalent to java's > > StringTokenizer in python, which seems like a real shame to me. > > However, str.split() works just as well, except for the fact that it > creates it all at one go. I suggest an iter

Re: Easy make money!

2007-04-21 Thread Dustan
On Apr 21, 3:45 pm, GPcapital <[EMAIL PROTECTED]> wrote: > Lately I've been surfing trought some web pages and got this one > www.gpcapitalgroup.com. It looks quite interesting, it may be a great > chance to invest. >>> advertisement.delete() Traceback (most recent call last): File "", line 1, i

Re: CGI Script using Python

2007-04-21 Thread Tim Roberts
"Ralf" <[EMAIL PROTECTED]> wrote: > >is there anybody who can help me. >I would like to use a Python Script to download Files from a Server to the >Client, to update the Client. Remember, though, that a CGI script cannot actually put files anywhere. You can certainly download files to the client

No speedup on multi-processor machine?

2007-04-21 Thread danfan1981
Hi, I am using Python Thread library for my parallel processing course project. I am doing matrix convolution on a multi-processor machine running Solaris. I just found out that no speed-up is obtained with threading. It is probably because of something called GIL in Python. How can I get around th

Re: Newbie question regarding string.split()

2007-04-21 Thread kevinliu23
On Apr 21, 3:30 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > kevinliu23 a écrit :> Hey guys, > > > So I have a question regarding the split() function in the string > > module. Let's say I have an string... > > > input = "2b 3 4bx 5b 2c 4a 5a 6" > > projectOptions = (input.replace(" ", ""))

Returning a date as string

2007-04-21 Thread Björn Keil
Hello pythons, I have little problem with understanding conversions in python. I've written a little class - nothing much, just to try out Python a little - containing the following method: def __repr__(self): """Serializes the note. Currently the format of notes isn't decide

Easy make money!

2007-04-21 Thread GPcapital
Lately I've been surfing trought some web pages and got this one www.gpcapitalgroup.com . It looks quite interesting, it may be a great chance to invest. -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda generator - curious behavior in 2.5

2007-04-21 Thread Raymond Hettinger
[Gabriel Genellina] > This time, the ((tuple) and None) is like saying "discard the tuple and > return None instead", and that fires the usual StopIteration. It looks like the offending code is in the gen_send_ex() function in Objects/genobject.c: if (result == Py_None && f->f_stacktop

A simple photosharing application written in Python

2007-04-21 Thread Rico
I d like to show you http://www.morecute.com It has been awesome runs on Fedora I wanted to share it early on so there is litte load on the server and the early adopter crowd can try it out thanks Jerry -- http://mail.python.org/mailman/listinfo/python-list

Re: Do other Python GUI toolkits require this?

2007-04-21 Thread Bruno Desthuilliers
Kevin Walzer a écrit : > From the introduction to PyObjC, the Python-Objective-C bridge on Mac > OS X: > > "As described in Objective-C for PyObjC users the creation of > Objective-C objects is a two-stage process. To initialize objects, first > call a class method to allocate the memory (typi

Python "robots.txt" parser broken since 2003

2007-04-21 Thread John Nagle
This bug, "[ 813986 ] robotparser interactively prompts for username and password", has been open since 2003. It killed a big batch job of ours last night. Module "robotparser" naively uses "urlopen" to read "robots.txt" URLs. If the server asks for basic authentication on that file, "robotparse

Re: Unexpected exception from socket.getaddrinfo on Unicode URL

2007-04-21 Thread John Nagle
Steve Holden wrote: > John Nagle wrote: > >> Here's a strange little bug. "socket.getaddrinfo" blows up >> if given a bad domain name containing ".." in Unicode. The >> same string in ASCII produces the correct "gaierror" exception. >> >> Actually, this deserves a documentation mention

Re: Do other Python GUI toolkits require this?

2007-04-21 Thread Bruno Desthuilliers
Kevin Walzer a écrit : (snip) > Thanks to all for an illuminating thread on the mathematical > implications of "learning curve" and other aspects. This thread has > wandered pretty far from my original question (above) Noticed this too ?-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested dictionaries trouble

2007-04-21 Thread Bruno Desthuilliers
IamIan a écrit : > I am using the suggested approach to make a years list: > > years = ["199%s" % x for x in range(0,10)] > years += ["200%s" % x for x in range(0,10)] > > I haven't had any luck doing this in one line though. Is it possible? # Q, D and pretty obvious years = ["199%s" % x for x i

Re: Better dict of dicts

2007-04-21 Thread Bruno Desthuilliers
Bill Jackson a écrit : > I have a dictionary of dictionaries where the keys are typically very > long tuples and repeated in each inner dictionary. The dictionary > representation is nice because it handles sparseness well...and it is > nice to be able to look up values based on a string rather

Re: class __getitem__ when item is not a sequence ???

2007-04-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Sorry for the vague subject. Not sure what the right terminology is. > > How can I use an instance's data by reference to the instance name, > not the instance attribute? OK the question is probably really poor > but hopefully an example will make it clear. > > >>x=

Re: Newbie question regarding string.split()

2007-04-21 Thread Bruno Desthuilliers
kevinliu23 a écrit : > Hey guys, > > So I have a question regarding the split() function in the string > module. Let's say I have an string... > > input = "2b 3 4bx 5b 2c 4a 5a 6" > projectOptions = (input.replace(" ", "")).split('2') The parens around the call to input.replace are useless: pr

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Please help me think of an example where immutable tuples are > essential. Well, I don't know if they are "essential" - much of Python can be seen as 'unessential' syntactic sugar (my, even the class statement is not "essential" if you go that way). > It seems that

Re: newbie: HTTPS screen scraping

2007-04-21 Thread John Nagle
[EMAIL PROTECTED] wrote: > Hi, >Can anyone help me out here. I would like to authenticate myself to a > website which uses HTTPS and then after authentication, I would like to > get the contents of the webpage. How can this be done using python. > I have tried urllib and urllib2 but it has no

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Apr 20, 4:37 pm, John Machin <[EMAIL PROTECTED]> wrote: > >>One inessential but very useful thing about tuples when you have a lot >>of them is that they are allocated the minimum possible amount of >>memory. OTOH lists are created with some slack so that appending

Re: Shebang or Hashbang for modules or not?

2007-04-21 Thread Michael Hoffman
Chris Lasher wrote: > Should a Python module not intended to be executed have shebang/ > hashbang (e.g., "#!/usr/bin/env python") or not? I'm used to having a > shebang in every .py file but I recently heard someone argue that > shebangs were only appropriate for Python code intended to be > execut

Re: Shebang or Hashbang for modules or not?

2007-04-21 Thread Bruno Desthuilliers
Jorgen Grahn a écrit : > On Fri, 13 Apr 2007 22:46:03 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> > wrote: > >>Jorgen Grahn a écrit : > (snip) > >>More seriously, and as far as I'm concerned, when I want to make a >>python script (by opposition to a python 'module') available as a unix >>c

pyHook equivalent for WH_SHELL hooks?

2007-04-21 Thread Jan Böcker
Hi, i want to write an app which has to log various user activity, such as opening folders and office documents, to help the user keep an overview about what open windows are related to one task he/she is currently doing. I thought of using a windows shell hook, which notifies the program simil

Re: Class Not Auto-Init On Import

2007-04-21 Thread Steve Holden
Robert Rawlins - Think Blue wrote: > Hello Guys, > > > > From my understanding of what I’ve read, the ‘import’ is meant to auto > Init my class ready for me to access its methods, but it doesn’t appear > too, I’m having to init them myself before I can access them, like this. > Importing a

Re: How To Find Currently Selected Tile.Notebook Tab?

2007-04-21 Thread Kevin Walzer
[EMAIL PROTECTED] wrote: >>> How can I determine what tab is currently selected in a Tile.Notebook >>> widget? >>> The best suggestion I've been able to find via Google is >>> "mynotebook.index('current')", but that gets an exception from Tcl. >> How about >> >> mynotebook.index.current() > > No g

Tkinter wiki down?

2007-04-21 Thread Kevin Walzer
Jeff Epler's Tkinter wiki has been down for several days now: http://tkinter.unpythonic.net/wiki/FrontPage Anyone heard about when, or if, it will be restored? I've tried to contact Mr. Epler but have not yet heard back. The site has been the target of some heavy spam/spidering recently; I've t

Re: Do other Python GUI toolkits require this?

2007-04-21 Thread Kevin Walzer
Kevin Walzer wrote: > From the introduction to PyObjC, the Python-Objective-C bridge on Mac > OS X: > > "As described in Objective-C for PyObjC users the creation of > Objective-C objects is a two-stage process. To initialize objects, first > call a class method to allocate the memory (typical

Re: Styled Output

2007-04-21 Thread Michael Bentley
On Apr 21, 2007, at 3:21 AM, Robert Rawlins - Think Blue wrote: > Chaps, > > > > Hope you’re all having a good weekend, I’m sure it’ll only be the > more ‘hard core’ of you reading this, anyone with any sanity would > be out in the sunshine right now. > > > > I’m running a program of mine fro

Re: Do other Python GUI toolkits require this?

2007-04-21 Thread Diez B. Roggisch
Antoon Pardon schrieb: > On 2007-04-20, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >>> So if you have the choice between a steep or a shalow income curve >>> you will prefer the shalow curve because a steep curve makes you >>> think about verticale clifs and such? >>> >>> The analogy with a walk i

Re: Unexpected exception from socket.getaddrinfo on Unicode URL

2007-04-21 Thread Steve Holden
John Nagle wrote: > Here's a strange little bug. "socket.getaddrinfo" blows up > if given a bad domain name containing ".." in Unicode. The > same string in ASCII produces the correct "gaierror" exception. > > Actually, this deserves a documentation mention. The "socket" module, > giv

Re: Suggestion: str.itersplit()

2007-04-21 Thread subscriber123
On Apr 21, 8:58 am, Dustan <[EMAIL PROTECTED]> wrote: > >From my searches here, there is no equivalent to java's > > StringTokenizer in python, which seems like a real shame to me. > > However, str.split() works just as well, except for the fact that it > creates it all at one go. I suggest an iter

Re: using tkinter to display html

2007-04-21 Thread Kevin Walzer
Stephen M. Gava wrote: > On Fri, 20 Apr 2007 03:28:22 -0700, Rob Wolfe wrote: The following thread has various ideas in it: http://mail.python.org/pipermail/python-list/2001-October/107989.html >>> thanks mike, i found that thread before i posted here, it doesn'rt >>> answer my question t

Re: Do other Python GUI toolkits require this? (OT)

2007-04-21 Thread Roel Schroeven
Hendrik van Rooyen schreef: > "Roel Schroeven" <[EMAIL PROTECTED]> wrote: > >> Hendrik van Rooyen schreef: >>> "Steve Holden" <[EMAIL PROTECTED]> wrote: >>> >>> Perhaps in Belgium they prefer climbing mountains over walking up and down gentle hills? >>> Mountains ? Hills ? In Be

Re: Nested dictionaries trouble

2007-04-21 Thread rzed
IamIan <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Thank you again for the great suggestions. I have one final > question about creating a httpMonths dictionary like {'Jan':'01' > , 'Feb':'02' , etc} with a minimal amount of typing. My code > follows (using Python 2.3.4): > > import c

Re: Suggestion: str.itersplit()

2007-04-21 Thread Michael Hoffman
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Dustan wrote: > >> From my searches here, there is no equivalent to java's >> StringTokenizer in python, which seems like a real shame to me. >> >> However, str.split() works just as well, except for the fact that it >> creates it all at on

Re: Suggestion: str.itersplit()

2007-04-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Dustan wrote: > From my searches here, there is no equivalent to java's > StringTokenizer in python, which seems like a real shame to me. > > However, str.split() works just as well, except for the fact that it > creates it all at one go. I suggest an itersplit be introduc

Suggestion: str.itersplit()

2007-04-21 Thread Dustan
>From my searches here, there is no equivalent to java's StringTokenizer in python, which seems like a real shame to me. However, str.split() works just as well, except for the fact that it creates it all at one go. I suggest an itersplit be introduced for lazy evaluation, if you don't want to tak

Re: wx.TextCtrl.SetDefaultStyle not working?

2007-04-21 Thread 7stud
On Apr 20, 8:38 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm running Python2.5 with wxPython v2.8.3.0 under WinXP and I cannot > get the SetDefaultStyle method to work. > > I'm trying: > > self.output.SetDefaultStyle(wx.TextAttr(wx.RED)) > self.output.AppendText(text) >

ANN: eric3 version 3.9.5 released

2007-04-21 Thread Detlev Offenbach
Hi, this is to inform you about the release of eric3 version 3.9.5. This release fixes a few bugs and includes an updated PyLint interface. As usual it is available via http://www.die-offenbachs.de/detlev/eric.html Regards, Detlev -- Detlev Offenbach [EMAIL PROTECTED] -- http://mail.python.org

Re: is laziness a programer's virtue?

2007-04-21 Thread Peter Maas
Xah Lee wrote: > For those reading this, i also want to mention, that although i think > Perl is a motherfucking language on earth, and its leader and > “inventor” Larry Wall has done massive damage to the computing world, > but Perl the community is in fact very tolerant in general (which is > to

Re: how to find the OS name..??

2007-04-21 Thread Gabriel Genellina
En Sat, 21 Apr 2007 08:13:10 -0300, pradeep nair <[EMAIL PROTECTED]> escribió: > How do i determine the type of OS i'm working on using python??(i.e > whether CentOS,Fedora,SLES,...along with the version) os.uname() If you need more detailed information try the platform module -- Gabriel

how to find the OS name..??

2007-04-21 Thread pradeep nair
How do i determine the type of OS i'm working on using python??(i.e whether CentOS,Fedora,SLES,...along with the version) -- http://mail.python.org/mailman/listinfo/python-list

Re: Class Not Auto-Init On Import

2007-04-21 Thread Gabriel Genellina
En Sat, 21 Apr 2007 05:46:07 -0300, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> escribió: >> From my understanding of what I've read, the 'import' is meant to auto >> Init > my class ready for me to access its methods, but it doesn't appear too, > I'm > having to init them myself before

Re: lambda generator - curious behavior in 2.5

2007-04-21 Thread Gabriel Genellina
En Sat, 21 Apr 2007 06:21:00 -0300, Boris Borcic <[EMAIL PROTECTED]> escribió: > >>> x = (lambda : ((yield 666),(yield 777),(yield 888)))() > >>> x.next() > 666 > >>> x.next() > 777 > >>> x.next() > 888 > >>> x.next() > (None, None, None) I think nobody thought in advance this case (a lamb

Re: TK-grid problem, please help

2007-04-21 Thread James Stroud
Ray wrote: > hi, I have a question about how to use .grid_forget (in python/TK) > > I need to work on grid repeatly. everytime when a button is pressed, > the rows of grid is different. such like, first time, it generate 10 > rows of data. > 2nd time, it maybe only 5 rows. so I need a way to RESE

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
> > I'm running a program of mine from Linux bash script and it currently > > outputs status messages to the command prompt, but they all look a little > > boring to say the least, it'll be like this. > > [snip] > > > And perhaps have the word 'success' in green, or red for 'failed' and > things >

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
> I'm running a program of mine from Linux bash script and it currently > outputs status messages to the command prompt, but they all look a little > boring to say the least, it'll be like this. [snip] > And perhaps have the word 'success' in green, or red for 'failed' and things > like that, jus

Re: newbie: HTTPS screen scraping

2007-04-21 Thread ici
On Apr 21, 11:38 am, [EMAIL PROTECTED] wrote: > Hi, > Can anyone help me out here. I would like to authenticate myself to > a website which uses HTTPS and then after authentication, I would like > to get the contents of the webpage. How can this be done using python. > I have tried urllib and u

Re: lambda generator - curious behavior in 2.5

2007-04-21 Thread James Stroud
Boris Borcic wrote: > >>> x = (lambda : ((yield 666),(yield 777),(yield 888)))() > >>> x.next() > 666 > >>> x.next() > 777 > >>> x.next() > 888 > >>> x.next() > (None, None, None) > >>> x = (lambda : ((yield 666),(yield 777),(yield 888)) and None)() > >>> x.next() > 666 > >>> x.next() > 777

  1   2   >