Re: float(nan) in set or as key

2011-05-29 Thread John Nagle
On 5/28/2011 6:04 PM, Gregory Ewing wrote: MRAB wrote: float(nan) can occur multiple times in a set or as a key in a dict: {float(nan), float(nan)} {nan, nan} except that sometimes it can't: nan = float(nan) {nan, nan} {nan} NaNs are weird. They're not equal to themselves: Python 2.7

Re: Class decorators might also be super too

2011-05-29 Thread Michele Simionato
He is basically showing that using mixins for implementing logging is not such a good idea, i.e. you can get the same effect in a better way by making use of other Python features. I argued the same thing many times in the past. I even wrote a module once (strait) to reimplement 99% of multiple

Re: Beginner needs advice

2011-05-29 Thread Ian Kelly
On Sat, May 28, 2011 at 8:33 PM, harrismh777 harrismh...@charter.net wrote: In this present case the straw-man was not me, rather the straw-man was the python language itself. You chose a code-snippet (one small puny dangle that doesn't prove a thing) and used it to speak for the entire

Re: float(nan) in set or as key

2011-05-29 Thread Wolfgang Rohdewald
On Sonntag 29 Mai 2011, Tim Delaney wrote: There's a second part the mystery - sets and dictionaries (and I think lists) assume that identify implies equality (hence the second result). This was recently discussed on python-dev, and the decision was to leave things as-is. On Sonntag 29 Mai

Re: float(nan) in set or as key

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 10:32:43 +1000, Chris Angelico wrote: On Sun, May 29, 2011 at 10:28 AM, Albert Hopkins mar...@letterboxes.org wrote: This is the same nan, so it is equal to itself. Actually, they're not. But it's possible the dictionary uses an 'is' check to save computation, and if

Error: child process close a socket inherited from parent

2011-05-29 Thread narke
Hi, As illustrated in the following simple sample: import sys import os import socket class Server: def __init__(self): self._listen_sock = None def _talk_to_client(self, conn, addr): text = 'The brown fox jumps over the lazy dog.\n' while True:

scope of function parameters

2011-05-29 Thread Henry Olders
I just spent a considerable amount of time and effort debugging a program. The made-up code snippet below illustrates the problem I encountered: def main(): a = ['a list','with','three elements'] print a print fnc1(a) print a def fnc1(b): return

Re: scope of function parameters

2011-05-29 Thread Wolfgang Rohdewald
On Sonntag 29 Mai 2011, Henry Olders wrote: It seems that in Python, a variable inside a function is global unless it's assigned. no, they are local I would have thought that a function parameter would automatically be considered local to the function. It doesn't make sense to me to pass a

Re: scope of function parameters

2011-05-29 Thread Chris Rebert
On Sun, May 29, 2011 at 1:30 AM, Henry Olders henry.old...@mcgill.ca wrote: I just spent a considerable amount of time and effort debugging a program. The made-up code snippet below illustrates the problem I encountered: def main():        a = ['a list','with','three elements']        print

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
Tim Roberts wrote: Are you specifying a buffer size in the Popen command? If not, then the Python side of things is unbuffered The buffer is as per default. The program reports one line around 1/2 second time. I think I'll look into the option as Nobody states: p =

Re: How to catch a line with Popen

2011-05-29 Thread Chris Rebert
On Sun, May 29, 2011 at 3:02 AM, TheSaint nob...@nowhere.net.no wrote: Tim Roberts wrote: Are you specifying a buffer size in the Popen command?  If not, then the Python side of things is unbuffered The buffer is as per default. The program reports one line around 1/2 second time. I think

Re: float(nan) in set or as key

2011-05-29 Thread Steven D'Aprano
On Sat, 28 May 2011 23:12:54 -0700, John Nagle wrote: The correct answer to nan == nan is to raise an exception, because you have asked a question for which the answer is nether True nor False. Wrong. The correct answer to nan == nan is False, they are not equal. Just as None != none,

Re: The worth of comments

2011-05-29 Thread Gregory Ewing
Ben Finney wrote: You omit the common third possibility: *both* the comment and the code are wrong. In that case, the correct response is to fix both of them. :-) -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Class decorators might also be super too

