Re: noob question: TypeError wrong number of args

2006-05-02 Thread doobiz
Just my opinion, but I think the Guido tutorial on Classes is unintelligible unless you're coming from another OO language. But I found something else that looks promising that you may want to peek at: http://pytut.infogami.com/node11-baseline.html rd --

Re: Popping from the middle of a deque + deque rotation speed

2006-05-02 Thread Tim Peters
[Russell Warren] ... As to indexing into a deque being O(index)... I didn't realize that. It is certainly something to keep in mind, though... looping through the contents of a deque would obviously be a bad idea with this being the case! I wonder if the generator for the deque helps reduce

stripping

2006-05-02 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz ---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1: line = f.readline().rstrip(\n) if

stripping blanks

2006-05-02 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz ---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1: line = f.readline().rstrip(\n) if

Re: noob question: TypeError wrong number of args

2006-05-02 Thread BartlebyScrivener
No way. You didn't deserve it. Unless you came from another OO language, the Guido tutorial on Classes is unintelligible. It assumes way too much knowledge. But I found something else that looks promising that you may want to peek at: http://pytut.infogami.com/node11-baseline.html rd Reply --

strip newlines and blanks

2006-05-02 Thread micklee74
hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1: line = f.readline().rstrip(\n) if line == '':

blank lines representation in python

2006-05-02 Thread micklee74
hi what is the correct way to represent blank lines in python (while iterating a file) without regexp? I know one way is to use re.search((line,r'^$') to grab a blank line, but i wanna try not to use regexp... is it 1) if line == '': dosomething() (this also means EOF right? ) 2) if line is None:

string.find first before location

2006-05-02 Thread Gary Wessle
Hi I have a string like this text = abc abc and Here and there I want to grab the first abc before Here import string string.find(text, Here) # type int I am having a problem with the next step. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: string.find first before location

2006-05-02 Thread Ravi Teja
text[:text.find('Here')].rfind('abc') -- http://mail.python.org/mailman/listinfo/python-list

Re: strip newlines and blanks

2006-05-02 Thread Peter Otten
[EMAIL PROTECTED] wrote: Mick, you should be a bit more patient. Allow for some time for an answer to arrive. Minor edits of your question don't warrant a repost. i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz I wish to print the contents of the file

Re: string.find first before location

2006-05-02 Thread Peter Otten
Gary Wessle wrote: I have a string like this text = abc abc and Here and there I want to grab the first abc before Here import string string.find(text, Here) # type int I am having a problem with the next step. These days str methods are preferred over the string module's functions.

Re: strip newlines and blanks

2006-05-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1: line =

Re: Using elementtree: replacing nodes

2006-05-02 Thread Fredrik Lundh
André wrote: I've started using elementtree and don't understand how to use it to manipulate and replace nodes. I know how to do this using a simple, but inefficient parser I wrote, but I'd rather learn to use a better tool - especially as it is to be added to the standard library. Now, I

Re: strip newlines and blanks

2006-05-02 Thread micklee74
thanks..and sorry, i am using the web version of google groups and didn't find an option i can edit my post, so i just removed it.. thanks again for the reply.. -- http://mail.python.org/mailman/listinfo/python-list

Re: stripping blanks

2006-05-02 Thread seeker
[EMAIL PROTECTED] wrote: hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz ---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1:

Re: noob question: TypeError wrong number of args

2006-05-02 Thread Edward Elliott
Steve Holden wrote: Objects don't actually pass references to themselves. The interpreter adds the bound instance as the first argument to a call on a bound method. Sure, if you want to get technical For that matter, objects don't actually call their methods either -- the interpreter looks up

Re: set partitioning

2006-05-02 Thread Edward Elliott
[EMAIL PROTECTED] wrote: For the list [1,2,3,4], I'm looking for the following for k = 2: [[1,2], [3,4]] [[1,3], [2,4]] [[1,4], [2,3]] That's not what you asked for the first time. You said you wanted m non-empty, disjoint subsets, but the subsets above are clearly not all disjoint; only

