Writing web bots in python

2006-03-18 Thread [EMAIL PROTECTED]
Hello, I hav a question..How do I write a webbot that logs onto some website, fills text into a textbox and submit that form, Sorry I am a novice in python, apparently I have to use urllib, but I hav a few queries on this, What happens when there are more input interfaces..does urllib make somekind

Re: Problem with C-API

2006-03-18 Thread Fredrik Lundh
John Dean wrote: > Duncan's example worked to a point. The line PyRun_String( "print x", > Py_file_input, dict, dict); print out the contents of x, but I don't want to > print x out. I want to be able to grab whateven the variable x contains so > that I can pass it on for further processing by the

Re: Writing web bots in python

2006-03-18 Thread Fuzzyman
[EMAIL PROTECTED] wrote: > Hello, > I hav a question..How do I write a webbot that logs onto some website, > fills text into a textbox and submit that form, Sorry I am a novice in > python, apparently I have to use urllib, but I hav a few queries on > this, What happens when there are more input i

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-18 Thread [EMAIL PROTECTED]
Yes, the program is quite a jumble: but it works. And I didn't post to python newsgroup since I was limited to just 5 newsgroups and didn't feel like doing multiple postings to multiple newsgroups. -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations

2006-03-18 Thread Nemesis
Mentre io pensavo ad una intro simpatica "Roedy Green" scriveva: >>Hmmm... it displays fine via google groups. Maybe it's the reader which >>is 'non-compliant' ? > I am using Agent. You configure your database with an encoding, > which is by default the platform encoding, not UTF-8. I have just

Random Number Generator Error

2006-03-18 Thread ahmet nurlu
Hi, I wrote a random walk program which you will find below.  When I run it from the terminal, it gives error which I am not able to figure out what could be wrong. From the bash shell, I give a command     >python2.4 random.py It gives error: --

Re: xmlrpclib and carriagereturn (\r)