2011-05-29 Thread Vinay Sajip
On May 29, 7:33 am, Michele Simionato michele.simion...@gmail.com wrote: He is basically showing that using mixins for implementingloggingis not such a good idea, I don't think he was particularly advocating implementing logging this way, but rather just using logging for illustrative

Weird problem matching with REs

2011-05-29 Thread Andrew Berg
I have an RE that should work (it even works in Kodos [1], but not in my code), but it keeps failing to match characters after a newline. I'm writing a little program that scans the webpage of an arbitrary application and gets the newest version advertised on the page. test3.py: # -*- coding:

Re: scope of function parameters

2011-05-29 Thread Mel
Henry Olders wrote: I just spent a considerable amount of time and effort debugging a program. The made-up code snippet below illustrates the problem I encountered: def main(): a = ['a list','with','three elements'] print a print fnc1(a) print a def fnc1(b): return fnc2(b) def

Re: scope of function parameters

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 11:47:26 +0200, Wolfgang Rohdewald wrote: On Sonntag 29 Mai 2011, Henry Olders wrote: It seems that in Python, a variable inside a function is global unless it's assigned. no, they are local I'm afraid you are incorrect. Names inside a function are global unless

Re: Weird problem matching with REs

2011-05-29 Thread Ben Finney
Andrew Berg bahamutzero8...@gmail.com writes: I was able to make a regex that matches in my code, but it shouldn't: http://x264.nl/x264/64bit/8bit_depth/revision.\n{1,3}[0-9]{4}.\n{1,3}/x264.\n{1,3}.\n{1,3}.exe I have to add a dot before each \n. There is no character not accounted for before

Re: Weird problem matching with REs

2011-05-29 Thread Ben Finney
Ben Finney ben+pyt...@benfinney.id.au writes: the two-character “CR LF” sequence (U+000C U+000A) URL:http://en.wikipedia.org/wiki/Newline As detailed in that Wikipedia article, the characters are of course U+000D U+000A. -- \ “You say “Carmina”, and I say “Burana”, You say

Re: Weird problem matching with REs

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 06:45:30 -0500, Andrew Berg wrote: I have an RE that should work (it even works in Kodos [1], but not in my code), but it keeps failing to match characters after a newline. Not all regexes are the same. Different regex engines accept different symbols, and sometimes behave

Re: Weird problem matching with REs

2011-05-29 Thread Andrew Berg
On 2011.05.29 08:00 AM, Ben Finney wrote: You are aware that most text-emitting processes on Windows, and Internet text protocols like the HTTP standard, use the two-character “CR LF” sequence (U+000C U+000A) for terminating lines? Yes, but I was not having trouble with just '\n' before, and

Re: Weird problem matching with REs

2011-05-29 Thread Andrew Berg
On 2011.05.29 08:09 AM, Steven D'Aprano wrote: On Sun, 29 May 2011 06:45:30 -0500, Andrew Berg wrote: I have an RE that should work (it even works in Kodos [1], but not in my code), but it keeps failing to match characters after a newline. Not all regexes are the same. Different regex

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
Chris Rebert wrote: What do you mean by on-the-fly in this context I just suppose to elaborate the latest line, as soon it's written on the pipe, and print some result on the screen. Imaging something like p= Popen(['ping','-c40','www.google.com'], stdout=PIPE) for line in p.stdout:

Re: Error: child process close a socket inherited from parent

2011-05-29 Thread narke
On 2011-05-29, narke narkewo...@gmail.com wrote: Hi, As illustrated in the following simple sample: import sys import os import socket class Server: def __init__(self): self._listen_sock = None def _talk_to_client(self, conn, addr): text = 'The brown fox jumps

Re: Beginner needs advice

