Re: Weird behavior in search in a list

2007-03-30 Thread Hendrik van Rooyen
Su Y [EMAIL PROTECTED] wrote: I want find the first number in extend[] which is larger than num, so I wrote: def find(num): count=0 for elem in extend: if elemnum: count+=1 return count I found that if extend[] is monotonous, like [1.1, 2.3, 3.2, 4.5,

Re: socket read timeout

2007-03-30 Thread Hendrik van Rooyen
Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Thu, 29 Mar 2007 07:29:35 +0200, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Are sockets full duplex? Uh, yes. The reason I asked is that I have noticed that other file like objects (on Suse 10 Linux and Python 2.4 out of the box) aren't

Re: socket read timeout

2007-03-29 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: hg My issue with that is the effect on write: I only want a timeout on hg read ... but anyway ... So set a long timeout when you want to write and short timeout when you want to read. Are sockets full duplex? I know Ethernet isn't. - Hendrik --

Re: Mastering Python

2007-03-29 Thread Hendrik van Rooyen
Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Wed, 28 Mar 2007 07:55:20 +0200, Hendrik van Rooyen [EMAIL PROTECTED] declaimed the following in comp.lang.python: Pretty obvious of course, as is the pronounciation of the name: Cholmondely Is that a scottish Ch (as in LoCH Lomond

Re: with timeout(...):

2007-03-29 Thread Hendrik van Rooyen
Nick Craig-Wood [EMAIL PROTECTED] wrote: Well, yes there are different levels of potential reliability with different implementation strategies for each! Gadzooks! Foiled again by the horses for courses argument. ; - ) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: with timeout(...):

2007-03-27 Thread Hendrik van Rooyen
Diez B. Roggisch [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: Did anyone write a contextmanager implementing a timeout for python2.5? I'd love to be able to write something like with timeout(5.0) as exceeded: some_long_running_stuff() if exceeded:

Re: with timeout(...):

2007-03-27 Thread Hendrik van Rooyen
Nick Craig-Wood [EMAIL PROTECTED] wrote: Hendrik van Rooyen [EMAIL PROTECTED] wrote: But would be useful to be able to do without messing with threads and GUI and imports. Could be hard to implement as the interpreter would have to be assured of getting control back

Re: Mastering Python

2007-03-27 Thread Hendrik van Rooyen
Bruno Desthuilliers [EMAIL PROTECTED] wrote: Dennis Lee Bieber a écrit : On Wed, 21 Mar 2007 21:40:51 +0100, Bruno Desthuilliers [EMAIL PROTECTED] declaimed the following in comp.lang.python: For future reference, and I hope you don't mind the lesson, I don't. the past tense of bind is

Re: Join strings - very simple Q.

2007-03-24 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 23 Mar 2007 13:15:29 -0700, John Machin wrote: OK, I'll bite: This was new in late 2000 when Python 2.0 was released. Where have you been in the last ~6.5 years? Western civilization is 6,000 years old. Anything after 1850 is new.

Re: List to string

2007-03-21 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 20 Mar 2007 13:01:36 +0100, Bruno Desthuilliers wrote: 8 --- confusion about left and right It gets worse. When you work on a lathe, a right hand cutting tool has its cutting edge on the left... And the worse part is that its

Re: Timeout to readline()/readlines()

2007-03-19 Thread Hendrik van Rooyen
Horta [EMAIL PROTECTED] wrote: Sometimes, when I do an os.popen*(), the process executed by the command hangs, and the script stops forever on the readline()/ readlines() calls. I found that I can use select, but I'm thinking... if, after a sellect() call returns, the stdout (for example)

Re: Real Time Embedded Systems Monitor in Python?

2007-03-19 Thread Hendrik van Rooyen
frikk [EMAIL PROTECTED] wrote: I am looking into a project for the company I work for. Essentially it involves setting up a real time monitor / signal injector in between a CPU board and a system controller. The system controller sends signals (message packets) to the CPU board. We would

Re: number generator

2007-03-14 Thread Hendrik van Rooyen
Duncan Smith [EMAIL PROTECTED] wrote: Yes, if the generating processes yield numbers from different probability mass functions. You could simply look at the likelihood ratio. Otherwise, the likelihood ratio will be 1. I was thinking about the same random number generator being used in

Re: number generator

2007-03-14 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: Easy-peasey. Just collate the individual numbers from the lists, and graph their frequencies. You will get quite different distributions. Both are random, but in different ways. 8 code - Thanks - I think too complex - was

Re: number generator

2007-03-14 Thread Hendrik van Rooyen
Gabriel Genellina [EMAIL PROTECTED] wrote: You can't have two different sets with four equal numbers - it's not a very difficult thing, it's impossible to distinguish because they're identical! Given 4 numbers in the set, the 5th is uniquely determined. By example: 12, 3, 10, 18 *must* end with

Re: number generator

2007-03-14 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: Consider the distance between each paid of consecutive poles. The sum of the distances must add up to the distance from the first to the last, and if there are two fixed poles plus five in between, there are five distances. No there are six

Re: number generator

2007-03-13 Thread Hendrik van Rooyen
Nick Craig-Wood [EMAIL PROTECTED] wrote: Paul Rubin http wrote: The fencepost method still seems to be simplest: t = sorted(random.sample(xrange(1,50), 4)) print [(j-i) for i,j in zip([0]+t, t+[50])] Mmm, nice. Here is another effort which is easier to reason about the

Re: Signed zeros: is this a bug?

2007-03-13 Thread Hendrik van Rooyen
Paddy [EMAIL PROTECTED] wrote Hey, I'm still learnin'. Sweet! contrary to popular belief, the answer to life, the universe, happiness and everything is not 42, but the above. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in a desktop environment

2007-03-11 Thread Hendrik van Rooyen
David Cramer [EMAIL PROTECTED] wrote: If you had an application that you were about to begin development on which you wanted to be cross platform (at least Mac and Windows), would you suggest using c++ and Python? I'm asking because we were originally thinking about doing c# but after

Re: distributed queue?

2007-03-11 Thread Hendrik van Rooyen
Paul Rubin http://[EMAIL PROTECTED] wrote: Bjoern Schliessmann [EMAIL PROTECTED] writes: (Why does everyone think that concurrency equals usage of multiple threads?) Well, it doesn't necessarily, but that's easiest a lot of the time. Try Twisted for your networking needs. I

Re: Need help with a string plz! (newbie)

2007-03-11 Thread Hendrik van Rooyen
Grant Edwards [EMAIL PROTECTED] wrote: On 2007-03-10, Hendrik van Rooyen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Oh, thanks for the advice then. And as for Grant..look forward to seeing more of your posts. YOW! - some recognition at last! :) I see somebody pays

Re: Need help with a string plz! (newbie)

2007-03-10 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: Oh, thanks for the advice then. And as for Grant..look forward to seeing more of your posts. YOW! - some recognition at last! - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: persistent fifo queue class

2007-03-07 Thread Hendrik van Rooyen
David Bear [EMAIL PROTECTED] wrote: Diez B. Roggisch wrote: Why don't you use a DB for that? If you want pickles, use a blob column. But all the rest - a defined protocol, stable server, transactions - you get for free. Diez Thanks for the suggestion. I did think of this. Indeed

Re: Is every number in a list in a range?

2007-03-06 Thread Hendrik van Rooyen
Steven D'Aprano stybersource.com.au wrote: 8 --- some code with heavy reliance on Booleans and 'is' --- All Right. This has convinced me. Some Australians do have a sense of humour. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrong exist status for os.system, os.poepen, etc.

2007-03-06 Thread Hendrik van Rooyen
Paolo Pantaleo [EMAIL PROTECTED] wrote: $./x $echo $? 20 $ python give the following commands: import os os.system(/tmp/x) 5120 256 times 20 is 5120 this is a big/little endian little bug - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Read Bytes from a file

2007-03-05 Thread Hendrik van Rooyen
Piet van Oostrum [EMAIL PROTECTED] wrote: Bart Ogryczak [EMAIL PROTECTED] (BO) wrote: BO Any system with 8-bit bytes, which would mean any system made after BO 1965. I'm not aware of any Python implementation for UNIVAC, so I BO wouldn't worry ;-) 1965? I worked with non-8-byte machines