2006-03-18 Thread Ben Cartwright
Jonathan Ballet wrote: > The problem is, xmlrpclib "eats" those carriage return characters when > loading the XMLRPC request, and replace it by "\n". So I got "bla\n\nbla". > > When I sent back those parameters to others Windows clients (they are > doing some kind of synchronisation throught the XM

Re: Random Number Generator Error

2006-03-18 Thread Fredrik Lundh
"ahmet nurlu" wrote: > It gives error: > Traceback (most recent call last): >File "random.py", line 2, in ? > from pylab import * >File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ? > from matplotlib.pylab import * >File "/usr/lib/python2.4/site-packages/mat

filter list fast

2006-03-18 Thread lars_woetmann
I have a list I filter using another list and I would like this to be as fast as possible right now I do like this: [x for x in list1 if x not in list2] i tried using the method filter: filter(lambda x: x not in list2, list1) but it didn't make much difference, because of lambda I guess is ther

Re: xmlrpclib and carriagereturn (\r)

2006-03-18 Thread Ben Cartwright
Jonathan Ballet wrote: > The problem is, xmlrpclib "eats" those carriage return characters when > loading the XMLRPC request, and replace it by "\n". So I got "bla\n\nbla". > > When I sent back those parameters to others Windows clients (they are > doing some kind of synchronisation throught the XM

Re: Is there no end to Python?

2006-03-18 Thread kpp9c
>> This is good thing because I can ignore what I don't need. I am finding that this is really not true for me. I find that if i use other folks code, collaborate, or get help from other folks i still have to know all the new constructs that i don't often use, and i really struggle with iterators

Re: filter list fast

2006-03-18 Thread Ben Cartwright
lars_woetmann wrote: > I have a list I filter using another list and I would like this to be > as fast as possible > right now I do like this: > > [x for x in list1 if x not in list2] > > i tried using the method filter: > > filter(lambda x: x not in list2, list1) > > but it didn't make much differ

Re: filter list fast

2006-03-18 Thread Fredrik Lundh
lars_woetmann wrote: > I have a list I filter using another list and I would like this to be > as fast as possible right now I do like this: > > [x for x in list1 if x not in list2] > > i tried using the method filter: > > filter(lambda x: x not in list2, list1) > > but it didn't make much differe

Re: filter list fast

2006-03-18 Thread Klaus Alexander Seistrup
Lars Woetmann wrote: > I have a list I filter using another list and I would like > this to be as fast as possible > right now I do like this: > > [x for x in list1 if x not in list2] > > i tried using the method filter: > > filter(lambda x: x not in list2, list1) > > but it didn't make much diff

Encoding

2006-03-18 Thread Mohamad Babaei
Hi, I'm working on a program that fetches some translated texts from Altavista online translator , it works fine with languages like German, french & .. but it can not get translated text in Japanese or Russian or chinese. my code is something like this:   ## data

Error sending message [1142225781350.1208.rpppl] from [randpoly.com]

2006-03-18 Thread randpoly.com PostMaster
[<00>] V-POP3bounce: [EMAIL PROTECTED];Error=[The maximum number of delivery attempts has been reached] [<01>] Error sending message [1142225781350.1208.rpppl] from [randpoly.com]. ID: Mail From: Rcpt To: <[EMAIL PROTECTED]> Server: [mx.ikf.co.in] [<02>] The reason of the deliv

Error sending message [1142236119135.1544.rpppl] from [randpoly.com]

2006-03-18 Thread randpoly.com PostMaster
[<00>] V-POP3bounce: [EMAIL PROTECTED];Error=[The maximum number of delivery attempts has been reached] [<01>] Error sending message [1142236119135.1544.rpppl] from [randpoly.com]. ID: Mail From: Rcpt To: <[EMAIL PROTECTED]> Server: [mx.ikf.co.in] [<02>] The reason of the deliv

Re: filter list fast

2006-03-18 Thread Diez B. Roggisch
> Both of these techniques are O(n^2). You can reduce it to O(n log n) > by using sets: > set2 = set(list2) [x for x in list1 if x not in set2] > > Checking to see if an item is in a set is much more efficient than a > list. Is the set-lookup reliably O(log n)? I was under the impress

Generating exceptions from C

2006-03-18 Thread Jacob Kroon
Hi, I'm working on a python module written in C, and I'm trying to figure out how to raise python exceptions if a function fails. So far I've read http://docs.python.org/ext/errors.html and http://docs.python.org/api/exceptionHandling.html , but I've not fully understood it. I've managed to c

Re: Is there no end to Python?

2006-03-18 Thread Steve Holden
kpp9c wrote: >>> This is good thing because I can ignore what I don't need. > > > I am finding that this is really not true for me. I find that if i use > other folks code, collaborate, or get help from other folks i still > have to know all the new constructs that i don't often use, and i > real

Re: Problem with C-API

2006-03-18 Thread Duncan Booth
John Dean wrote: > Hi Duncan > > Your version of the app works apart from this part > > > > > else { > PyObject *rString = PyObject_Str(result); > if (rString==NULL) { > Py_DECREF(result); > PyErr_Print(); > return; > }

how to deal with socket.error: (10060, 'Operation timed out')

2006-03-18 Thread JuHui
I wrote a script to get 100 pages from a server. like below: 1:import httplib 2:conns = httplib.HTTPConnection("www.mytest.com") 3:conn.request("GET", "/") sometimes a socket error was raised. File "D:\usr\bin\lib\httplib.py", line 627, in connect raise socket.error, msg socket.error: (100

Re: how to deal with socket.error: (10060, 'Operation timed out')

2006-03-18 Thread Fredrik Lundh
"JuHui" wrote: > I wrote a script to get 100 pages from a server. > like below: > > 1:import httplib > 2:conns = httplib.HTTPConnection("www.mytest.com") > 3:conn.request("GET", "/") > sometimes a socket error was raised. > > File "D:\usr\bin\lib\httplib.py", line 627, in connect > raise so

what the best way to get 1000 page on same server?

2006-03-18 Thread JuHui
Hi : I want to get many html page on same server. I have tried httplib and urllib. I think httplib is better one because it's httplib.HTTPConnection. It will establish one network connection then do other opration before connection close. The urllib will establish network connection each time re

Re: how to deal with socket.error: (10060, 'Operation timed out')

2006-03-18 Thread gregarican
JuHui wrote: I wrote a script to get 100 pages from a server. like below: > 1:import httplib > 2:conns = httplib.HTTPConnection("www.mytest.com") > 3:conn.request("GET", "/") > > > sometimes a socket error was raised. > > File "D:\usr\bin\lib\httplib.py", line 627, in connect > raise socke

Re: Cheese Shop: some history for the new-comers

2006-03-18 Thread Christos Georgiou
On Sun, 12 Mar 2006 20:15:19 -0600, rumours say that Ron Adam <[EMAIL PROTECTED]> might have written: >[EMAIL PROTECTED] wrote: > >Cheese (or the lack of cheese) is never silly, Thus the slogan... "The >power of cheese". > >Now if you want silliness, then the correct establishment for that is >

Re: File Permissions

2006-03-18 Thread Christos Georgiou
On Fri, 10 Mar 2006 16:43:15 +0200, rumours say that Juho Schultz <[EMAIL PROTECTED]> might have written: >VJ wrote: >> Hi All >> >> Basically i want to write into a file .If the permissions are not there >> then print a error message. >> How do i achive this ??? >> >> Thanks, >> VJ >One way w

Re: Adding Multiple Attachments to SMTP mail (msg.add_header)

2006-03-18 Thread Christos Georgiou
On 10 Mar 2006 06:08:37 -0800, rumours say that "EdWhyatt" <[EMAIL PROTECTED]> might have written: >I attach my code for passing the information to msg.add_header: > >(AttNum = 2) > >for doatt in range(AttNum): >msg.add_header('Content-Disposition', 'attachment', >file

Re: how to deal with socket.error: (10060, 'Operation timed out')

2006-03-18 Thread JuHui
thanks! I try the "try" before, but can't catch the socket error. so strange, maybe my code was error. I wrote a retry code block as below. import httplib,time while 1: try: conn = httplib.HTTPConnection("www.test.com") conn.request("GET", "/") print "success"

How to convert

2006-03-18 Thread Lad
How can I covert in Python a variable of a long type to variable of Integer type? Thank you for reply L. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there no end to Python?

2006-03-18 Thread dan
Steve wrote: """No need for flames. I'll content myself with pointing out that most 1.5.2 programs will run unchanged in 2.5, so the backwards compatibility picture is very good. Nobody makes you use the new features!"" Nobody makes you use new features, true...unless you are relying on a library

Re: How to convert

2006-03-18 Thread JuHui
>>> 10/3.0 3.3335 >>> int(10/3.0) 3 -- http://mail.python.org/mailman/listinfo/python-list

Re: filter list fast

2006-03-18 Thread Peter Hansen
Diez B. Roggisch wrote: >>Both of these techniques are O(n^2). You can reduce it to O(n log n) >>by using sets: >> >set2 = set(list2) >[x for x in list1 if x not in set2] >> >>Checking to see if an item is in a set is much more efficient than a >>list. > > Is the set-lookup reliably O(log

Re: How to convert

2006-03-18 Thread Felipe Almeida Lessa
Em Sáb, 2006-03-18 às 05:12 -0800, Lad escreveu: > How can I covert in Python a variable of a long type to variable of > Integer type? You can do "int(variable)", but it can't be always done (for example, when variable > MAX_INT): >>> a=10L >>> a 10L >>> int(a) 10 >>> a=1

Re: How to convert

2006-03-18 Thread Felipe Almeida Lessa
Em Sáb, 2006-03-18 às 10:38 -0300, Felipe Almeida Lessa escreveu: > Em Sáb, 2006-03-18 às 05:12 -0800, Lad escreveu: > > How can I covert in Python a variable of a long type to variable of > > Integer type? > > You can do "int(variable)", but it can't be always done (for example, > when variable

Re: filter list fast

2006-03-18 Thread lars_woetmann
Thanks all, sets work like i charm -- http://mail.python.org/mailman/listinfo/python-list

Re: xmlrpclib and carriagereturn (\r)

2006-03-18 Thread Jonathan Ballet
Le Sat, 18 Mar 2006 02:17:36 -0800, Ben Cartwright a écrit : > Jonathan Ballet wrote: >> The problem is, xmlrpclib "eats" those carriage return characters when >> loading the XMLRPC request, and replace it by "\n". So I got "bla\n\nbla". >> >> When I sent back those parameters to others Windows cl

Re: xmlrpclib and carriagereturn (\r)

2006-03-18 Thread Jonathan Ballet
Le Sat, 18 Mar 2006 08:54:49 +0100, Fredrik Lundh a écrit : > Jonathan Ballet wrote: > [snip] > > XMLRPC is XML, and XML normalizes line feeds: > > http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends > > relying on non-standard line terminators in text is fragile and horridly out- >

distributing resources within a module folder

2006-03-18 Thread Max Kubierschky
I want to access some static (non changing) files from within a module (e.g icons, style sheets) and distribute them together with the module. Can I place the inside the module folder? If so, how can I access them? If not so, what is the best thing to do? Max -- http://mail.python.org/mailman/lis

Re: Writing web bots in python

2006-03-18 Thread [EMAIL PROTECTED]
Thanx for the info..i'll let you know when it works -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there no end to Python?

2006-03-18 Thread Jeffrey Schwab
Steve Holden wrote: > kpp9c wrote: >> I find that if i use >> other folks code, collaborate, or get help from other folks i still >> have to know all the new constructs that i don't often use, and i >> really struggle with iterators and generators and some of the newer >> things and folks seem to

Re: Importing an output from another function

2006-03-18 Thread Byte
"Try this (I think its called "argument expansion", but I really don't know what its called, so I can't point you to docs):" This works, thanks. But how acn I get rid of the ugly surrounding brackets and commas? e.g. If the scripts overall output was (('B', 'C'),), how to change it to just B C?

Re: Generating exceptions from C

2006-03-18 Thread Jacob Kroon
I'll just reply to myself what I've found out so far: > 1. PyErr_NewException() creates the exception _class_, not the > instance right ? > Looks like it does yes. It doesn't even seem right to talk about an _instance_ of an exception... > 2. Is PyErr_SetString() the correct way to raise except

Re: apache config file parser

2006-03-18 Thread Ziga Seilnacht
David Bear wrote: > I was wondering if anyone has written an apache config file parser in > python. There seem to be a number of perl mods to do this. But I don't seem > to be able to find anything in python. > > -- > David Bear > -- let me buy your intellectual property, I want to own your thought

__dict__ strangeness

2006-03-18 Thread Georg Brandl
Hi, can someone please tell me that this is correct and why: >>> class C(object): ... pass ... >>> c = C() >>> c.a = 1 >>> c.__dict__ {'a': 1} >>> c.__dict__ = {} >>> c.a Traceback (most recent call last): File "", line 1, in ? AttributeError: 'C' object has no attribute 'a' >>> >>> class D

Re: Generating exceptions from C

2006-03-18 Thread Just
In article <[EMAIL PROTECTED]>, Jacob Kroon <[EMAIL PROTECTED]> wrote: > I'll just reply to myself what I've found out so far: > > > 1. PyErr_NewException() creates the exception _class_, not the > > instance right ? > > > Looks like it does yes. It doesn't even seem right to talk about an > _

Re: Generating exceptions from C

2006-03-18 Thread Jacob Kroon
Just wrote: >>Does the comments above make sense? >> >> > >Not quite: when raising an exception, an instance of the exception class >_is_ created. Just like this: > > raise SomeException(msg) > >With the old (deprecated) spelling the instantiation is done implicitly: > > raise SomeExcepti

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-18 Thread [EMAIL PROTECTED]
Here is an nice intro to K: http://www.kuro5hin.org/?op=displaystory;sid=2002/11/14/22741/791 "This is where K starts to set itself from apart from most of the common programming languages in use today. You rarely write loops in K (KDB is 100% loop-free), instead you use adverbs. An adverb modi

Re: Linear regression in NumPy

2006-03-18 Thread Matt Crema
Robert Kern wrote: > nikie wrote: > >>I still don't get it... >>My data looks like this: >> x = [0,1,2,3] >> y = [1,3,5,7] >>The expected output would be something like (2, 1), as y[i] = x[i]*2+1 >> >>(An image sometimes says more than 1000 words, so to make myself clear: >>this is what I want to

Re: Is there no end to Python?

2006-03-18 Thread Jeffrey Schwab
Jeffrey Schwab wrote: > Steve Holden wrote: >> No need for flames. I'll content myself with pointing out that most >> 1.5.2 programs will run unchanged in 2.5, so the backwards >> compatibility picture is very good. Nobody makes you use the new >> features! > > They do if you ever want to read

Re: Linear regression in NumPy

2006-03-18 Thread Matt Crema
Matt Crema wrote: > Robert Kern wrote: > >> nikie wrote: >> >>> I still don't get it... >>> My data looks like this: >>> x = [0,1,2,3] >>> y = [1,3,5,7] >>> The expected output would be something like (2, 1), as y[i] = x[i]*2+1 >>> >>> (An image sometimes says more than 1000 words, so to make myse

Re: Is there no end to Python?

2006-03-18 Thread Georg Brandl
dan wrote: > Steve wrote: > > """No need for flames. I'll content myself with pointing out that most > 1.5.2 programs will run unchanged in 2.5, so the backwards > compatibility > picture is very good. Nobody makes you use the new features!"" > > Nobody makes you use new features, true...unless y

Re: Is there no end to Python?

2006-03-18 Thread Scott David Daniels
kpp9c wrote: > Personally i would like to see the core Python language evolve more > slowly and see work on packages, modules and DOCS!! This is a common (and silly) whine. effort in a free system is not fungible. The odds of your affecting how the people doing the work by complaining about how

Re: SVD question

2006-03-18 Thread smritibhagat
Thanks Robert! I was using mlab's svd function, which returns an mxn matrix for u, and hence was unable to see how to compute the orthogonal complement! I realize that numpy's svd gives the mxm matrix! Thanks again. -Smriti -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-18 Thread wkehowski
When I run this I get through ghc I get C:\Documents and Settings\User\My Documents\wildcard>ghc "./wc-zielonka.hs" compilation IS NOT required C:/Languages/ghc/ghc-6.4.1/libHSrts.a(Main.o)(.text+0x1d):Main.c: undefined refe rence to `__stginit_ZCMain' C:/Languages/ghc/ghc-6.4.1/libHSrts.a(Main.o)

Re: Linear regression in NumPy

2006-03-18 Thread nikie
Thank you! THAT's what I've been looking for from the start! -- http://mail.python.org/mailman/listinfo/python-list

How to run SimpleHTTPServer on IronPython on Mono

2006-03-18 Thread Sanghyeon Seo
I took some time to write this HOWTO: http://sparcs.kaist.ac.kr/~tinuviel/fepy/howto/simplehttpserver-ironpython-mono-howto.html IronPython seems to get much less interest than it deserves. This howto shows how to setup IronPython to use with Mono on Linux and how to rebuild IronPython from source

Re: __dict__ strangeness

2006-03-18 Thread Alan Franzoni
Georg Brandl on comp.lang.python said: d.__dict__ > {} Which Python version, on which system? I can see the properly inserted attribute in __dict__, both with old style and new style classes. -- Alan Franzoni <[EMAIL PROTECTED]> - Togli .xyz dalla mia email per contattarmi. Rremove .xyz

Re: filter list fast

2006-03-18 Thread Paddy
What was the speed-up ? -- http://mail.python.org/mailman/listinfo/python-list

Re: __dict__ strangeness

2006-03-18 Thread Georg Brandl
Alan Franzoni wrote: > Georg Brandl on comp.lang.python said: > > d.__dict__ >> {} > > Which Python version, on which system? I can see the properly inserted > attribute in __dict__, both with old style and new style classes. It's 2.4.2, on Linux. The 2.5 SVN trunk has the same symptom. Ge

Re: __dict__ strangeness

2006-03-18 Thread Alex Martelli
Georg Brandl <[EMAIL PROTECTED]> wrote: > can someone please tell me that this is correct and why: IMHO, it is not correct: it is a Python bug (and it would be nice to fix it in 2.5). > >>> class C(object): > ... pass > ... > >>> c = C() > >>> c.a = 1 > >>> c.__dict__ > {'a': 1} > >>> c.__di

Re: Linear regression in NumPy

2006-03-18 Thread Matt Crema
nikie wrote: > > Hello, I'm glad that helped, but let's not terminate this discussion just yet. I am also interested in answers to your second question: nikie wrote: > "More generally: Is there any kind of documentation that tells me what > the functions in NumPy do, and what parameters

Re: Python compiler

2006-03-18 Thread Rc
"DaveM" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI" > <[EMAIL PROTECTED]> wrote: > >>Après, vous pourrez aussi fréquenter le newsgroup : >>fr.comp.lang.python >>qui a l'avantage d'être en français. > > But perhaps he's a Fl

Re: Writing web bots in python

2006-03-18 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > I hav a question..How do I write a webbot that logs onto some website, > fills text into a textbox and submit that form, Sorry I am a novice in > python, apparently I have to use urllib, but I hav a few queries on > this, What h

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-18 Thread [EMAIL PROTECTED]
The cardinality of excluding '*a*b*' from S^n should be (m-1)^(n-1)*(m+n-1), where m=|S|. For m=5 this becomes 4^(n-1)*(n+4), and your table fits this formula. As far as generating and testing, an 'ideal' solution would be to 'start from the ground up', as in excluding length 2 wc, and then length

Re: __dict__ strangeness

2006-03-18 Thread Georg Brandl
[moving to python-dev] Alex Martelli wrote: > Georg Brandl <[EMAIL PROTECTED]> wrote: > >> can someone please tell me that this is correct and why: > > IMHO, it is not correct: it is a Python bug (and it would be nice to fix > it in 2.5). Fine. Credits go to Michal Kwiatkowski for discovering t

Re: How to run SimpleHTTPServer on IronPython on Mono

2006-03-18 Thread Paul Boddie
Sanghyeon Seo wrote: > I took some time to write this HOWTO: > http://sparcs.kaist.ac.kr/~tinuviel/fepy/howto/simplehttpserver-ironpython-mono-howto.html Thanks for spending the time writing this. Whilst I don't run Mono or anything similar, new Python documentation is surely a welcome thing. > I

ipv6 validation

2006-03-18 Thread jiri . juranek
Hello, is there any common function for validation if string contains valid ip address(both ipv4 and ipv6)? Or does sb wrote some regular expression for this? thanks J -- http://mail.python.org/mailman/listinfo/python-list

Re: Python compiler

2006-03-18 Thread robert
Rc wrote: > "DaveM" <[EMAIL PROTECTED]> schreef in bericht > news:[EMAIL PROTECTED] > >>On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI" >><[EMAIL PROTECTED]> wrote: >> >> >>>Après, vous pourrez aussi fréquenter le newsgroup : >>> fr.comp.lang.python >>>qui a l'avantage d'être en français. >>

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-18 Thread [EMAIL PROTECTED]
Nice! How to put it in a loop? I'm totally a newbie to Lisp myself, just gettng into Graham and Touretzky. Let's create a problem. Suppose after excluding I want to know if the digits sum to 12, say, like maybe they're part of a partition. S={0,..6}, S^5, excluding "*1*5*" and "1*2*3*", say. How w

Re: Is there no end to Python?

2006-03-18 Thread Kamilche
Heheh, that sounds about right. :-D I personally haven't used the new stuff yet. Maybe I'm not experienced enough in Python yet to have encountered the need for them. I've played with them some, but every time I consider using them, something stops me. What stops me from using 'setattr' (an old f

Socket error: 10053 software caused connection abort

2006-03-18 Thread endcompany
  -- http://mail.python.org/mailman/listinfo/python-list

Re: insert chars into string

2006-03-18 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > hi > is there a string method to insert characters into a string? > eg > str = "abcdef" > i want to insert "#" into str so that it appears "abc#def" > > currently what i did is convert it to a list, insert the character > using insert() and then join them back as strin

Dr. Dobb's Python-URL! - weekly Python news and links (Mar 17)

2006-03-18 Thread Cameron Laird
QOTW: "Generally, you should always go for whatever is clearest/most easily read (not just in Python, but in all languages)." - Timothy Delaney "You will find as your programming experience increases that the different languages you learn are appropriate for different purposes, and have differen

Why won't the sprites in my group show up? (PyGame)

2006-03-18 Thread Isis
Hi all, I am writing a snake game, but all is not going well... Two problems here. First of all, the little circles I use for my sprite images only show up as quadrants. Second of all, only the Head sprite for my snake shows up at all. Why? Here are the class definitions: ! /usr/bin/python impo

Re: __dict__ strangeness

2006-03-18 Thread Alex Martelli
Georg Brandl <[EMAIL PROTECTED]> wrote: > [moving to python-dev] > > Alex Martelli wrote: > > Georg Brandl <[EMAIL PROTECTED]> wrote: > > > >> can someone please tell me that this is correct and why: > > > > IMHO, it is not correct: it is a Python bug (and it would be nice to fix > > it in 2.5)

ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-18 Thread John Machin
I am pleased to announce a new general release (0.5.2) of xlrd, a Python package for extracting data from Microsoft Excel spreadsheets. CHANGES: * Book and sheet objects can now be pickled and unpickled. Instead of reading a large spreadsheet multiple times, consider pickling it once and loading

Re: Linear regression in NumPy

2006-03-18 Thread Robert Kern
Matt Crema wrote: > To sum up a wordy post, "What do experienced users find is the most > efficient way to navigate the numpy docs? (assuming one has already > read the FAQs and tutorials)" You're not likely to get much of an answer here, but if you ask on [EMAIL PROTECTED], you'll get plenty

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-18 Thread Joachim Durchholz
[EMAIL PROTECTED] schrieb: > "This is where K starts to set itself from apart from most of the > common programming languages in use today. You rarely write loops in K > (KDB is 100% loop-free), instead you use adverbs. An adverb modifies a > function, returning another function, changing the way

Re: Have you ever considered of mousing ambidextrously?

2006-03-18 Thread Roy Smith
"WangQiang" <[EMAIL PROTECTED]> wrote: > I'm also a programmer, as working in front of computer day and day, my > right hand is so tired and ached. So I tried to mouse in both hands. I > find that it is really an efficient way to release pains. At first I > switched the mouse buttons in windows con

Re: Is there no end to Python?

2006-03-18 Thread kpp9c
>> This is a common (and silly) whine. 1. not a whine 2. if it is really common is it all that silly? >> effort in a free system is not fungible. The odds of your affecting how the people doing the work by complaining about how they do it and their priorities are about zero to one. That is tru

Re: ipv6 validation

2006-03-18 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Hello, > is there any common function for validation if string contains valid ip > address(both ipv4 and ipv6)? Or does sb wrote some regular expression > for this? > thanks > J Look at socket.inet_pton(). First check to make sure ipv6

Re: Python 2.5 Schedule

2006-03-18 Thread Don Taylor
[EMAIL PROTECTED] wrote: > For more details about the plan for Python 2.5, see: > > http://www.python.org/doc/peps/pep-0356/ > I hope that this is not considered too off topic, but what compiler is going to be used for the MSW version of 2.5? If it is going to the MS Visual Studio 2005 com

Why are so many built-in types inheritable?

2006-03-18 Thread Fabiano Sidler
Hi folks! For debugging purposes I tried this: --- snip --- def foo(): pass function = type(foo) class PrintingFunction(function): def __init__(self, func): self.func = func def __call__(self, *args, **kwargs): print args, kwargs return function.__call__(self, args, kwargs) clas

Re: Is there no end to Python?

2006-03-18 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > John Salerno wrote: > >>But isn't Python sort of known for the opposite, i.e. 'one simple way', >>or something to that effect? > > > The Python language is clear and concise and so I don't think takes > long to learn. To learn the "basics", no. To really grasp all

Re: Importing an output from another function

2006-03-18 Thread John Salerno
Byte wrote: > "Try this (I think its called "argument expansion", but I really don't > know what its called, so I can't point you to docs):" > > This works, thanks. But how acn I get rid of the ugly surrounding > brackets and commas? > > e.g. If the scripts overall output was (('B', 'C'),), how

Re: Threads modify "global" variable -- asking for trouble?

2006-03-18 Thread J Rice
Thank you. Implementing a results queue was much simpler than I expected, and I think as I add this into the rest of the program it will avoid a lot of potential problems later too. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there no end to Python?

2006-03-18 Thread Peter Hansen
Scott David Daniels wrote: > Kind of like the core developers saying, rather than getting more > users of this language, I'd prefer they submit careful bug reports > with money attached to fix the bugs -- ain't gonna happen. Actually, it does happen: http://www.python.org/psf/donations/ (The actu

Re: Have you ever considered of mousing ambidextrously?

2006-03-18 Thread Peter Hansen
Roy Smith wrote: > "WangQiang" <[EMAIL PROTECTED]> wrote: >>I'm also a programmer, as working in front of computer day and day, my >>right hand is so tired and ached. So I tried to mouse in both hands. I >>find that it is really an efficient way to release pains. At first I >>switched the mouse but

Re: Have you ever considered of mousing ambidextrously?

2006-03-18 Thread Scott David Daniels
Roy Smith wrote: > I never understood why people switch mouse buttons. I'm left handed, so I > put the mouse on the left side of my keyboard. It never occurred to me to > flip the buttons around. Well, I switch 'em because the "forefinger is primary" is ingrained. > When somebody right handed

Re: Why won't the sprites in my group show up? (PyGame)

2006-03-18 Thread Peter Hansen
Isis wrote: > Hi all, > I am writing a snake game, but all is not going well... Chances are good that you'll get access to many more potential respondents by posting the question to the Pygame mailing list. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 Schedule

2006-03-18 Thread Scott David Daniels
Don Taylor wrote: > [EMAIL PROTECTED] wrote: >> For more details about the plan for Python 2.5, see: >> http://www.python.org/doc/peps/pep-0356/ > I hope that this is not considered too off topic, but what compiler is > going to be used for the MSW version of 2.5? > > If it is going to the MS

Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-18 Thread Kent Johnson
John Machin wrote: > I am pleased to announce a new general release (0.5.2) of xlrd, a Python > package for extracting data from Microsoft Excel spreadsheets. How does xlrd compare with pyexcelerator? At a glance they look pretty similar. Thanks, Kent -- http://mail.python.org/mailman/listinfo/

POP3 Mail Download

2006-03-18 Thread Kevin F
Having some troubles downloading messages with POP3... I can connect to the server just fine and list messages without any problem with the following code: from poplib import * server = POP3("mail.bluebottle.com") print server.getwelcome() print server.user("[EMAIL PROT

Re: filter list fast

2006-03-18 Thread lars_woetmann
comparing [x for x in list1 if x not in list2] with set1, set2 = set(list1), set(list2) list(set1-set2) gives something like len(list2) speedup -- 10010 1000 100 11000 the speedup is constant for different len(list1) -- http://mai

Re: How to convert

2006-03-18 Thread Steve Holden
JuHui wrote: 10/3.0 > > 3.3335 > The above value is a float, not a long ... int(10/3.0) > > 3 > >>> int(1l) 1 >>> 1 1L >>> 1/100 100L >>> int(1/100) 100

Re: filter list fast

2006-03-18 Thread Paddy
Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: A Frame-space syntax ? - Re: global, globals(), _global ?

2006-03-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, robert wrote: > The fact is: > * Python has that big problem with unnecessary barriers for nested frame > access - especially painfull with callback functions where you want to > put back data into the calling frame. You mean accessing the locals in the function that inv

Re: Have you ever considered of mousing ambidextrously?

2006-03-18 Thread Paddy
I can't quite understand why right handed people put the mouse in their right hand. I'm not a touch typist, like most of the English engineers I know, and I am left handed but prefer to have the mouse in my right hand. this allows my to mouse and then peck at the keyboard with my left hand for th

Re: Have you ever considered of mousing ambidextrously?

2006-03-18 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > I never understood why people switch mouse buttons. I'm left handed, so I > > put the mouse on the left side of my keyboard. It never occurred to me to > > flip the buttons around. > Well, I

  1   2   >