2011-05-29 Thread Steven D'Aprano
On Sat, 28 May 2011 21:02:47 -0500, harrismh777 wrote: Minor, yes, until you need to make something work--- only to be frustrated to find that a detail that was not expected has risen to bite a sensitive place... :) Just like when migrating from Python 2.3 to 2.6. And 1.5 and 2.0,

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
TheSaint wrote: I just suppose to elaborate the latest line, as soon it's written on the pipe, and print some result on the screen. I think some info is also here: http://alexandredeverteuil.blogspot.com/ -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird problem matching with REs

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 08:41:16 -0500, Andrew Berg wrote: On 2011.05.29 08:09 AM, Steven D'Aprano wrote: [...] Kodos is written in Python and uses Python's regex engine. In fact, it is specifically intended to debug Python regexes. Fair enough. Secondly, you probably should use a proper HTML

Re: Weird problem matching with REs

2011-05-29 Thread Andrew Berg
On 2011.05.29 09:18 AM, Steven D'Aprano wrote: What makes you think it shouldn't match? AFAIK, dots aren't supposed to match carriage returns or any other whitespace characters. They won't match *newlines* \n unless you pass the DOTALL flag, but they do match whitespace:

Re: float(nan) in set or as key

2011-05-29 Thread Grant Edwards
On 2011-05-29, Wolfgang Rohdewald wolfg...@rohdewald.de wrote: On Sonntag 29 Mai 2011, Tim Delaney wrote: There's a second part the mystery - sets and dictionaries (and I think lists) assume that identify implies equality (hence the second result). This was recently discussed on python-dev,

Re: The worth of comments

2011-05-29 Thread Grant Edwards
On 2011-05-29, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Ben Finney wrote: You omit the common third possibility: *both* the comment and the code are wrong. In that case, the correct response is to fix both of them. :-) Only as a last resort. IMO, the best option is to fix the code

Re: Weird problem matching with REs

2011-05-29 Thread Roy Smith
In article mailman..1306676482.9059.python-l...@python.org, Andrew Berg bahamutzero8...@gmail.com wrote: Kodos is written in Python and uses Python's regex engine. In fact, it is specifically intended to debug Python regexes. Named after the governor of Tarsus IV? --

Re: Weird problem matching with REs

2011-05-29 Thread Andrew Berg
On 2011.05.29 10:19 AM, Roy Smith wrote: Named after the governor of Tarsus IV? Judging by the graphic at http://kodos.sourceforge.net/help/kodos.html , it's named after the Simpsons character. -- http://mail.python.org/mailman/listinfo/python-list

Re: The worth of comments

2011-05-29 Thread Roy Smith
In article irtm3d$qk3$2...@reader1.panix.com, Grant Edwards invalid@invalid.invalid wrote: On 2011-05-29, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Ben Finney wrote: You omit the common third possibility: *both* the comment and the code are wrong. In that case, the correct

Re: Weird problem matching with REs

2011-05-29 Thread John S
On May 29, 10:35 am, Andrew Berg bahamutzero8...@gmail.com wrote: On 2011.05.29 09:18 AM, Steven D'Aprano wrote: What makes you think it shouldn't match? AFAIK, dots aren't supposed to match carriage returns or any other whitespace characters. I got things mixed up there (was thinking

Re: Weird problem matching with REs

2011-05-29 Thread Andrew Berg
On 2011.05.29 10:48 AM, John S wrote: Dots don't match end-of-line-for-your-current-OS is how I think of it. IMO, the docs should say the dot matches any character except a line feed ('\n'), since that is more accurate. True, malformed HTML can throw you off, but they can also throw a parser

Re: Weird problem matching with REs