Re: How to Read Bytes from a file

2007-03-05 Thread Hendrik van Rooyen
Bart Ogryczak [EMAIL PROTECTED] wrote: On Mar 5, 10:51 am, Piet van Oostrum [EMAIL PROTECTED] wrote: Bart Ogryczak [EMAIL PROTECTED] (BO) wrote: BO Any system with 8-bit bytes, which would mean any system made after BO 1965. I'm not aware of any Python implementation for UNIVAC, so I

Re: pop method question

2007-03-04 Thread Hendrik van Rooyen
Alex Martelli [EMAIL PROTECTED] wrote: Raymond Hettinger [EMAIL PROTECTED] wrote: ... The notion that pop is only defined for stack operations is somewhat pedantic. Worse: it's totally wrong. It's also defined for eyes, as a musical genre, as a kind of soda, as an avant-garde

Re: How to Read Bytes from a file

2007-03-02 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: Thanks Bart. That's perfect. The other suggestion was to precompute count1 for all possible bytes, I guess that's 0-256, right? 0 to 255 inclusive, actually - that is 256 numbers... The largest number representable in a byte is 255 eight bits, of value

Re: Dialog with a process via subprocess.Popen blocks forever

2007-03-01 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: Hi, Thanks for your answer. I had a look into the fcntl module and tried to unlock the output-file, but fcntl.lockf(x.stdout, fcntl.LOCK_UN) Traceback (most recent call last): File stdin, line 1, in module IOError: [Errno 9] Bad file descriptor I

