Changing the system clock with pexpect confuses pexpect!

2011-12-26 Thread Saqib Ali
See my code below. I'm controlling a shell logged in as root with pexpect. The class below has a method (startProc) which spawns a shell and keeps it alive until told to destroy it (stopProc). The other 2 methods in this class allow me to change the system clock and to get the IP Address of thi

Re: Python Openings

2011-12-26 Thread vivek poddar
Hi, I have just completed my B.tech this year and have above six months experience in OpenERP framework as a technical consultant.In these six months I have completed nearly 5 modules and acted as an active member.Now, my company is going under a financial crisis and so, I think I have to leave th

Re: Plot seems weird

2011-12-26 Thread Lie Ryan
On 12/26/2011 05:27 AM, Yigit Turgut wrote: On Dec 25, 7:06 pm, Rick Johnson wrote: On Dec 25, 9:33 am, Yigit Turgut wrote: Hi all, I have a text file as following; 0.2000470.00 0.2000530.16 0.2000590.00 0.2000650.08 0.2000720.

Re: Backslash Escapes

2011-12-26 Thread Lie Ryan
On 12/26/2011 12:04 PM, Felipe O wrote: Hi all, Whenever I take any input (raw_input, of course!) or I read from a file, etc., any backslashes get escaped automatically. Python never escapes backslashes when reading from raw_input or files. Python only ever escapes backslashes when displaying

Re: Test None for an object that does not implement ==

2011-12-26 Thread Roy Smith
In article , Devin Jeanpierre wrote: > > Um -- if you don't want a and c being passed in, why put them in the > > function signature? > > He wants both or neither to be passed in. assert sum(foo is None for foo in [a, c]) % 2 == 0 -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing the system clock with pexpect confuses pexpect!

2011-12-26 Thread Roy Smith
In article <1f342621-0c96-447c-ad5d-f8c9dc777...@i6g2000vbe.googlegroups.com>, Saqib Ali wrote: > I believe what is going on is that internally pexpect uses the system > clock to keep track of when it receives data from spawned processes. > When I mess with the clock, that messes up the interna

Re: installing matplotlib in MacOs 10.6.8.

2011-12-26 Thread Ned Deily
In article , Alex Ter-Sarkissov wrote: > hi everyone, I run python 2.7.2. in Eclipse (recently upgraded from 2.6). I > have a problem with installing matplotlib (I found the version for python > 2.7. MacOs 10.3, no later versions). If I run python in terminal using arch > -i386 python, and then

Re: Python education survey

2011-12-26 Thread Rick Johnson
On Dec 25, 9:27 pm, Chris Angelico wrote: > On Mon, Dec 26, 2011 at 4:44 AM, Rick Johnson > > [...] > Conversely, why write an IDE into IDLE when perfectly-good IDEs > already exist? I don't use IDLE for development per se; it's for > interactive Python execution, but not editing of source files.

Re: Test None for an object that does not implement ==