2011-05-29 Thread John S
On May 29, 12:16 pm, Andrew Berg bahamutzero8...@gmail.com wrote: I've been meaning to learn how to use parenthesis groups. Also, be sure to use a raw string when composing REs, so you don't run into backslash issues. How would I do that when grabbing strings from a config file (via the

Re: scope of function parameters

2011-05-29 Thread Peter Pearson
On Sun, 29 May 2011 04:30:52 -0400, Henry Olders wrote: [snip] def main(): a = ['a list','with','three elements'] print a print fnc1(a) print a def fnc1(b): return fnc2(b) def fnc2(c): c[1] = 'having' return c This is the output: ['a

Re: The worth of comments

2011-05-29 Thread Alister Ware
On Sun, 29 May 2011 12:47:52 +1200, Gregory Ewing wrote: Irmen de Jong wrote: I don't see how that is opposed to what Grant was saying. It's that these 'contracts' tend to change and that people forget or are too lazy to update the comments to reflect those changes. However, I can't see

Re: float(nan) in set or as key

2011-05-29 Thread MRAB
On 29/05/2011 15:41, Grant Edwards wrote: On 2011-05-29, Wolfgang Rohdewaldwolfg...@rohdewald.de wrote: On Sonntag 29 Mai 2011, Tim Delaney wrote: There's a second part the mystery - sets and dictionaries (and I think lists) assume that identify implies equality (hence the second result).

Re: float(nan) in set or as key

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 3:44 AM, MRAB pyt...@mrabarnett.plus.com wrote: Would there be any advantage to making NaN a singleton? I'm thinking that it could make checking for it cheaper in the implementation of sets and dicts. Or making NaN unhashable? Doesn't matter. It still wouldn't be equal

Re: scope of function parameters

2011-05-29 Thread Chris Angelico
On Sun, May 29, 2011 at 10:47 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: If a name is assigned to anywhere in the function, treat it as a local, and look it up in the local namespace. If not found, raise UnboundLocalError. Wait wha? I've never seen this... wouldn't it

Re: Weird problem matching with REs

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 2:16 AM, Andrew Berg bahamutzero8...@gmail.com wrote: Also, be sure to use a raw string when composing REs, so you don't run into backslash issues. How would I do that when grabbing strings from a config file (via the configparser module)? Or rather, if I have a

Re: scope of function parameters

2011-05-29 Thread Chris Rebert
On Sun, May 29, 2011 at 10:53 AM, Chris Angelico ros...@gmail.com wrote: On Sun, May 29, 2011 at 10:47 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: If a name is assigned to anywhere in the function, treat it as a local, and look it up in the local namespace. If not found,

Re: float(nan) in set or as key

2011-05-29 Thread Christian Heimes
Am 29.05.2011 19:44, schrieb MRAB: Would there be any advantage to making NaN a singleton? I'm thinking that it could make checking for it cheaper in the implementation of sets and dicts. Or making NaN unhashable? It can't be a singleton, because IEEE 754 specifies millions of millions of

Re: float(nan) in set or as key

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 18:44:08 +0100, MRAB wrote: Would there be any advantage to making NaN a singleton? Absolutely not. That would be a step backwards. NANs can carry payload (a code indicating what sort of NAN it represents -- log(-1) and 1/INF are not the same). So although Python currently

Re: scope of function parameters

2011-05-29 Thread Steven D'Aprano
On Mon, 30 May 2011 03:53:24 +1000, Chris Angelico wrote: On Sun, May 29, 2011 at 10:47 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: If a name is assigned to anywhere in the function, treat it as a local, and look it up in the local namespace. If not found, raise

Re: scope of function parameters

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 4:01 AM, Chris Rebert c...@rebertia.com wrote: def foo():    print bar    bar = 42 foo() === Traceback (most recent call last):  File stdin, line 1, in module  File stdin, line 2, in foo UnboundLocalError: local variable 'bar' referenced before assignment Wow I

Re: float(nan) in set or as key

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 20:05:07 +0200, Christian Heimes wrote: Am 29.05.2011 19:44, schrieb MRAB: Would there be any advantage to making NaN a singleton? I'm thinking that it could make checking for it cheaper in the implementation of sets and dicts. Or making NaN unhashable? It can't be a

Re: scope of function parameters

2011-05-29 Thread Steven D'Aprano
On Mon, 30 May 2011 04:38:26 +1000, Chris Angelico wrote: On Mon, May 30, 2011 at 4:01 AM, Chris Rebert c...@rebertia.com wrote: def foo():    print bar    bar = 42 foo() === Traceback (most recent call last):  File stdin, line 1, in module  File stdin, line 2, in foo

Re: Weird problem matching with REs

2011-05-29 Thread Thomas 'PointedEars' Lahn
Andrew Berg wrote: On 2011.05.29 10:19 AM, Roy Smith wrote: Named after the governor of Tarsus IV? Judging by the graphic at http://kodos.sourceforge.net/help/kodos.html , it's named after the Simpsons character. OT I don't think that's a coincidence; both are from other planets and both

Re: scope of function parameters

2011-05-29 Thread Ian Kelly
On Sun, May 29, 2011 at 12:38 PM, Chris Angelico ros...@gmail.com wrote: I thought it basically functioned top-down. You get a different error on the print line if there's a bar = 42 *after* it. This could make debugging quite confusing. Guess it's just one of the consequences of eschewing

Re: scope of function parameters

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 4:53 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: UnboundLocalError is a subclass of NameError, so it will still be caught by try...except NameError. If you're crazy enough to be catching NameError :) Ah okay. So it is still NameError, it just

Re: Beginner needs advice

2011-05-29 Thread Jason Tackaberry
On 11-05-29 04:06 AM, Ian Kelly wrote: I realize you are now asserting that compatibility is a boolean condition, and that totally incompatible is a redundant phrase that you tossed out as a joke. As a casual lurker reading this thread, I believe he is equating completely incompatible with not

Re: scope of function parameters

2011-05-29 Thread Henry Olders
Henry On 2011-05-29, at 5:47 , Wolfgang Rohdewald wrote: On Sonntag 29 Mai 2011, Henry Olders wrote: It seems that in Python, a variable inside a function is global unless it's assigned. no, they are local I would have thought that a function parameter would automatically be

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 18, 7:19 am, Peter Moylan inva...@peter.pmoylan.org.invalid wrote: It's interesting to note that the definitions of 'recursive' to be found in Wikipedia and Wiktionary have very little in common with the definitions to be found in the dictionaries covered by Onelook.  No wonder experts

Re: scope of function parameters

2011-05-29 Thread Terry Reedy
On 5/29/2011 7:59 AM, Mel wrote: Henry Olders wrote: I just spent a considerable amount of time and effort debugging a program. The made-up code snippet below illustrates the problem I encountered: def main(): a = ['a list','with','three elements'] print a print fnc1(a) print a def fnc1(b):

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 18, 12:59 pm, s...@sig.for.address (Victor Eijkhout) wrote: Harrison Hill harrish...@gmx.com wrote: No need - I have the Dictionary definition of recursion here: Recursion: (N). See recursion. If you tell a joke, you have to tell it right. Jeez, speaking of bad colloquialisms...

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 18, 12:59 pm, s...@sig.for.address (Victor Eijkhout) wrote: Harrison Hill harrish...@gmx.com wrote: No need - I have the Dictionary definition of recursion here: Recursion: (N). See recursion. If you tell a joke, you have to tell it right. Jeez, speaking of bad colloquialisms...

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 18, 3:00 pm, Xah Lee xah...@gmail.com wrote: In the emacs case: “Recursive delete of xx? (y or n) ”, what could it possibly mean by the word “recursive” there? Like, it might delete the directory but not delete all files in it? Actually i think this case is more for scare factor than

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 20, 1:55 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Trust me on this, if the audience of Carry On films could understand recursion, anyone can! Well we could also say that this pathetic display of metal masturbation is recursive also. --

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 24, 5:06 pm, Rikishi42 skunkwo...@rikishi42.net wrote: On 2011-05-24, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I wonder whether physicists insist that cars should have a go faster pedal because ordinary people don't need to understand Newton's Laws of Motion in

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 24, 7:40 pm, Chris Angelico ros...@gmail.com wrote: On Wed, May 25, 2011 at 8:06 AM, Rikishi42 skunkwo...@rikishi42.net wrote: On 2011-05-24, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I wonder whether physicists insist that cars should have a go faster pedal

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 24, 7:40 pm, Chris Angelico ros...@gmail.com wrote: On Wed, May 25, 2011 at 8:06 AM, Rikishi42 skunkwo...@rikishi42.net wrote: On 2011-05-24, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I wonder whether physicists insist that cars should have a go faster pedal

Re: float(nan) in set or as key

2011-05-29 Thread Nobody
On Sun, 29 May 2011 10:29:28 +, Steven D'Aprano wrote: The correct answer to nan == nan is to raise an exception, because you have asked a question for which the answer is nether True nor False. Wrong. That's overstating it. There's a good argument to be made for raising an

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 6:58 AM, rantingrick rantingr...@gmail.com wrote: Yes Gas Pedal... that clears up all the confusion /sarcasm. However i would have thought if the vehicle had a decelerator petal it would at least sport a complimentary accelerator petal. You know the whole equal and

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 26, 6:12 am, Chris Angelico ros...@gmail.com wrote: I just conducted a rapid poll of a non-technical userbase. (Okay, I just asked my sister who happens to be sitting here. But she's nontechnical.) She explained recursive as it repeats until it can't go any further. I think that's a

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 26, 6:12 am, Chris Angelico ros...@gmail.com wrote: I just conducted a rapid poll of a non-technical userbase. (Okay, I just asked my sister who happens to be sitting here. But she's nontechnical.) She explained recursive as it repeats until it can't go any further. I think that's a

How to Use Setuptools, Alternatives?

2011-05-29 Thread ray
I have Python 2.7 on Win7 Pro on a tightly locked down desktop. I would like to install Networkx from an egg. From what I have read, Setuptools can be used for this. I don't know how to install Setuptools. The exe will not work. On execution, it reports that the Python version is not included

Re: scope of function parameters

2011-05-29 Thread Ben Finney
Peter Pearson ppearson@nowhere.invalid writes: Python works in terms of objects having names, and one object can have many names. Or no names. So it's less accurate (though better than talking of “variables”) to speak of Python objects “having names”. The names b and c aren't boxes that hold

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 7:38 AM, rantingrick rantingr...@gmail.com wrote: Yes but understanding of this sort is very general ESPECIALLY in the case of destroying data! What are the limits of the recursion? What forces can act on the recursion to stop it? If (for example) I know that a while

Re: scope of function parameters

2011-05-29 Thread Christopher Head
On Sun, 29 May 2011 16:19:11 -0400 Henry Olders henry.old...@mcgill.ca wrote: def fnc2(c): c = c[:] c[1] = 'having' return c Thank you, Wolfgang. That certainly works, but to me it is still a workaround to deal with the consequence of a particular decision.

Alternatives to PythonPath

2011-05-29 Thread ray
I am using Win7 on a tightly locked down desktop. Is there an alternative to using PythonPath? What are the trade-offs? Thanks, ray -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner needs advice

2011-05-29 Thread rantingrick
On May 28, 9:33 pm, harrismh777 harrismh...@charter.net wrote: Steven D'Aprano wrote: A straw man is not when somebody points out holes in your argument, or unwanted implications that you didn't realise were there. It is when somebody makes claims on your behalf that you did not make to

Re: scope of function parameters

2011-05-29 Thread Terry Reedy
On 5/29/2011 4:19 PM, Henry Olders wrote: From my perspective, a function parameter should be considered as having been assigned (although the exact assignment will not be known until runtime), and as an assigned variable, it should be considered local. That is exactly the case for Python

Re: How to Use Setuptools, Alternatives?

2011-05-29 Thread Irmen de Jong
On 29-5-2011 23:41, ray wrote: I have Python 2.7 on Win7 Pro on a tightly locked down desktop. I would like to install Networkx from an egg. From what I have read, Setuptools can be used for this. What does 'tightly locked down' mean? I don't know how to install Setuptools. The exe will

Re: Alternatives to PythonPath

2011-05-29 Thread Irmen de Jong
On 29-5-2011 23:49, ray wrote: I am using Win7 on a tightly locked down desktop. Is there an alternative to using PythonPath? What do you mean by using PythonPath? What doesn't work that you want to have an alternative for? Irmen -- http://mail.python.org/mailman/listinfo/python-list

[RELEASE] 3.1.4 release candidate 1

2011-05-29 Thread Benjamin Peterson
On behalf of the Python development team, I'm happy as a swallow to announce a release candidate for the fourth bugfix release for the Python 3.1 series, Python 3.1.4. 3.1.4 will the last bug fix release in the 3.1 series before 3.1. After 3.1.4, 3.1 will be in security-only fix mode. The Python

[RELEASE] Python 2.7.2 release candidate 1

2011-05-29 Thread Benjamin Peterson
On behalf of the Python development team, I'm happy to announce the immediate availability of Python 2.7.2 release candidate 1. 2.7.2 is the second in bugfix release for the Python 2.7 series. 2.7 is the last major verison of the 2.x line and will be receiving bug fixes while new feature

Re: English Idiom in Unix: Directory Recursively

2011-05-29 Thread rantingrick
On May 29, 4:46 pm, Chris Angelico ros...@gmail.com wrote: On Mon, May 30, 2011 at 7:38 AM, rantingrick rantingr...@gmail.com wrote: Yes but understanding of this sort is very general ESPECIALLY in the case of destroying data! What are the limits of the recursion? What forces can act on

Re: Beginner needs advice

2011-05-29 Thread rantingrick
On May 29, 2:28 pm, Jason Tackaberry t...@urandom.ca wrote: On 11-05-29 04:06 AM, Ian Kelly wrote: I realize you are now asserting that compatibility is a boolean condition, and that totally incompatible is a redundant phrase that you tossed out as a joke. As a casual lurker reading this

Re: Beginner needs advice

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 9:00 AM, rantingrick rantingr...@gmail.com wrote: Python 2.x and Pythin 3.x are two different dialects just like Humans (Python 3.x) and Chimpanzees (Python 2.x) are similar (compatible) but very different versions of talking apes (languages). Sure humans (Python 3.x)

Re: float(nan) in set or as key

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 22:19:49 +0100, Nobody wrote: On Sun, 29 May 2011 10:29:28 +, Steven D'Aprano wrote: The correct answer to nan == nan is to raise an exception, because you have asked a question for which the answer is nether True nor False. Wrong. That's overstating

Re: Error: child process close a socket inherited from parent

2011-05-29 Thread Chris Torek
In article slrniu42cm.2s8.narkewo...@cnzuhnb904.ap.bm.net narke narkewo...@gmail.com wrote: As illustrated in the following simple sample: import sys import os import socket class Server: def __init__(self): self._listen_sock = None def _talk_to_client(self, conn, addr):

Re: scope of function parameters

2011-05-29 Thread Steven D'Aprano
On Sun, 29 May 2011 04:30:52 -0400, Henry Olders wrote: I just spent a considerable amount of time and effort debugging a program. The made-up code snippet below illustrates the problem I encountered: [...] Are there others who feel as I do that a function parameter should always be local to

Re: float(nan) in set or as key

2011-05-29 Thread Chris Torek
Incidentally, note: $ python ... nan = float(nan) nan nan nan is nan True nan == nan False In article 4de1e3e7$0$2195$742ec...@news.sonic.net John Nagle na...@animats.com wrote: The correct answer to nan == nan is to raise an exception, because you

Re: float(nan) in set or as key

2011-05-29 Thread Carl Banks
On Sunday, May 29, 2011 4:31:19 PM UTC-7, Steven D#39;Aprano wrote: On Sun, 29 May 2011 22:19:49 +0100, Nobody wrote: On Sun, 29 May 2011 10:29:28 +, Steven D'Aprano wrote: The correct answer to nan == nan is to raise an exception, because you have asked a question for

Re: How to catch a line with Popen

2011-05-29 Thread Chris Torek
In article irtj2o$h0m$1...@speranza.aioe.org TheSaint nob...@nowhere.net.no wrote: Chris Rebert wrote: I just suppose to elaborate the latest line, as soon it's written on the pipe, and print some result on the screen. Imaging something like p= Popen(['ping','-c40','www.google.com'],

Re: float(nan) in set or as key

2011-05-29 Thread Carl Banks
On Sunday, May 29, 2011 7:41:13 AM UTC-7, Grant Edwards wrote: It treats them as identical (not sure if that's the right word). The implementation is checking for ( A is B or A == B ). Presumably, the assumpting being that all objects are equal to themselves. That assumption is not true for

Re: float(nan) in set or as key

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 10:55 AM, Carl Banks pavlovevide...@gmail.com wrote: If exceptions had commonly existed in that environment there's no chance they would have chosen that behavior; comparison against NaN (or any operation with NaN) would have signaled a floating point exception.  That

Re: scope of function parameters

2011-05-29 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: http://mail.python.org/pipermail/tutor/2010-December/080505.html Constructive criticism welcome. Informative, but it “buries the lead” as our friends in the press corps would say. Instead you should write as though you have no

Re: portable way of sending notifying a process

2011-05-29 Thread Chris Torek
In article 4de183e7$0$26108$426a7...@news.free.fr News123 news1...@free.fr wrote: I'm looking for a portable way (windows XP / Windows Vista and Linux ) to send a signal from any python script to another one (one signa would be enough) This turns out to be pretty hard to do reliably-and-securely

Re: scope of function parameters

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 11:31 AM, Ben Finney ben+pyt...@benfinney.id.au wrote:  URL:http://www.computerworld.com/s/article/print/93903/I_m_OK_The_Bull_Is_Dead I agree with the gist of that. My take on this is: When I'm talking to my boss, I always assume that the phone will ring ten seconds into

Re: portable way of sending notifying a process

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 11:44 AM, Chris Torek nos...@torek.net wrote: What would be a light weight portable way, that one process can tell another to do something? The main requirement would be to have no CPU impact while waiting (thus no polling) Your best bet here is probably to use sockets.  

Re: scope of function parameters

2011-05-29 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: Of course, there's a significant difference between a mailing list post and a detailed and well copyedited article. Quite frequently I'll ramble on list, in a way quite inappropriate to a publication that would be linked to as a hey guys, here's how it

Re: float(nan) in set or as key

2011-05-29 Thread Carl Banks
On Sunday, May 29, 2011 6:14:58 PM UTC-7, Chris Angelico wrote: On Mon, May 30, 2011 at 10:55 AM, Carl Banks wrote: If exceptions had commonly existed in that environment there's no chance they would have chosen that behavior; comparison against NaN (or any operation with NaN) would

Re: Alternatives to PythonPath

2011-05-29 Thread rusi
On May 30, 2:49 am, ray r...@aarden.us wrote: I am using Win7 on a tightly locked down desktop. Is there an alternative to using PythonPath? What are the trade-offs? Thanks, ray Externally: 1. PYTHONPATH 2. .pth files

Re: scope of function parameters

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 12:08 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Angelico ros...@gmail.com writes: Of course, there's a significant difference between a mailing list post and a detailed and well copyedited article. Quite frequently I'll ramble on list, in a way quite

Re: float(nan) in set or as key

2011-05-29 Thread Chris Angelico
On Mon, May 30, 2011 at 12:17 PM, Carl Banks pavlovevide...@gmail.com wrote: If I were designing a new floating-point standard for hardware, I would consider getting rid of NaN.  However, with the floating point standard that exists, that almost all floating point hardware mostly conforms to,

Re: float(nan) in set or as key

2011-05-29 Thread rusi
On May 30, 7:53 am, Chris Angelico ros...@gmail.com wrote: On Mon, May 30, 2011 at 12:17 PM, Carl Banks pavlovevide...@gmail.com wrote: If I were designing a new floating-point standard for hardware, I would consider getting rid of NaN.  However, with the floating point standard that

Re: Error: child process close a socket inherited from parent

2011-05-29 Thread narke
On 2011-05-29, Chris Torek nos...@torek.net wrote: In article slrniu42cm.2s8.narkewo...@cnzuhnb904.ap.bm.net narke narkewo...@gmail.com wrote: As illustrated in the following simple sample: import sys import os import socket class Server: def __init__(self): self._listen_sock =

  1   2   3   >