Re: returning none when it should be returning a list?

2006-05-02 Thread Christos Georgiou
On 1 May 2006 07:19:48 -0700, rumours say that [EMAIL PROTECTED] might have written: I'm not sure what falls off the end of the function means, i searched online, it seems to mean that the function has reached the end prematurely and returned a default identifier to signal success or not.. Can

Re: Can Python kill a child process that keeps on running?

2006-05-02 Thread Edward Elliott
Serge Orlov wrote: I. Myself wrote: Suppose it is supposed to run for one minute, but it just keeps going and going. Does Python have any way to kill it? On linux it's pretty easy to do, just setup alarm signal. On windows it's not so trivial to the point you cannot do it using python.org

Re: stripping blanks

2006-05-02 Thread seeker
[EMAIL PROTECTED] wrote: hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz ---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1:

Re: Non-web-based templating system

2006-05-02 Thread Fuzzyman
[EMAIL PROTECTED] wrote: Hi, I'm creating a small application in Python that uses lists and dictionaries to create a rudimentary database. I'd like to create some fill-in-the-blanks reports from this data, ideally by taking an RTF or plaintext file as a template and replacing placeholder

Re: returning none when it should be returning a list?

2006-05-02 Thread Iain King
John Machin wrote: # Doh! Looks like recursion not necessary. Google 'eliminate tail recursion' :-) I did, and found this: http://www.biglist.com/lists/dssslist/archives/199907/msg00389.html which explains that the Scheme compiler optimises (obvious) tail recursion into iterative code. I'm

Re: Using elementtree: replacing nodes