2011-12-26 Thread Paul Rudin
GZ writes: > I run into a weird problem. I have a piece of code that looks like the > following: > > f(, a=None, c=None): > assert (a==None)==(c==None) > There is only one 'None' - so use 'a is None' rather than 'a == None'. (In common lisp there is a particular language construct tha

Re: Python education survey

2011-12-26 Thread Nathan Rice
On Mon, Dec 26, 2011 at 9:52 AM, Rick Johnson wrote: > On Dec 25, 9:27 pm, Chris Angelico wrote: >> On Mon, Dec 26, 2011 at 4:44 AM, Rick Johnson >> > [...] >> Conversely, why write an IDE into IDLE when perfectly-good IDEs >> already exist? I don't use IDLE for development per se; it's for >> in

Re: Plot seems weird

2011-12-26 Thread Yigit Turgut
On Dec 26, 11:28 am, Lie Ryan wrote: > On 12/26/2011 05:27 AM, Yigit Turgut wrote: > > > > > > > > > > > On Dec 25, 7:06 pm, Rick Johnson  wrote: > >> On Dec 25, 9:33 am, Yigit Turgut  wrote: > >>> Hi all, > > >>> I have a text file as following; > > >>> 0.200047        0.00 > >>> 0.200053    

Re: Python education survey

2011-12-26 Thread Rick Johnson
On Dec 26, 10:11 am, Nathan Rice wrote: > On Mon, Dec 26, 2011 at 9:52 AM, Rick Johnson > > > > > > > > > > wrote: > > On Dec 25, 9:27 pm, Chris Angelico wrote: > >> On Mon, Dec 26, 2011 at 4:44 AM, Rick Johnson > >> > [...] > >> Conversely, why write an IDE into IDLE when perfectly-good IDEs >

Re: Test None for an object that does not implement ==

2011-12-26 Thread Ethan Furman
Devin Jeanpierre wrote: Um -- if you don't want a and c being passed in, why put them in the function signature? He wants both or neither to be passed in. Ah -- right. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python education survey

2011-12-26 Thread Steven D'Aprano
On Mon, 26 Dec 2011 06:52:03 -0800, Rick Johnson wrote: > If Guido would just say something (or at least some of the top > Pythionistas (Hettinger i am looking at you!)) this community might work > together to fix this problem. The sheer cluelessness displayed here about open source is painful.

Re: Is my IDLE problem caused by .idlerc? Permissions.

2011-12-26 Thread W. eWatson
On 12/24/2011 11:35 AM, Dennis Lee Bieber wrote: On Sat, 24 Dec 2011 10:55:48 -0800, "W. eWatson" wrote: Permissions as follows: SYSTEM: All. From Full control to write Account Unknown(S-1-5-21...): read&exec, Read Wayne: (normal use) All. From Full control to write Admin: All. From Full con

Multithreading

2011-12-26 Thread Yigit Turgut
I have a loop as following ; start = time.time() end = time.time() - start while(endhttp://mail.python.org/mailman/listinfo/python-list

Re: Plot seems weird

2011-12-26 Thread Lie Ryan
On 12/27/2011 04:08 AM, Yigit Turgut wrote: On Dec 26, 11:28 am, Lie Ryan wrote: On 12/26/2011 05:27 AM, Yigit Turgut wrote: On Dec 25, 7:06 pm, Rick Johnsonwrote: On Dec 25, 9:33 am, Yigit Turgutwrote: Hi all, I have a text file as following; 0.2000470.00

Re: Plot seems weird

2011-12-26 Thread Yigit Turgut
On Dec 26, 8:58 pm, Lie Ryan wrote: > On 12/27/2011 04:08 AM, Yigit Turgut wrote: > > > > > > > > > > > On Dec 26, 11:28 am, Lie Ryan  wrote: > >> On 12/26/2011 05:27 AM, Yigit Turgut wrote: > > >>> On Dec 25, 7:06 pm, Rick Johnson    wrote: > On Dec 25, 9:33 am, Yigit Turgut    wrote: >

Re: Is my IDLE problem caused by .idlerc? Permissions.

2011-12-26 Thread W. eWatson
On 12/26/2011 10:16 AM, W. eWatson wrote: On 12/24/2011 11:35 AM, Dennis Lee Bieber wrote: On Sat, 24 Dec 2011 10:55:48 -0800, "W. eWatson" wrote: Permissions as follows: SYSTEM: All. From Full control to write Account Unknown(S-1-5-21...): read&exec, Read Wayne: (normal use) All. From Full

Re: Python education survey

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 5:32 AM, Rick Johnson wrote: > Why has Guido not, at the very least, contacted me > privately? He could remain anonymous. And how would you know if he did contact you anonymously? As to your demand that one of the "top Pythionistas" [sic] say something? I declare hereby t

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Mon, Dec 26, 2011 at 11:31 AM, Yigit Turgut wrote: > I have a loop as following ; > > start = time.time() > end = time.time() - start >  while(end          data1 = self.chan1.getWaveform() >          end = time.time() - start >          timer.tick(10)  #FPS >          screen.fill((255,255,255)

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Mon, Dec 26, 2011 at 1:01 PM, Ian Kelly wrote: > You essentially have two completely independent loops that need to run > simultaneously with different timings.  Sounds like a good case for > multiple threads (or processes if you prefer, but these aren: I accidentally sent before I was finishe

Re: Multithreading

2011-12-26 Thread Yigit Turgut
On Dec 26, 10:03 pm, Ian Kelly wrote: > On Mon, Dec 26, 2011 at 1:01 PM, Ian Kelly wrote: > > You essentially have two completely independent loops that need to run > > simultaneously with different timings.  Sounds like a good case for > > multiple threads (or processes if you prefer, but these

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Mon, Dec 26, 2011 at 1:13 PM, Yigit Turgut wrote: > I had thought the same workaround but unfortunately loop is already > under a def ; So nest the functions, or refactor it. Either way, that shouldn't be a significant obstacle. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Eelco
On Dec 25, 5:15 pm, Steven D'Aprano wrote: > On Sun, 25 Dec 2011 06:55:28 -0800, Eelco wrote: > > Anyway,  braces are used at > > least an order of magnitude more than collection packing/ unpacking in > > typical code. > > That's a wild and unjustified claim. Here's a quick and dirty test, using >

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Eelco
On Dec 25, 5:23 pm, Chris Angelico wrote: > On Mon, Dec 26, 2011 at 2:38 AM, Eelco wrote: > > Until that time, im going > > to ask you to take 'type constraint' by its literal meaning; a > > coercion of the type of a symbol, rather than whatever particular > > meaning it has acquired for you (it

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 7:39 AM, Eelco wrote: > Now try it without changing the subject from round braces to > everything but round braces. Around here, the term "braces" means the curly ones - { and } - that delimit blocks of code in C, and dictionaries/sets in Python. "Brackets" may be what you

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 7:58 AM, Eelco wrote: > What you are talking about goes by the name of a 'dynamic type CHECK'; > some kind of syntactic sugar for something like > 'assert(type(obj)==sometype)'. Like a 'type cast', this is also a > runtime concept... > > By contrast, here is the first googl

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Eelco
On Dec 25, 6:05 pm, Steven D'Aprano wrote: > On Sun, 25 Dec 2011 07:38:17 -0800, Eelco wrote: > > On Dec 25, 2:12 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> On Sat, 24 Dec 2011 06:39:39 -0800, Eelco wrote: > >> > On Dec 20, 4:30 am, alex23 wrote: > >> >> On Dec 19, 8:15 p

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Eelco
On Dec 26, 10:01 pm, Chris Angelico wrote: > On Tue, Dec 27, 2011 at 7:39 AM, Eelco wrote: > > Now try it without changing the subject from round braces to > > everything but round braces. > > Around here, the term "braces" means the curly ones - { and } - that > delimit blocks of code in C, and

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Eelco
On Dec 26, 10:05 pm, Chris Angelico wrote: > On Tue, Dec 27, 2011 at 7:58 AM, Eelco wrote: > > What you are talking about goes by the name of a 'dynamic type CHECK'; > > some kind of syntactic sugar for something like > > 'assert(type(obj)==sometype)'. Like a 'type cast', this is also a > > runti

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 8:51 AM, Eelco wrote: > That proves the original point of contention: that [Steve's demo code] is > suboptimal language design, not because terseness always trumps > verbosity, but because commonly-used constructs (such as parenthesis > or round brackets or whatever you wis

Possible bug in string handling (with kludgy work-around)

2011-12-26 Thread Charles Hixson
This doesn't cause a crash, but rather incorrect results. self.wordList=["The", "quick", "brown", "fox", "carefully", "jumps", "over", "the", "lazy", "dog", "as", "it", "stealthily", "wends", "its", "way", "homewards", '\b.'] foriinrange (len (s

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 9:12 AM, Eelco wrote: > On Dec 26, 10:05 pm, Chris Angelico wrote: >> A constraint can be applied at compile time or at run time. It'd be >> valid to apply them at edit time, if you so chose - your editor could >> refuse to save your file until you fix the problem. Doesn't

Re: Possible bug in string handling (with kludgy work-around)

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 9:23 AM, Charles Hixson wrote: > This doesn't cause a crash, but rather incorrect results. You may need to be a bit clearer. What line of code (or what expression)? What did you expect to see, and what did you see? >From examining your code, I've come up with one most-lik

Re: How to check for single character change in a string?

2011-12-26 Thread tinnews
Roy Smith wrote: > In article , > Roy Smith wrote: > > > >>> len([x for x in zip(s1, s2) if x[0] != x[1]]) > > Heh, Ian Kelly's version: > > > sum(a == b for a, b in zip(str1, str2)) > > is cleaner than mine. Except that Ian's counts matches and the OP asked > for non-matches, but that's a

Re: Possible bug in string handling (with kludgy work-around)

2011-12-26 Thread Rick Johnson
On Dec 26, 4:23 pm, Charles Hixson wrote: > This doesn't cause a crash, but rather incorrect results. > > self.wordList    =    ["The", "quick", "brown", "fox", "carefully", >                  "jumps", "over", "the", "lazy", "dog", "as", "it", >                  "stealthily", "wends", "its", "way"

Re: Possible bug in string handling (with kludgy work-around)

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 9:48 AM, Rick Johnson wrote: > Handy rules for reporting bugs: > > 1. Always format code properly. > 2. Always trim excess fat from code. > 3. Always include relative dependencies ("self.wordlist" is only valid > inside a class. In this case, change the code to a state that

Re: Multithreading

2011-12-26 Thread Yigit Turgut
On Dec 26, 10:01 pm, Ian Kelly wrote: > On Mon, Dec 26, 2011 at 11:31 AM, Yigit Turgut wrote: > > I have a loop as following ; > > > start = time.time() > > end = time.time() - start > >  while(end >          data1 = self.chan1.getWaveform() > >          end = time.time() - start > >          tim

Regular expressions

2011-12-26 Thread mauricel...@acm.org
Hi I am trying to change "@HWI-ST115:568:B08LLABXX:1:1105:6465:151103 1:N: 0:" to "@HWI-ST115:568:B08LLABXX:1:1105:6465:151103/1". Can anyone help me with the regular expressions needed? Thanks in advance. Maurice -- http://mail.python.org/mailman/listinfo/python-list

installing matplotlib in MacOs 10.6.8.

2011-12-26 Thread Alex Ter-Sarkissov
thanks Ned, that's quite weird: if I run python2.7-32 in terminal, it works like you said, but when I add it as an interpreter in Eclipse, matplotlib.pyplot doesn't get imported for some reason. Even more strange, either way platform.architecture() reports 64-bit. What's wrong here? cheers, Alex

Re: installing matplotlib in MacOs 10.6.8.

2011-12-26 Thread Alex Ter-Sarkissov
thanks Ned, that's quite weird: if I run python2.7-32 in terminal, it works like you said, but when I add it as an interpreter in Eclipse, matplotlib.pyplot doesn't get imported for some reason. Even more strange, either way platform.architecture() reports 64-bit. What's wrong here? cheers, Alex

Re: Regular expressions

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 10:45 AM, mauricel...@acm.org wrote: > Hi > > I am trying to change to . > > Can anyone help me with the regular expressions needed? A regular expression defines a string based on rules. Without seeing a lot more strings, we can't know what possibilities there are for eac

Re: Regular expressions

2011-12-26 Thread Roy Smith
In article <495b6fe6-704a-42fc-b10b-484218ad8...@b20g2000pro.googlegroups.com>, "mauricel...@acm.org" wrote: > Hi > > I am trying to change "@HWI-ST115:568:B08LLABXX:1:1105:6465:151103 1:N: > 0:" to "@HWI-ST115:568:B08LLABXX:1:1105:6465:151103/1". > > Can anyone help me with the regular expre

Re: Regular expressions

2011-12-26 Thread Jason Friedman
> On Tue, Dec 27, 2011 at 10:45 AM, mauricel...@acm.org > wrote: >> Hi >> >> I am trying to change to . >> >> Can anyone help me with the regular expressions needed? > > A regular expression defines a string based on rules. Without seeing a > lot more strings, we can't know what possibilities the

Re: Regular expressions

2011-12-26 Thread mauricel...@acm.org
On Dec 27, 8:00 am, Chris Angelico wrote: > On Tue, Dec 27, 2011 at 10:45 AM, mauricel...@acm.org > > wrote: > > Hi > > > I am trying to change to . > > > Can anyone help me with the regular expressions needed? > > A regular expression defines a string based on rules. Without seeing a > lot more

Re: Regular expressions

2011-12-26 Thread mauricel...@acm.org
On Dec 27, 8:16 am, Jason Friedman wrote: > > On Tue, Dec 27, 2011 at 10:45 AM, mauricel...@acm.org > > wrote: > >> Hi > > >> I am trying to change to . > > >> Can anyone help me with the regular expressions needed? > > > A regular expression defines a string based on rules. Without seeing a > >

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Eelco
On Dec 26, 11:27 pm, Chris Angelico wrote: > On Tue, Dec 27, 2011 at 8:51 AM, Eelco wrote: > > That proves the original point of contention: that [Steve's demo code] is > > suboptimal language design, not because terseness always trumps > > verbosity, but because commonly-used constructs (such as

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-26 Thread Chris Angelico
On Tue, Dec 27, 2011 at 10:44 AM, Eelco wrote: > extended collection unpacking, as in 'head,*tail=sequence', is quite a > rare construct indeed, and here I very strongly feel a more explicit > syntax is preferrable. You may be right, but... > ... if collection packing/unpacking would be > presen

Re: Possible bug in string handling (with kludgy work-around)

2011-12-26 Thread Steven D'Aprano
On Mon, 26 Dec 2011 14:23:03 -0800, Charles Hixson wrote: > This doesn't cause a crash, but rather incorrect results. Charles, your code is badly formatted and virtually unreadable. You have four spaces between some tokens, lines are too long to fit in an email or News post without word-wrappin

Re: Regular expressions

2011-12-26 Thread Jason Friedman
> Thanks a lot everyone. > > Can anyone suggest a good place to learn REs? Start with the manual: http://docs.python.org/py3k/library/re.html#module-re -- http://mail.python.org/mailman/listinfo/python-list

Daemon management

2011-12-26 Thread Fredrik Tolf
Dear list, Lately, I've had a personal itch to scratch, in that I run a couple of Python programs as daemons, and sometimes want to inspect or alter them in ad-hoc ways, or other times need to do things to them that are less ad-hoc in nature, but nevertheless lack a natural user interface. I

confused about __new__

2011-12-26 Thread K. Richard Pixley
I'm confused about the following. The idea here is that the set of instances of some class are small and finite, so I'd like to create them at class creation time, then hijack __new__ to simply return one of the preexisting classes instead of creating a new one each call. This seems to work i

Re: confused about __new__

2011-12-26 Thread Steven D'Aprano
On Mon, 26 Dec 2011 20:28:26 -0800, K. Richard Pixley wrote: > I'm confused about the following. The idea here is that the set of > instances of some class are small and finite, so I'd like to create them > at class creation time, then hijack __new__ to simply return one of the > preexisting clas

Re: Regular expressions

2011-12-26 Thread Fredrik Tolf
On Mon, 26 Dec 2011, mauricel...@acm.org wrote: I've tried re.sub('@\S\s[1-9]:[A-N]:[0-9]', '@\S\s', '@HWI-ST115:568:B08LLABXX: 1:1105:6465:151103 1:N:0:') but it does not seems to work. Indeed, for several reasons. First of all, your backslash sequences are interpreted by Python as string e

Re: Multithreading

2011-12-26 Thread Ian Kelly
On Dec 26, 2011 4:13 PM, "Yigit Turgut" wrote: > Why is there N variable in write_data function ? N is related to > timer.tick(N) which is related to display function ? time.sleep(N) > will pause writing to file for specified amount of time which is > exactly what I am trying to avoid. My underst

Re: confused about __new__

2011-12-26 Thread K Richard Pixley
On 12/26/11 20:53 , Steven D'Aprano wrote: On Mon, 26 Dec 2011 20:28:26 -0800, K. Richard Pixley wrote: I'm confused about the following. The idea here is that the set of instances of some class are small and finite, so I'd like to create them at class creation time, then hijack __new__ to sim

Re: confused about __new__

2011-12-26 Thread Fredrik Tolf
On Mon, 26 Dec 2011, K. Richard Pixley wrote: I don't understand. Can anyone explain? I'm also a bit confused about __new__. I'd very much appreciate it if someone could explain the following aspects of it: * The manual () says that __new

Re: Python education survey

2011-12-26 Thread Carl Smith
On Dec 20, 10:58 am, Andrea Crotti wrote: > On 12/20/2011 03:51 AM, Raymond Hettinger wrote: > > > > > > > > > > > Do you use IDLE when teaching Python? > > If not, what is the tool of choice? > > > Students may not be experienced with the command-line and may be > > running Windows, Linux, or Mac

Re: Python education survey

2011-12-26 Thread Carl Smith
On Dec 25, 5:44 pm, Rick Johnson wrote: > On Dec 19, 9:51 pm, Raymond Hettinger > wrote: > > > Do you use IDLE when teaching Python? > > If not, what is the tool of choice? > > I believe IDLE has the potential to be a very useful teaching tool and > even in it's current abysmal state, i find it t

python logging module:a quick question

2011-12-26 Thread Littlefield, Tyler
Hello all: I have a basic server I am working on, and wanted some input with an error I'm getting. I am initializing the logger like so: if __name__ == "__main__": observer = log.PythonLoggingObserver() observer.start() logging.basicConfig(filename='logs/server.log', level=logging.DEBUG,

Re: installing matplotlib in MacOs 10.6.8.

2011-12-26 Thread Ned Deily
In article , Alex Ter-Sarkissov wrote: > that's quite weird: if I run python2.7-32 in terminal, it works like you > said, but when I add it as an interpreter in Eclipse, matplotlib.pyplot > doesn't get imported for some reason. Even more strange, either way > platform.architecture() reports 64-b

Re: confused about __new__

2011-12-26 Thread Ian Kelly
On Mon, Dec 26, 2011 at 10:48 PM, Fredrik Tolf wrote: > I'm also a bit confused about __new__. I'd very much appreciate it if > someone could explain the following aspects of it: > >  * The manual () says >   that __new__ is "a static method (specia

Re: confused about __new__

2011-12-26 Thread Lie Ryan
On 12/27/2011 04:48 PM, Fredrik Tolf wrote: On Mon, 26 Dec 2011, K. Richard Pixley wrote: I don't understand. Can anyone explain? I'm also a bit confused about __new__. I'd very much appreciate it if someone could explain the following aspects of it: * The manual (