Re: Dialog with a process via subprocess.Popen blocks forever

2007-03-01 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: 8-- The C programm gets its commands from its stdin and sends its state to stdout. Thus I have some kind of dialog over stdin. So, once I start the C Program from the shell, I immediately get its output in my terminal. If I start it from a

Re: Running Python scripts from BASH

2007-02-28 Thread Hendrik van Rooyen
Ishpeck [EMAIL PROTECTED] wrote: 8--- a bash problem - If it were Python, the advice would have been to use the print statement to figure out what the content of the variables were. As it is Bash, you may have to stoop to something like echo to see what is in

Re: Dialog with a process via subprocess.Popen blocks forever

2007-02-28 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: Is it possible to read to and write to the std streams of a subprocess? What am I doing wrong? I think this problem lies deeper - there has been a lot of complaints about blocking and data getting stuck in pipes and sockets... I have noticed that the Python file

Re: Writing an interpreter for language similar to python!!

2007-02-28 Thread Hendrik van Rooyen
luvsat [EMAIL PROTECTED] wrote: Hello all, I am new to python and working on a project that involves designing a new language. The grammar of the language is very much inspired from python as in is supports nearly all the statements and expressions that are supported by python.

Re: Help on Dict

2007-02-25 Thread Hendrik van Rooyen
James Stroud [EMAIL PROTECTED] wrote: Clement wrote: Can any body tell how Dict is implemented in python... plz tell what datastructure that uses I think it uses a dict. Groan! - this answer is like Microsoft documentation - while technically correct, it is

Re: Help on object scope?