2006-05-02 Thread André
Fredrik Lundh wrote: André wrote: I've started using elementtree and don't understand how to use it to manipulate and replace nodes. [snip] It was mostly the following step which I couldn`t figure out... # 2) mutate the pre element pre.clear() pre.tag = form pre[:] =

Re: returning none when it should be returning a list?

2006-05-02 Thread Christos Georgiou
On 2 May 2006 03:03:45 -0700, rumours say that Iain King [EMAIL PROTECTED] might have written: John Machin wrote: # Doh! Looks like recursion not necessary. Google 'eliminate tail recursion' :-) I did, and found this: http://www.biglist.com/lists/dssslist/archives/199907/msg00389.html which

Re: Non-web-based templating system

2006-05-02 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: I'm creating a small application in Python that uses lists and dictionaries to create a rudimentary database. I'd like to create some fill-in-the-blanks reports from this data, ideally by taking an RTF or plaintext file as a template and replacing

Re: stripping

2006-05-02 Thread Tim Williams
On 1 May 2006 23:20:56 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:hii have a file test.dat egabcdefghijklmn -newline opqrstuvwxyz---newlineI wish to print the contents of the file such that it appears:abcdefghijklmnopqrstuvwxyzhere is what i did:f = open(test.dat) while 1:line =

Re: stripping

2006-05-02 Thread Tim Williams
On 02/05/06, Tim Williams [EMAIL PROTECTED] wrote: On 1 May 2006 23:20:56 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:hii have a file test.dat eg f = open(test.dat) while 1: line = f.readline().rstrip(\n) if line: print line is simpler and easier to read. Except for my obvious mistake,

Re: string.find first before location

2006-05-02 Thread Peter Otten
Gary Wessle wrote: These days str methods are preferred over the string module's functions. text = abc abc and Here and there here_pos = text.find(Here) text.rfind(abc, 0, here_pos) 4 Peter and what about when python 3.0 is released and those depreciated functions like find and

Re: noob question: TypeError wrong number of args

2006-05-02 Thread bruno at modulix
Edward Elliott wrote: Holger wrote: oops, that was kinda embarrassing. It's really not. You got a completely unhelpful error message saying you passed 2 args when you only passed one explicitly. The fact the b is also an argument to b.addfile(f) is totally nonobvious until you know

Re: set partitioning

2006-05-02 Thread Boris Borcic
[EMAIL PROTECTED] wrote: For the list [1,2,3,4], I'm looking for the following for k = 2: [[1,2], [3,4]] [[1,3], [2,4]] [[1,4], [2,3]] for k = 3: [[1,2,3], [4]] [[1,2,4], [3]] [[1,3,4], [2]] [[2,3,4], [1]] def pickk(k,N,m=0) : if k==1 : return ((n,) for n in

pyqt v3.* and v4.*

2006-05-02 Thread Skink
Hi, Is it possible to have both versions of pyqt (in my case 3.14.1 and 4.0)? Version 3 is built using sip 4.2.1, version 4 is built using sip 4.4.3 When I run pyqt 4.0 (but with installed sip 4.2.1) I get: from PyQt4 import QtCore, QtGui TypeError: invalid argument to sipBadCatcherResult()

Strange result with math.atan2()

2006-05-02 Thread Vedran Furač
I think that this results must be the same: In [3]: math.atan2(-0.0,-1) Out[3]: -3.1415926535897931 In [4]: math.atan2(-0,-1) Out[4]: 3.1415926535897931 In [5]: -0 == -0.0 Out[5]: True This is python 2.4.4c0 on Debian GNU/Linux. Regards, Vedran Furač --

Re: wxPython, wxcombobox opening

2006-05-02 Thread Philippe Martin
Hi, From the wxPython list: Hi, Which event must I catch to be called when the user clicks on the combo button to make the drop down list to appear ? No, there isn't a specific event for the opening of the drop-down box. Regards, Philippe Philippe Martin wrote: Hi, I do not

Re: --version?

2006-05-02 Thread Adonis
Paul Watson wrote: Is there any chance that Python would support the --version command line parameter? It seems that many open source programs use this switch to report their version number. try at a command prompt: python -V Hope this helps. Adonis --

Re: string.find first before location

2006-05-02 Thread Peter Otten
Serge Orlov wrote: Peter Otten wrote: Gary Wessle wrote: These days str methods are preferred over the string module's functions. text = abc abc and Here and there here_pos = text.find(Here) text.rfind(abc, 0, here_pos) 4 Peter and what about when python 3.0 is

Re: pyqt v3.* and v4.*

2006-05-02 Thread Skink
Phil Thompson wrote: Install the latest versions of PyQt3 and SIP. Thanks Phil! v4.0 v3.16 work with sip 4.4.3 ;) skink -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange result with math.atan2()

2006-05-02 Thread Peter Otten
Vedran Fura? wrote: I think that this results must be the same: In [3]: math.atan2(-0.0,-1) Out[3]: -3.1415926535897931 In [4]: math.atan2(-0,-1) Out[4]: 3.1415926535897931 In [5]: -0 == -0.0 Out[5]: True Glimpsing at the hardware formats: struct.pack(d, 0.0)

Re: Strange result with math.atan2()

2006-05-02 Thread Ben Caradoc-Davies
Vedran Furač wrote: I think that this results must be the same: In [3]: math.atan2(-0.0,-1) Out[3]: -3.1415926535897931 In [4]: math.atan2(-0,-1) Out[4]: 3.1415926535897931 -0 is converted to 0, then to 0.0 for calculation, losing the sign. You might as well write 0.0 instead of -0 The

Re: --version?

2006-05-02 Thread gry
I agree. The --version option has become quite a de-facto standard in the linux world. In my sys-admin role, I can blithely run initiate_global_thermonuclear_war --version to find what version we have, even if I don't know what it does... python --version would be a very helpful addition.

Pamie and Python - new browser focus

2006-05-02 Thread saltima
Hi all, I'm trying to automate my web browser testing by using Pamie and Python. Everything is going great except for when a new window opens up. (on the previous page, I click next, and a new window is opened up) The focus it seems is never transferred. I suspect this because the control is

Re: Strange result with math.atan2()

2006-05-02 Thread Serge Orlov
Vedran Furac wrote: Ben Caradoc-Davies wrote: Vedran Furac wrote: I think that this results must be the same: In [3]: math.atan2(-0.0,-1) Out[3]: -3.1415926535897931 In [4]: math.atan2(-0,-1) Out[4]: 3.1415926535897931 -0 is converted to 0, then to 0.0 for calculation, losing the

ConfigParser and multiple option names

2006-05-02 Thread Florian Lindner
Hello, since ConfigParser does not seem to support multiple times the same option name, like: dir=/home/florian dir=/home/john dir=/home/whoever (only the last one is read in) I wonder what the best way to work around this. I think the best solution would be to use a seperation character:

Re: stripping blanks

2006-05-02 Thread Fulvio
Alle 17:06, martedì 02 maggio 2006, seeker ha scritto:      printLine = line.rstrip(\n) I think that nobody considered if the text has (\r) or (\r\n) or (\n) at the end of the line(s). -- http://mail.python.org/mailman/listinfo/python-list

Re: stripping blanks

2006-05-02 Thread Duncan Booth
Fulvio wrote: Alle 17:06, martedì 02 maggio 2006, seeker ha scritto:      printLine = line.rstrip(\n) I think that nobody considered if the text has (\r) or (\r\n) or (\n) at the end of the line(s). You think wrongly. The suggested code opens the file in text mode so the line endings are

Re: bug in modulus?

2006-05-02 Thread Andrew Koenig
Andrew Koenig [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I disagree. For any two floating-point numbers a and b, with b != 0, it is always possible to represent the exact value of a mod b as a floating-point number--at least on every floating-point system I have ever

Python and Windows new Powershell

2006-05-02 Thread BartlebyScrivener
The Windows Powershell is available, fka Monad. Any special Python tricks? Just breezing through the manual, they seemed to have borrowed from any language they wanted in making a new scripting language. http://tinyurl.com/l9ghj rd -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser and multiple option names

2006-05-02 Thread Florian Lindner
Alexis Roda wrote: Florian Lindner escribió: I think the best solution would be to use a seperation character: dir=/home/florian, /home/john, home/whoever RCS uses , in filenames A kommata (,) is a valid character in path names. Ok, you can use quotes. What do you think? Any better

Re: ConfigParser and multiple option names

2006-05-02 Thread Larry Bates
Florian Lindner wrote: Hello, since ConfigParser does not seem to support multiple times the same option name, like: dir=/home/florian dir=/home/john dir=/home/whoever (only the last one is read in) I wonder what the best way to work around this. I think the best solution would be

milliseconds are not stored in the timestamp KInterbasDB + Firebird

2006-05-02 Thread Petr Jakes
I am trying to insert timestamp to the Firebird database using standard library datetime module example given in the KInterbasDB Usage Guide http://tinyurl.com/mplo4 , section Example Programs DATE/TIME/TIMESTAMP Even timestamp has the correct format before inserting to the database (2006-26-2

RFC 822 continuations

2006-05-02 Thread Florian Lindner
Hello, http://docs.python.org/lib/module-ConfigParser.html writes: with continuations in the style of RFC 822; what is meant with these continuations? Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

xml-rpc and 64-bit ints?

2006-05-02 Thread Mark Harrison
I've got an API that deals with 64 bit int values. Is there any way of handling this smoothly? Right now I'm casting the values into and out of strings for the API. If not, are there any nice alternatives to XML-RPC that support this? Many TIA! Mark -- Mark Harrison Pixar Animation Studios

Re: simultaneous assignment

2006-05-02 Thread John Salerno
Boris Borcic wrote: w == x False w is x True That's the opposite of what I want to happen. -- http://mail.python.org/mailman/listinfo/python-list

Re: simultaneous assignment

2006-05-02 Thread Diez B. Roggisch
John Salerno wrote: Diez B. Roggisch wrote: I can't imagine what you're actually after here, but assuming that you really need this Hard to explain because I'm still trying to figure out how to do it myself. I'm trying to solve a little puzzle using Python, even though I'm sure it's not

Re: simultaneous assignment

2006-05-02 Thread David Isaac
John Salerno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there a way to assign multiple variables to the same value, but so that an identity test still evaluates to False? Make sure the value is not a singleton. Assign them one at a time. w=1000 x=1000 w==x True w is x

Re: simultaneous assignment

2006-05-02 Thread Diez B. Roggisch
Hmm, classes still scare me a little, but I should consider this. The only thing is, it is not known in advance if the propositions are true or false, you have to figure that out yourself based on the combination of the statements given. I don't know if this changes the idea behind your

Polling from keyboard

2006-05-02 Thread [EMAIL PROTECTED]
I am trying to find a way to poll the keyboard. In my searching, I have found that Windows users are given the msvcrt module. Is there an equivilant for Unix systems? I am writing a p2p chat application, and would like to ideally approach user input in a manner similar to the way I am using

Re: using ftplib

2006-05-02 Thread John Salerno
Dave Hughes wrote: As far as I recall your speculation is indeed correct: a TYPE command is only necessary before a transfer (it's only used to transform data passing over the secondary data connection). I'm reasonably certain you don't need *anything* before a SITE command (like SITE CHMOD),

Re: simultaneous assignment

2006-05-02 Thread John Salerno
bruno at modulix wrote: Now if I may ask: what is your actual problem ? Ok, since you're so curious. :) Here's a scan of the page from the puzzle book: http://johnjsalerno.com/spies.png Basically I'm reading this book to give me little things to try out in Python. There's no guarantee that

Re: unable to resize mmap object

2006-05-02 Thread Fabiano Sidler
On Sunday 30 April 2006 21:06, Serge Orlov wrote: Fabiano Sidler wrote: Now, when I try to resize mm to 10 byte --- snip --- mm.resize(10) --- snap --- I get an EnvironmentError:[Errno 22] Invalid argument. Just a guess: try a new size argument that is multiple of page size. No, doesn't

Re: SGML parsing tags and leeping track

2006-05-02 Thread hapaboy2059
could i make a global variable and keep track of each tag count? Also how would i make a list or dictionary of tags that is found? how can i handle any tag that is given? -- http://mail.python.org/mailman/listinfo/python-list

Re: simultaneous assignment

2006-05-02 Thread Steve R. Hastings
On Tue, 02 May 2006 17:15:05 +, John Salerno wrote: Basically W, X, Y and Z are propositions that are either true or false, and the puzzle lists a few statements such as Exactly one of X, Y and Z is true, and I'm trying to work out a little algorithm that might test for this kind of

Re: simultaneous assignment

2006-05-02 Thread John Salerno
Steve R. Hastings wrote: Anyway, the major point I want you to take away from all this: it doesn't matter whether the is test succeeds or fails, if all you care about is the *value* of a variable. Python reuses object references to save memory, because this doesn't affect expressions that

Re: Multi-Monitor Support

2006-05-02 Thread Jesse Hager
Mark rainess wrote: Hello, Does Python or wxPython include any support for multiple monitors. In my application multiple monitors are located at a distance. It is not convenient to move a window from the main monitor to one of the others. I want to have the option to open an an

Wake on LAN and Shutdown for Windows and Linux

2006-05-02 Thread diffuser78
I am using 8 computers on a small network. I have one Main computer which should be able to remotely start other computers. I used Wake on LAN to start them all. My Main computer is Linux. Other 4 are Windows and 3 are Linux. How can I shutdown Windows box from my Main (Linux) ? Also, How can

Re: simultaneous assignment

2006-05-02 Thread Grant Edwards
On 2006-05-02, John Salerno [EMAIL PROTECTED] wrote: Yeah, after trying some crazy things, I just wrote it this way: def truth_test(seq): truth = 0 for item in seq: if item: truth += 1 if truth == 1: return True else: return

Re: stripping

2006-05-02 Thread Edward Elliott
[EMAIL PROTECTED] wrote: while 1: line = f.readline().rstrip(\n) if line == '': break #if not re.findall(r'^$',line): print line you want continue, not break there. but that gives you an infinite loop, so you need a new exit condition.

Re: stripping

2006-05-02 Thread Jesse Hager
[EMAIL PROTECTED] wrote: hi i have a file test.dat eg abcdefgh ijklmn -newline opqrs tuvwxyz ---newline I wish to print the contents of the file such that it appears: abcdefgh ijklmn opqrs tuvwxyz here is what i did: f = open(test.dat) while 1:

Re: simultaneous assignment

2006-05-02 Thread Boris Borcic
Steve R. Hastings wrote: So, don't test to see if something is equal to True or False: if 0 == False: pass # never executed; False and 0 do not directly compare of course they do - ie isinstance(False,int) is True and False == 0 You *could* do this, but I don't really recommend

Re: simultaneous assignment

2006-05-02 Thread Grant Edwards
On 2006-05-02, John Salerno [EMAIL PROTECTED] wrote: Python knows how to count. :) def countFalse(seq): return len([v for v in seq if not v]) def countTrue(seq): return len([v for v in seq if v]) def truth_test(seq): return countTrue(seq) == 1 Gosh, so much to learn!

Re: simultaneous assignment

2006-05-02 Thread Boris Borcic
Grant Edwards wrote: Python knows how to count. :) def countFalse(seq): return len([v for v in seq if not v]) def countTrue(seq): return len([v for v in seq if v]) def truth_test(seq): return countTrue(seq) == 1 I'd suggest the more direct def countFalse(seq) :

Python SSL

2006-05-02 Thread James Stroud
Hello All, I have been trying to make an https client with python, but it seems that, to do this, one needs to have the socket module compiled with ssl. This is not the default. So I have a couple of questions. 1. Where do I specify to compile socket with ssl? I found no

Re: simultaneous assignment

2006-05-02 Thread Steve R. Hastings
On Tue, 02 May 2006 19:11:36 +, John Salerno wrote: Grant Edwards wrote: Python knows how to count. :) def countFalse(seq): return len([v for v in seq if not v]) def countTrue(seq): return len([v for v in seq if v]) def truth_test(seq): return countTrue(seq) == 1

making IE toolbars visible

2006-05-02 Thread david brochu jr
Anyone know how if there is a module out there or some way to automate making an IE toolbar visible in IE? Thanks, Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Python SSL

2006-05-02 Thread Benji York
James Stroud wrote: I have been trying to make an https client with python You probably don't want to use the standard library for HTTPS; here's a quote from the socket module docs about SSL: Warning: This does not do any certificate verification! I'd recommend M2Crypto instead:

Re: simultaneous assignment

2006-05-02 Thread Terry Reedy
John Salerno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm sure it's not necessary. Basically W, X, Y and Z are propositions that are either true or false, and the puzzle lists a few statements such as Exactly one of X, Y and Z is true, and I'm trying to work out a little

Re: simultaneous assignment

2006-05-02 Thread Grant Edwards
On 2006-05-02, Boris Borcic [EMAIL PROTECTED] wrote: Grant Edwards wrote: Python knows how to count. :) def countFalse(seq): return len([v for v in seq if not v]) def countTrue(seq): return len([v for v in seq if v]) def truth_test(seq): return countTrue(seq) == 1

Re: RFC 822 continuations

2006-05-02 Thread steven . vereecken
Larry Bates wrote: Florian Lindner wrote: Hello, http://docs.python.org/lib/module-ConfigParser.html writes: with continuations in the style of RFC 822; what is meant with these continuations? Thanks, Florian From ConfigParser source code: Continuations are represented by

Re: Polling from keyboard

2006-05-02 Thread Jean-Paul Calderone
On 2 May 2006 11:04:58 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am trying to find a way to poll the keyboard. In my searching, I have found that Windows users are given the msvcrt module. Is there an equivilant for Unix systems? I am writing a p2p chat application, and would like to

redemo.py with Tkinter

2006-05-02 Thread Gary Wessle
Hi I was reading the Regular Expression HowTo, it refers to redemo.py if you have Tkinter installed. a quick #locate redemo.py returned none on my debian/testing, however #locate Tkinter returned many. any body out there is using it, is it a separate download? thanks --

Re: ConfigParser and multiple option names

2006-05-02 Thread Edward Elliott
Florian Lindner wrote: I think the best solution would be to use a seperation character: dir=/home/florian, /home/john, home/whoever What character would be best to work on various operating systems? (of what names may a path consist is the question) I don't think there are any

Re: simultaneous assignment

2006-05-02 Thread Boris Borcic
Grant Edwards wrote: On 2006-05-02, Boris Borcic [EMAIL PROTECTED] wrote: Grant Edwards wrote: Python knows how to count. :) def countFalse(seq): return len([v for v in seq if not v]) def countTrue(seq): return len([v for v in seq if v]) def truth_test(seq): return

Re: unable to resize mmap object

2006-05-02 Thread Carl Banks
Fabiano Sidler wrote: Hi folks! I created an mmap object like so: --- snip --- from mmap import mmap,MAP_ANONYMOUS,MAP_PRIVATE fl = file('/dev/zero','rw') mm = mmap(fl.fileno(), 1, MAP_PRIVATE|MAP_ANONYMOUS) --- snap --- Now, when I try to resize mm to 10 byte --- snip ---

[SPOILER] Re: simultaneous assignment

2006-05-02 Thread Boris Borcic
John Salerno wrote: bruno at modulix wrote: Now if I may ask: what is your actual problem ? Ok, since you're so curious. :) Here's a scan of the page from the puzzle book: http://johnjsalerno.com/spies.png Basically I'm reading this book to give me little things to try out in

Re: Python SSL

2006-05-02 Thread James Stroud
Benji York wrote: James Stroud wrote: I have been trying to make an https client with python You probably don't want to use the standard library for HTTPS; here's a quote from the socket module docs about SSL: Warning: This does not do any certificate verification! I'd

Re: simultaneous assignment

2006-05-02 Thread Serge Orlov
John Salerno wrote: bruno at modulix wrote: Now if I may ask: what is your actual problem ? Ok, since you're so curious. :) Here's a scan of the page from the puzzle book: http://johnjsalerno.com/spies.png Basically I'm reading this book to give me little things to try out in Python.

Re: simultaneous assignment

2006-05-02 Thread Edward Elliott
bruno at modulix wrote: re-phrase it according to how Python works, and you'll get the answer: Is there a way to bind multiple names to the same object, but so the identity of this object is different from the identity of this object ? Which raises an interesting parallel question: is there

What is wrong with the Python home page?

2006-05-02 Thread fuzzylollipop
I am using FireFox 1.5.2 on OS X 10.4.6 and the www.python.org ends up being only text with just the nasa picture with the guy in the space suit. It looks like the CSS is hosed or something. And trying to go to the module docs for the current release is broken as well --

Re: simultaneous assignment

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 22:39 schrieb Edward Elliott: Which raises an interesting parallel question: is there a way to clone an arbitrary object? Yes, check the copy module. copy.copy() does a shallow copy of the parameter, copy.deepcopy() a deep copy of the parameter. For the difference

Re: stripping blanks

2006-05-02 Thread Edward Elliott
Scott David Daniels wrote: A little better: f = open(test.dat) for line in f: printLine = line.rstrip(\n) if printLine: print printLine [sys.stdout.write(line) for line in open('test.dat') if line.rstrip('\n')] Where's my prize? What do you mean,

Re: simultaneous assignment

2006-05-02 Thread Edward Elliott
Heiko Wundram wrote: Integer and string objects are immutable in Python, so why'd you want to have different IDs for an object of the same value? It's the value you're working with in a program, not the objects ID. At least it should be, if you're truly intent on working with the

Re: An Atlas of Graphs with Python

2006-05-02 Thread Harry George
Paddy [EMAIL PROTECTED] writes: A little off topic I'm afraid Giandomenico, But I had to smile. Here is someone working in the field of linguistics, who wants a programming solution, in the language Python. (It's Larry Wall, creator of Perl that cites his linguistic foundations). -- Pad.

Re: simultaneous assignment

2006-05-02 Thread Gary Duzan
In article [EMAIL PROTECTED], John Salerno [EMAIL PROTECTED] wrote: bruno at modulix wrote: Now if I may ask: what is your actual problem ? Ok, since you're so curious. :) Here's a scan of the page from the puzzle book: http://johnjsalerno.com/spies.png Basically I'm reading this book to

data regex match

2006-05-02 Thread Gary Wessle
Hi I am having an issue with this match tx = now 04/30/2006 then data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) d = data.search(tx) print d Nono I was expecting 04/30/2006, what went wrong? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible constant assignment operators := and ::= for Python

2006-05-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Hi Pythonians, To begin with I'd like to apologize that I am not very experienced Python programmer so please forgive me if the following text does not make any sense. I have been missing constants in Python language. Why so ? I guess you're talking about

Re: simultaneous assignment

2006-05-02 Thread Grant Edwards
On 2006-05-02, Boris Borcic [EMAIL PROTECTED] wrote: Grant Edwards wrote: On 2006-05-02, Boris Borcic [EMAIL PROTECTED] wrote: Grant Edwards wrote: Python knows how to count. :) def countFalse(seq): return len([v for v in seq if not v]) def countTrue(seq): return len([v for v in

Re: What is wrong with the Python home page?

2006-05-02 Thread Chris Lambacher
Works for me with FireFox 1.5.2, but I am on WinXP at the moment. -Chris On Tue, May 02, 2006 at 01:43:58PM -0700, fuzzylollipop wrote: I am using FireFox 1.5.2 on OS X 10.4.6 and the www.python.org ends up being only text with just the nasa picture with the guy in the space suit. It looks

Re: data regex match

2006-05-02 Thread Fredrik Lundh
Gary Wessle wrote: I am having an issue with this match tx = now 04/30/2006 then data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) d = data.search(tx) print d Nono I was expecting 04/30/2006 really? your pattern matches two digits, followed by a slash, followed by a byte with the

urllib2 not support proxy on SSL connection?

2006-05-02 Thread itay_k
Hi, I am running the following simple code (just open connection to some https page with proxy): proxy= '666.179.227.666:80' proxy=urllib2.ProxyHandler({https:'https://'+proxy}) opener = urllib2.build_opener(proxy) request = urllib2.Request('https://somehttpspage') response =

Re: data regex match

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 23:06 schrieb Gary Wessle: Hi I am having an issue with this match tx = now 04/30/2006 then data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) As always, use a raw string for regular expressions. \d is being interpreted to mean an ascii character, and not to mean

Re: data regex match

2006-05-02 Thread Rene Pijlman
Gary Wessle: tx = now 04/30/2006 then data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) d = data.search(tx) print d Nono I was expecting 04/30/2006 You should expect: NameError: name 're' is not defined what went wrong? \1 matches the content of the first group, which is '04'. It doesn't

  1   2   >