2007-02-25 Thread Hendrik van Rooyen
hg [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hello everybody, I have a (hopefully) simple question about scoping in python. I have a program written as a package, with two files of interest. The two files are /p.py and /lib/q.py Make a third file for all the system wide

Re: Nested Parameter Definitions

2007-02-25 Thread Hendrik van Rooyen
Arnaud Delobelle [EMAIL PROTECTED] wrote: On Feb 25, 6:00 pm, Paddy [EMAIL PROTECTED] wrote: I blogged on finding a new-to-me feature of Python, in that you are allowed to nnest parameter definitions: def x ((p0, p1), p2): ... return p0,p1,p2 ... x(('Does', 'this'), 'work')

Re: Convert to binary and convert back to strings

2007-02-24 Thread Hendrik van Rooyen
Paul Rubin http://[EMAIL PROTECTED] wrote: Hendrik van Rooyen [EMAIL PROTECTED] writes: s = 'some string that needs a bcc appended' ar = array.array('B',s) bcc = 0 for x in ar[:]: bcc ^= x ar.append(bcc) s=ar.tostring() Untested: import operator s = 'some string

Re: is it possible to remove the ':' symbol in the end of linesstarting with 'if', 'while' etc?

2007-02-22 Thread Hendrik van Rooyen
Diez B. Roggisch [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: 8 request to remove colon -- Won't happen. There have been plenty of discussions about this, and while technically not necessary, the colon is usually considered optically pleasing. So -

Re: Convert to binary and convert back to strings

2007-02-22 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: On Thu, 22 Feb 2007 08:18:07 +0200, Hendrik van Rooyen wrote: I would xor each char in it with 'U' as a mild form of obfuscation... I've often wished this would work. 'a' ^ 'U' Traceback (most recent call last): File stdin, line 1

Re: Convert to binary and convert back to strings

2007-02-21 Thread Hendrik van Rooyen
Harlin Seritt [EMAIL PROTECTED] wrote: Hi... I would like to take a string like 'supercalifragilisticexpialidocius' and write it to a file in binary forms -- this way a user cannot read the string in case they were try to open in something like ascii text editor. I'd also like to be able

Re: f---ing typechecking

2007-02-20 Thread Hendrik van Rooyen
Nick Craig-Wood [EMAIL PROTECTED] wrote: Ie x += a does not equal x = x + a which it really should for all types of x and a One would hope so , yes. However, I think that the first form is supposed to update in place, while the second is free to bind a new thing to x

Re: Weird result returned from adding floats depending on order I add them

2007-02-20 Thread Hendrik van Rooyen
joanne matthews (RRes-Roth) [EMAIL PROTECTED] wrote: 8 Can anyone tell me whats going on and how I can avoid the problem. Thanks Don't know about the first question. Would avoid it by using ints and asking for percentages... - Hendrik --

Re: How to test if one dict is subset of another?

2007-02-19 Thread Hendrik van Rooyen
Jay Tee [EMAIL PROTECTED] wrote: Hi, I have some code that does, essentially, the following: - gather information on tens of thousands of items (in this case, jobs running on a compute cluster) - store the information as a list (one per job) of Job items (essentially wrapped

Re: Help Required for Choosing Programming Language

2007-02-18 Thread Hendrik van Rooyen
Bruno Desthuilliers [EMAIL PROTECTED] wrote: Stef Mientki a écrit : (snip) I've been using Python for just 2 months, and didn't try any graphical design, So how can you comment on GUI programming with Python ? I think we have a language problem here (no pun intended) When Stef says Gui

Re: builtin set literal

2007-02-17 Thread Hendrik van Rooyen
Paul Rubin http://[EMAIL PROTECTED] wrote: Steven Bethard [EMAIL PROTECTED] writes: Yes, a lot of people liked this approach, but it was rejected due to gratuitous breakage. While Python 3.0 is not afraid to break backwards compatibility, it tries to do so only when there's a very

Re: builtin set literal

2007-02-17 Thread Hendrik van Rooyen
Schüle Daniel [EMAIL PROTECTED] wrote: {:} for empty dict and {} for empty set don't look too much atrocious to me. this looks consistent to me I disagree. What would be consistent would be to follow the pattern, and use a different set of delimiters. Python uses () for tuples, [] for

Re: Pep 3105: the end of print?

2007-02-17 Thread Hendrik van Rooyen
Steve Holden [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: I think some people are confused that the language Python 3.x has Python in its name, since there is already a language with Python in its name, with which it is not compatible. Right. Let's call Python 3.0 something

Re: Approaches of interprocess communication

2007-02-17 Thread Hendrik van Rooyen
exhuma.twn [EMAIL PROTECTED] wrote: Hi all, Supposing you have two separate processes running on the same box, what approach would you suggest to communicate between those two processes. 8 -- sockets,webservices,CORBA,shared memory --- Supposing both processes are

Re: Enter Enter... troubles

2007-02-15 Thread Hendrik van Rooyen
Sorin Schwimmer wrote: 8- def handler(self,event): self.aButton.unbind('Return') self.aButton.unbind('KP_Enter') 8- The idea is to prevent a fast user (like my boss) to press repeatedly the enter key and create havoc with self.property

Re: how do real python programmers work?

2007-02-15 Thread Hendrik van Rooyen
Tim Golden [EMAIL PROTECTED] wrote: Tyrrell, Wendy wrote: (Well, nothing) 8-- Your organisation seems to deal with partnerships between business and education; are you looking to promote the use of programming in schools? Or is there something else you're after?

Re: searching a list of lists as a two-dimensional array?

2007-02-13 Thread Hendrik van Rooyen
John Machin [EMAIL PROTECTED] wrote: Now for the algorithm: all of that testing to see if you are about to sail off the end of the world is a bit ugly and slow. You can use bit- bashing, as Paul suggested, even though it's on Steven D'Aprano's list of 6 deadly sins :-) Thou shallt not bit

Re: Tkinter and Tile

2007-02-13 Thread Hendrik van Rooyen
Eric Brunel [EMAIL PROTECTED] wrote: FYI, changes done in tcl/tk are usually quite rapidly integrated in Tkinter. For example, for the panedwindow widget, introduced in tk8.4 (first version out in the end of 2002), a Tkinter wrapper was available in Python 2.3 (first version out mid-2003). So I

Re: Help with Optimization of Python software: real-time audiocontroller

2007-02-13 Thread Hendrik van Rooyen
Jean-Paul Calderone [EMAIL PROTECTED] wrote: Yep. There are even some existing Python applications which deal with sound and manage to work with ~20ms samples. I agree. Python is not *that* slow... I have written serial port communications that send and catch one character at a time (raw,

Re: searching a list of lists as a two-dimensional array?

2007-02-13 Thread Hendrik van Rooyen
John Machin [EMAIL PROTECTED] wrote: On Feb 13, 4:57 pm, Hendrik van Rooyen [EMAIL PROTECTED] wrote: John Machin [EMAIL PROTECTED] wrote: Now for the algorithm: all of that testing to see if you are about to sail off the end of the world is a bit ugly and slow. You can use bit

Re: Segmentation faults using threads

2007-02-13 Thread Hendrik van Rooyen
Mathias [EMAIL PROTECTED] wrote: Does someone have experience with threading in python - are there non-threadsafe functions I should know about? how do your threads communicate with one another - are there any globals that are accessed from different threads? strange this - you should get

Re: pygame and python 2.5

2007-02-10 Thread Hendrik van Rooyen
Steve Holden [EMAIL PROTECTED] Hendrik van Rooyen wrote: [EMAIL PROTECTED] wrote: Ben Sizer [EMAIL PROTECTED] wrote: Ben Python extensions written in C require recompilation for each new Ben version of Python, due to Python limitations. Can you propose a means

Re: pygame and python 2.5

2007-02-10 Thread Hendrik van Rooyen
Ben Sizer [EMAIL PROTECTED] wrote: On Feb 10, 8:42 am, Steve Holden [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: [EMAIL PROTECTED] wrote: Ben Sizer [EMAIL PROTECTED] wrote: Ben Python extensions written in C require recompilation for each new Ben version of Python

Re: Calling J from Python

2007-02-09 Thread Hendrik van Rooyen
Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 8 Feb 2007 10:55:17 +0200, Hendrik van Rooyen [EMAIL PROTECTED] declaimed the following in comp.lang.python: I am under the impression that Loki had a daughter called Hel ... One of his few normal offspring... After all, Loki also

Re: pygame and python 2.5

2007-02-09 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: Ben Sizer [EMAIL PROTECTED] wrote: Ben Python extensions written in C require recompilation for each new Ben version of Python, due to Python limitations. Can you propose a means to eliminate this limitation? Yes. - Instead of calling something, send it

Re: Calling J from Python

2007-02-08 Thread Hendrik van Rooyen
Tina I [EMAIL PROTECTED] wrote: Gosi wrote: On Feb 7, 3:46 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], Gosi wrote: I like to use J for many things and I think that combining Python and J is a hell of a good mixture. I was able to follow this sentence up to

Re: Simple Interpolation in Numpy?

2007-02-08 Thread Hendrik van Rooyen
LAPI, VINCENT J, ATTLABS wrote: Hi, Please bear with me as I am new to Python and have not done any programming in about 20 years. I am attempting to do a simple interpolation of a line's intermediate points given the x,y coordinates of the line's two endpoints within an Active State Python

Re: The reliability of python threads

2007-01-27 Thread Hendrik van Rooyen
Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: Carl J. Van Arsdall [EMAIL PROTECTED] wrote: 8 --- Yea, I do some of that too. I use that with conditional print statements to stderr when i'm doing my validation

Re: The reliability of python threads

2007-01-25 Thread Hendrik van Rooyen
Carl J. Van Arsdall [EMAIL PROTECTED] wrote: Right, I wasn't coming here to get someone to debug my app, I'm just looking for ideas. I constantly am trying to find new ways to improve my software and new ways to reduce bugs, and when i get really stuck, new ways to track bugs down. The

Re: Would a Dutch speaker please check this wiki page please?

2007-01-19 Thread Hendrik van Rooyen
Martin P. Hellwig [EMAIL PROTECTED] wrote: Stef Mientki wrote: [EMAIL PROTECTED] wrote: Got a note about a new page on the Python Wiki: Wade == Wade McDaniel [EMAIL PROTECTED] writes: http://wiki.python.org/moin/Selcuk_Altun I suspect it's junk since it doesn't seem to

Re: How can I create a linked list in Python?

2007-01-19 Thread Hendrik van Rooyen
Jorgen Grahn [EMAIL PROTECTED] wrote: FWIW, I oppose the idea (paraphrased from further up the thread) that linked lists and other data structures are obsolete and dying concepts, obsoleted by Python and other modern languages. 99% of the time. a Python list is the right tool for the job,

Re: OT Annoying Habits (Was: when format strings attack)

2007-01-19 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: Or perhaps I should say: .snoitnevnoc hsilgnE tpada )ylbissop revenehw( dluohs ew os dna ,naitraM ton ,puorgswen egaugnal hsilgnE na no er'ew ,segaugnal hcus era ereht fi neve tuB First I thought it was Welsh or Cornish or something. Then it was

Re: Class data members in C

2007-01-17 Thread Hendrik van Rooyen
Nick Maclaren [EMAIL PROTECTED] wrote: Hmm. The extensions documentation describes how to add instance members to a class (PyMemberDef), but I want to add a class member. Yes, this is constant for all instances of the class. Any pointers? When? - at time of defining base class, between

Re: asyncore/asynchat and terminator string

2007-01-17 Thread Hendrik van Rooyen
David Hirschfield [EMAIL PROTECTED] wrote: 8 --- problems on syncing up in serial comms - I have seen people address this with success by using stuff like: XXHEADERXX as a here starts the lesson identifier, with no trouble, on a high volume newsfeed. If you assume

Re: Class data members in C

2007-01-17 Thread Hendrik van Rooyen
Nick Maclaren [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Hendrik van Rooyen [EMAIL PROTECTED] writes: | | Hmm. The extensions documentation describes how to add instance | members to a class (PyMemberDef), but I want to add a class member. | Yes, this is constant

Re: Maths error

2007-01-15 Thread Hendrik van Rooyen
Nick Maclaren [EMAIL PROTECTED] wrote: [Tim Roberts] | Actually, this is a very well studied part of computer science called | interval arithmetic. As you say, you do every computation twice, once to | compute the minimum, once to compute the maximum. When you're done, you | can be

Re: Maths error

2007-01-14 Thread Hendrik van Rooyen
of thumb is that 28 digits with a decimal base was comparable to (say) 80 bits with a binary base. [Hendrik van Rooyen] I would have thought that this sort of thing was a natural consequence of rounding errors - if I round (or worse truncate) a binary, I can be off by at most one

Re: Maths error

2007-01-14 Thread Hendrik van Rooyen
Dennis Lee Bieber [EMAIL PROTECTED]wrote: On Sun, 14 Jan 2007 07:18:11 +0200, Hendrik van Rooyen [EMAIL PROTECTED] declaimed the following in comp.lang.python: I recall an SF character known as Slipstick Libby, who was supposed to be a Genius - but I forget the setting

Re: Rational Numbers

2007-01-13 Thread Hendrik van Rooyen
From: Nick Maclaren [EMAIL PROTECTED] wrote: Financial calculations need decimal FIXED-point, with a precisely specified precision. It is claimed that decimal FLOATING-point helps with providing that, but that claim is extremely dubious. I can explain the problem in as much detail as you

Re: Is there a way to protect a piece of critical code?

2007-01-13 Thread Hendrik van Rooyen
robert [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: So far I have only used dicts to pass functions around in a relatively unimaginative static jump table like way... Probably one has just to see that one can a pass a function object (or any callable) around as any other

Re: Maths error

2007-01-13 Thread Hendrik van Rooyen
Dennis Lee Bieber [EMAIL PROTECTED] wrote: {My 8th grade teacher was a bit worried at seeing me with a slipstick G; and my HighSchool Trig/Geometry teacher only required 3 significant digits for answers -- even though half the class had calculators by then} LOL - I haven't seen the word

Re: Maths error

2007-01-13 Thread Hendrik van Rooyen
Nick Maclaren [EMAIL PROTECTED] wrote: The cheap means cheap in hardware - it needs very little logic, which is why it was used on the old, discrete-logic, machines. I have been told by hardware people that implementing IEEE 754 rounding and denormalised numbers needs a horrific amount of

Re: General Question About Python

2007-01-13 Thread Hendrik van Rooyen
Torabisu [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: What do you want done? - I am only a thousand miles away... If I can just get my Python teleporter sorted out, distance will be no problem... A little buggy at the moment though... Poor John, I told him not to test

Re: maximum number of threads

2007-01-12 Thread Hendrik van Rooyen
William Heymann [EMAIL PROTECTED] wrote: So you know I tried this on ubuntu edgy 64bit edition on a dual 2218 opteron system with 8G of ram and I got lots of output Exception raised: can't start new thread Biggest number of threads: 32274 This almost looks as if the number of threads

Re: General Question About Python

2007-01-12 Thread Hendrik van Rooyen
Torabisu [EMAIL PROTECTED] wrote: billie wrote: Torabisu wrote: Its quite weird, we're looking for Python skills but are battling to find at the moment... Normally Python on its own will probably not land you a job, but the last two companies I've worked for are doing

Re: Maths error

2007-01-12 Thread Hendrik van Rooyen
Nick Maclaren [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Hendrik van Rooyen [EMAIL PROTECTED] writes: | | I would have thought that this sort of thing was a natural consequence | of rounding errors - if I round (or worse truncate) a binary, I can be off | by at most one

Re: Is there a way to protect a piece of critical code?

2007-01-11 Thread Hendrik van Rooyen
Paul Rubin http://[EMAIL PROTECTED] wrote: Hendrik van Rooyen [EMAIL PROTECTED] writes: am aware of Queue module - the same app uses it for something else. I dont like too many try -- excepts in the code - I find they confuse me when I try to read it later - and in this case I cannot

Re: Is there a way to protect a piece of critical code?

2007-01-11 Thread Hendrik van Rooyen
Paul Rubin http://[EMAIL PROTECTED] wrote: Paul Rubin http://[EMAIL PROTECTED] writes: def get_from_queue(queue): try: return queue.get(block=False) except Queue.Empty: return QUEUE_IS_EMPTY Alternatively: def get_from_queue(queue):

Re: Urgent Openings with the World's Leading Software Company !!!

2007-01-11 Thread Hendrik van Rooyen
Software Hiring [EMAIL PROTECTED] wrote: If you're interested in relocating to India for such a good opportunity and be a part of the World's Best Software Company and if you have good skill sets in: C, C++, C#, Java (for .Net Platform or Visual Studio) OR C, C++, Java, Product

Re: Is there a way to protect a piece of critical code?

2007-01-11 Thread Hendrik van Rooyen
robert [EMAIL PROTECTED] wrote: pushing data objects through an inter-thread queue is a major source for trouble - as this thread shows again. Everybody builds up a new protocol and worries about Empty/Full, Exception-handling/passing, None-Elements, ... I've noticed that those troubles

Re: Maths error

2007-01-11 Thread Hendrik van Rooyen
Nick Maclaren [EMAIL PROTECTED] wrote: Yes, but that wasn't their point. It was that in (say) iterative algorithms, the error builds up by a factor of the base at every step. If it wasn't for the fact that errors build up, almost all programs could ignore numerical analysis and still get

Re: Bitwise expression

2007-01-10 Thread Hendrik van Rooyen
Gigs_ [EMAIL PROTECTED] wrote: Now is all clearer thanks to [EMAIL PROTECTED] and Hendrick van Rooyen Contrary to popular belief in the English speaking world - c in Hendrik False There is no c in Hendrik : - )- Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Colons, indentation and reformatting. (2)

2007-01-10 Thread Hendrik van Rooyen
Jorgen Grahn [EMAIL PROTECTED]wrote: On 8 Jan 2007 23:57:29 -0800, Paddy [EMAIL PROTECTED] wrote: OK, whilst colons are not sufficient to re-format a completely mis-indented file. I'm thinking that they are sufficient for reformatting most pasted code blocks when refactoring say?

Re: Why less emphasis on private data?

2007-01-10 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 09 Jan 2007 10:27:56 +0200, Hendrik van Rooyen wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: On Mon, 08 Jan 2007 13:11:14 +0200, Hendrik van Rooyen wrote: When you hear a programmer use the word probability - then its time

Is there a way to protect a piece of critical code?

2007-01-10 Thread Hendrik van Rooyen
Hi, I would like to do the following as one atomic operation: 1) Append an item to a list 2) Set a Boolean indicator It would be almost like getting and holding the GIL, to prevent a thread swap out between the two operations. - sort of the inverted function than for which the GIL seems to be

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Hendrik van Rooyen
robert [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: Hi, I would like to do the following as one atomic operation: 1) Append an item to a list 2) Set a Boolean indicator I doubt you have to worry at all about this in such simple single-single queue - if there is not a much

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Hendrik van Rooyen
Paul Rubin http://[EMAIL PROTECTED] wrote: Hendrik van Rooyen [EMAIL PROTECTED] writes: I would like to do the following as one atomic operation: 1) Append an item to a list 2) Set a Boolean indicator You could do it with locks as others have suggested, but maybe you really want

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Hendrik van Rooyen
Steve Holden [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: Hi, I would like to do the following as one atomic operation: 1) Append an item to a list 2) Set a Boolean indicator It would be almost like getting and holding the GIL, to prevent a thread swap out between

Re: Execute binary code

2007-01-09 Thread Hendrik van Rooyen
Chris Mellon [EMAIL PROTECTED] wrote: sigh Repost. Is there any chance at all that ML could set the reply-to to the list instead of the sender? +1 - I regularly hit reply all, delete the OP, and then I get : Message has a suspicious header - Hendrik --

Re: recursive function

2007-01-09 Thread Hendrik van Rooyen
cesco [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2007-01-08, cesco [EMAIL PROTECTED] wrote: Hi, I have a dictionary of lists of tuples like in the following example: dict = {1: [(3, 4), (5, 8)], 2: [(5, 4), (21, 3), (19, 2)], 3: [(16, 1), (0, 2), (1,

Re: Bitwise expression

2007-01-09 Thread Hendrik van Rooyen
Gigs_ [EMAIL PROTECTED] wrote: Can someone explain me bitwise expression? few examples for every expression will be nice x y Left shift x y Right shift x y Bitwise AND x | y Bitwise OR x ^ y Bitwise XOR (exclusive OR) ~x Bitwise negation The short, and possibly weird, but true,

Re: code formatter?

2007-01-09 Thread Hendrik van Rooyen
siggi [EMAIL PROTECTED] wrote: Is there a simple code formatter that first removes all indentations and then refomats correctly? tabnanny ? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Why less emphasis on private data?

2007-01-09 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: On Mon, 08 Jan 2007 13:11:14 +0200, Hendrik van Rooyen wrote: When you hear a programmer use the word probability - then its time to fire him, as in programming even the lowest probability is a certainty when you are doing millions of things

Re: where is python on linux?

2007-01-08 Thread Hendrik van Rooyen
rzed [EMAIL PROTECTED] wrote: mmm... sloppy joes -- rzed A sandwich is a sandwich, but a Manwich is a meal. You eat people? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Why less emphasis on private data?

2007-01-08 Thread Hendrik van Rooyen
Paul Rubin http://[EMAIL PROTECTED] wrote: If you want to write bug-free code, pessimism is the name of the game. A healthy touch of paranoia does not come amiss either... And even then things foul up in strange ways because your head is never quite literal enough. When you hear a programmer

<    2   3   4   5   6   7   8   9   >