Re: Cross Compiler for Python?

2008-07-09 Thread Hendrik van Rooyen
"norseman" wrote: 8< - > dreaded Yep! I know the feeling. Got lots of those T-Shirts. ;) > > > I re-read your original post. I got the feeling the eBox is running a > stripped down Linux. Is that so? If it is, then: Correct

Re; finding euclidean distance,better code?

2008-03-29 Thread Hendrik van Rooyen
On Saturday 29 March 2008 03:09:46 Steven D'Aprano wrote: > On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: > > Gabriel Genellina wrote: > >> That's what I said in another paragraph. "sum of coordinates" is using > >> a different distance definition; it's the way you measure distance in a >

Serial port error statistics - any comparable data?

2008-03-29 Thread Hendrik van Rooyen
Hi, I have been doing some tests on a device that we are thinking of incorporating into a product, and I have seen that reception on a serial port at 115200 baud over about six metres of RS-232 cable makes mistakes, to the order of 125 lines with errors in them out of approximately 18.4 million l

Re: Serial port error statistics - any comparable data?

2008-03-30 Thread Hendrik van Rooyen
"Diez B. Roggisch" wrote: >RS232 is unfortunately as bad as a "protocol" as it can get. I've used >it for communication with a microcontroller for just a few bytes every >second. And it failed miserably, so I needed to implement a protocol on >top of it. We normally do this anyway, except for st

Re: Serial port error statistics - any comparable data?

2008-03-30 Thread Hendrik van Rooyen
On Sunday 30 March 2008 12:19:58 Bjoern Schliessmann wrote: > Diez B. Roggisch wrote: > > if you have the chance, try & attach a machine with legacy rs232 > > port, and see if the errors still remain. > > Additionally, what kind of buffers does your device have? I'm using > pyserial to control a ve

Re: Why prefer != over <> for Python 3.0?

2008-04-02 Thread Hendrik van Rooyen
John J. Lee wrote: >How did programmers manage back then in 32k? Some of the answers, in no particular sequence, are: Tight, small operating systems that did the minimum. Assembler. Sequential Processing: - small tasks with multiple passes on tape ( like the concept of Unix pipes ) Overlay

Python String Immutability Broken!

2008-08-24 Thread Hendrik van Rooyen
South Africa. Sunday 24th August 2008. Our South African correspondent, Waffling Swiftly, reports the discovery of a corpse in the local cyberspace. It is reputed to belong to a programmer who was flayed alive by the C.L.P. group, because he had violated the immutability of a python string. Rum

Re: Python String Immutability Broken!

2008-08-25 Thread Hendrik van Rooyen
Patrick Maupin wrote: >Very entertaining. > Thanks. Nice to see that there is still some sense of humour left somewhere - its all been so serious here lately - people seem to forget that hacking is fun! >But let me get this straight: Are you just complaining that if you >pass a string to an

Re: Python String Immutability Broken!

2008-08-26 Thread Hendrik van Rooyen
"Simon Brunning": >You can indeed use ctypes to modify the value of a string - see >. You can use it to crash the OS, too. > >My advice - don't. Thanks for the link. Any advice on what to do or use as an I/O structure for dissemination? Ken Seehart: 8<--- u

Re: Python Strinh Immutability Broken!

2008-08-26 Thread Hendrik van Rooyen
"Gabriel Genellina": >To avoid altering the equilibrium of the whole universe, use >ctypes.create_string_buffer: >http://python.net/crew/theller/ctypes/tutorial.html#fundamental-data-types Thanks Gabriel – looks like I really have to spend more time with that excellent document. Patrick Maupin

Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread Hendrik van Rooyen
John Machin wrote: >On Aug 30, 10:41 am, "W. eWatson" wrote: > >> What I'm trying to do is adjust date-time stamped file names for date and >> time errors. The software program collects through a period that roughly >> coincides with night hours every day and according to the OS clock. It >> so

Re: How to write verbose scripts

2008-09-03 Thread Hendrik van Rooyen
Steven D'Aprano wrote: >Is there a better way of doing this than the way I am going about it? Not sure if its "better", but I would keep the messages in a table or dict and have different tables or dicts for different levels of verbosity, and write a displayer that knows about the verbosity - T

Re: max(), sum(), next()

2008-09-06 Thread Hendrik van Rooyen
"David C. Ullrich" wrote: >Think about all the previously elected female or black >presidents of the US. Which one was the tallest? The current King of France? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: atomic section in code

2008-09-06 Thread Hendrik van Rooyen
Fredrik Lundh wrote: >sounds like he wants/needs non-cooperative, mandatory locking. Could one get there using ctypes to disable interrupts? Cross Platform? I can think of lots of hassles, starting with permissions to use the privileged instructions. - Hendrik -- http://mail.python.org/mai

Re: dict slice in python (translating perl to python}

2008-09-12 Thread Hendrik van Rooyen
MRAB wrote: >On Sep 11, 6:11 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >[snip] >> (the next step towards true Pythonicness would be to store your data in 8<--- >> >Surely the word is "Pythonicity"? :-) When faced with the choice between "Pythonicness" and "Pythonicity", I

Ascii Menu I/O redirection

2008-09-20 Thread Hendrik van Rooyen
I am writing a small application with a simple ascii based menu. The menu is used to test individual functions, and to change some timings. Otherwise the application just runs automatically, depending on command line options. I want to be able to redirect the menu. The console, a serial port, or

Re: Ascii Menu I/O redirection

2008-09-20 Thread Hendrik van Rooyen
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >I'm not sure that closing stdin and stout are a good idea. This could >have side-effects for other parts of your program, and will almost >certainly end badly if you're running in the interactive interpreter. > Its a very simple thingy - there will o

Re: nested structure with "internal references"

2009-09-26 Thread Hendrik van Rooyen
On Friday, 25 September 2009 19:11:06 Torsten Mohr wrote: > I'd like to use a nested structure in memory that consists > of dict()s and list()s, list entries can be dict()s, other list()s, > dict entries can be list()s or other dict()s. > > The lists and dicts can also contain int, float, string,

Re: Most "active" coroutine library project?

2009-09-28 Thread Hendrik van Rooyen
On Saturday, 26 September 2009 16:55:30 Grant Edwards wrote: > On 2009-09-26, Dave Angel wrote: > > Actually even 64k looked pretty good, compared to the 1.5k of > > RAM and 2k of PROM for one of my projects, a navigation system > > for shipboard use. > > I've worked on projects as recently as the

Re: Using String for new List name

2009-09-29 Thread Hendrik van Rooyen
On Monday, 28 September 2009 18:54:09 Scott wrote: > I am new to Python but I have studied hard and written a fairly big > (to me) script/program. I have solved all of my problems by Googling > but this one has got me stumped. > > I want to check a string for a substring and if it exists I want to

Re: os.listdir unwanted behaviour

2009-09-29 Thread Hendrik van Rooyen
On Tuesday, 29 September 2009 11:03:17 Tim Chase wrote: > I think Steven may be remembering the conversation here on c.l.p > a month or two back where folks were asking to turn os.listdir() > into an iterator (or create an os.xlistdir() or os.iterdir() > function) because directories with lots of

Re: Most "active" coroutine library project?

2009-09-29 Thread Hendrik van Rooyen
On Monday, 28 September 2009 16:44:48 Grant Edwards wrote: > $10 is pretty expensive for a lot of applications. I bet that > processor also uses a lot of power and takes up a lot of board > space. If you've only got $2-$3 in the money budget, 200uA at > 1.8V in the power budget, and 6mm X 6mm of

Re: How to pass a global variable to a module?

2009-09-30 Thread Hendrik van Rooyen
On Tuesday, 29 September 2009 20:24:53 Mars creature wrote: > >From the link Gregor posted, it seems no way to share variable between > > modules. > > I can understand the point that global variables tends to mess up > programs. > > Assume that I have 10 parameters need to pass to the function. If

Re: Most "active" coroutine library project?

2009-09-30 Thread Hendrik van Rooyen
On Wednesday, 30 September 2009 04:16:45 Grant Edwards wrote: > Assembler macros are indeed a lost art. Back in the day, I > remember seeing some pretty impressive macro libraries layered > 2-3 deep. I've done assember macros as recently as about 2-3 > years go because it was the easiest way to

Re: Most "active" coroutine library project?

2009-09-30 Thread Hendrik van Rooyen
On Wednesday, 30 September 2009 09:46:38 Paul Rubin wrote: > Getting away from python in the opposite direction, if you click > >http://cufp.galois.com/2008/schedule.html > > the second presentation "Controlling Hybrid Vehicles with Haskell" > might interest you. Basically it's about a high l

Re: Most "active" coroutine library project?

2009-10-01 Thread Hendrik van Rooyen
On Thursday, 1 October 2009 00:27:02 Rhodri James wrote: > I was going to say, you want 256 bytes of RAM, you profligate > so-and-so? Here, have 32 bytes of data space and stop your > whining :-) My multi tasking is coming on nicely, but I am struggling a bit with the garbage collection. The T

Re: creating class objects inside methods

2009-10-04 Thread Hendrik van Rooyen
On Sunday, 4 October 2009 08:14:08 horos11 wrote: > Saying that 'whoa, this coding error should be handled by naming > convention' may be the only practical way of getting around this > limitation, but it is a limitation nonetheless, and a pretty big one. You misunderstand the dynamic nature of p

Re: Skeletal animation

2009-10-05 Thread Hendrik van Rooyen
On Monday, 5 October 2009 00:05:21 Manowar wrote: > I am new to pyton and have asked this question several times the > answer is always not sure. > Here is my question sekeltal animation ( bone animation) is it > possible with python? What i want to develop is an aquarium in > realtime, skeletal an

Re: Tkinter -- the best way to make a realtime loop

2009-10-08 Thread Hendrik van Rooyen
On Thursday, 8 October 2009 00:40:42 J Wolfe wrote: > What's the best way to make a realtime loop in Tkinter? I know in > perl you can use "repeat" and it will call a function every x seconds, > in python it seems like "after" may be the equivalent though it > doesn't seem to behave like the perl

Re: No threading.start_new_thread(), useful addition?

2009-10-08 Thread Hendrik van Rooyen
On Thursday, 8 October 2009 13:24:14 Christian Heimes wrote: > Laszlo Nagy wrote: > > But really thread.start_new_thread is better: > > > > import thread.start_new_thread as thr > > > > thr(my_function,arg1,arg2) > > Please don't use the thread module directly, especially the > start_new_thread fun

Re: Is there a better way to code variable number of return arguments?

2009-10-08 Thread Hendrik van Rooyen
On Thursday, 8 October 2009 18:41:31 Dr. Phillip M. Feldman wrote: > I currently have a function that uses a list internally but then returns > the list items as separate return > values as follows: > > if len(result)==1: return result[0] > if len(result)==2: return result[0], result[1] > > (and so

Re: The rap against "while True:" loops

2009-10-10 Thread Hendrik van Rooyen
On Saturday, 10 October 2009 22:15:21 kj wrote: > I'm coaching a group of biologists on basic Python scripting. One > of my charges mentioned that he had come across the advice never > to use loops beginning with "while True". Of course, that's one > way to start an infinite loop, but this seems

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-10 Thread Hendrik van Rooyen
On Sunday, 11 October 2009 02:24:34 Stephen Hansen wrote: > It's really better all around for "modules" to be considered like > libraries, that live over There, and aren't normally executed. Then you > have scripts over Here which may just be tiny and import a module and call > that module's "main

Re: RabbitMQ vs ApacheQpid (AMQP)

2009-10-13 Thread Hendrik van Rooyen
On Tuesday, 13 October 2009 11:42:03 jacopo wrote: > > Background: > I have a main machine dispatching heavy calculations to different > machines, collecting the results, performing some calculation on the > merged results and starting all over again with fresher data. I > implemented a first solut

Re: efficient running median

2009-10-13 Thread Hendrik van Rooyen
On Tuesday, 13 October 2009 17:22:55 Janto Dreijer wrote: > I'm looking for code that will calculate the running median of a > sequence, efficiently. (I'm trying to subtract the running median from > a signal to correct for gradual drift). > > My naive attempt (taking the median of a sliding window

Re: The rap against "while True:" loops

2009-10-18 Thread Hendrik van Rooyen
On Saturday, 17 October 2009 16:30:55 Aahz wrote: > In article , > > Tim Rowe wrote: > >The point is that an exception causes a change in program flow, so of > >course they're used for flow control. It's what they do. The question > >is in what cases it's appropriate to use them. > > Standard Pyt

Re: The rap against "while True:" loops

2009-10-18 Thread Hendrik van Rooyen
On Sunday, 18 October 2009 11:31:19 Paul Rubin wrote: > Hendrik van Rooyen writes: > > Standard Python idiom: > > > > if key in d: > > d[key] += value > > else: > > d[key] = value > > The issue is that uses two lookups. If that's ok, the mor

Re: The rap against "while True:" loops

2009-10-20 Thread Hendrik van Rooyen
On Monday, 19 October 2009 09:43:15 Steven D'Aprano wrote: > On Mon, 19 Oct 2009 08:51:44 +0200, Hendrik van Rooyen wrote: > > The point I was trying to make > > subliminally, was that there is a relative cost of double lookup for all > > cases versus exceptions for some

Re: self.__dict__ tricks

2009-10-31 Thread Hendrik van Rooyen
On Friday, 30 October 2009 17:28:47 MRAB wrote: > Wouldn't it be clearer if they were called dromedaryCase and > BactrianCase? :-) Ogden Nash: The Camel has a single hump- The Dromedary, two; Or the other way around- I'm never sure. - Are You? - Hendrik -- http://mail.python.org/mailman/list

Re: Winter Madness - Passing Python objects as Strings

2009-06-05 Thread Hendrik van Rooyen
"Gabriel Genellina" wrote: >Ah... I had the same impression as Mr. Reedy, that you were directly >reading from a socket and processing right there, so you *had* to use >strings for everything. not "had to" - "chose to" - to keep the most used path as short as I could. > >But if you already

Re: fastest way to test file for string?

2009-06-05 Thread Hendrik van Rooyen
"kj" wrote: > > Hi. I need to implement, within a Python script, the same > functionality as that of Unix's > >grep -rl some_string some_directory > > I.e. find all the files under some_directory that contain the string > "some_string". > > I imagine that I can always resort to the shell

Re: Winter Madness - Passing Python objects as Strings

2009-06-05 Thread Hendrik van Rooyen
"Nigel Rantor" wrote: > Well, why not have a look at Gabriel's response. I have, and have responded at some length, further explaining what I am doing, and why. > That seems like a much more portable way of doing it if nothing else. There is nothing portable in what I am doing - it is aimed a

Re: Winter Madness - Passing Python objects as Strings

2009-06-06 Thread Hendrik van Rooyen
"Gabriel Genellina" wrote: > From your description of the problem, it seems you are acting upon >messages received from a serial port. You have to process the message >*before* the next one arrives -- but you gain nothing doing that much >faster. In other words, even with a blazingly fast p

Re: Winter Madness - Passing Python objects as Strings

2009-06-06 Thread Hendrik van Rooyen
"Scott David Daniels" wrote: > I can think of use cases for can, and from that use an alternate > construct. The use case is passing a reference out over a wire > (TCP port?) that will be used later. This will work, provided the thing is still alive and in the same place when the can eventuall

Re: Winter Madness - Passing Python objects as Strings

2009-06-06 Thread Hendrik van Rooyen
"Miles Kaufmann" wrote: > On Jun 4, 2009, at 3:25 AM, Hendrik van Rooyen wrote: > > > A can is like a pickle, in that it is a string, but anything > > can be canned. > > Unlike a pickle, a can cannot leave the process, though, > > unless the object it poin

Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
One can go from lb = ['b','a','n','a','n','a'] to s = "banana" by using s = "".join(lb) Is there a way to go the reverse route? I have not been able to find one. It is obviously easy to write a for char in s loop or list comprehension, but there seems to be no function or string method to return

Re: Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
jon vs. python wrote: >Sorry, I didn't realize that you already proposed list comprehension. > > >There is some kind of asymmetry in several areas.I guess that's somehow related to this post: >http://www.zedshaw.com/blog/2009-05-29.html Thanks for the link - I am not quite as rabid, but it wou

Re: SPAM-LOW: Re: Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
"Chris Rebert" wrote: > lb = list("banana") Aaargh! I should have known - you use a string method to get a list of words, but you have to go to the list to get a list of characters from a string. There is no string method to do it, which is what I am complaining about. Is there a reason for th

Re: Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
"Diez B. Roggisch" wrote: > > I think > > lb = list(s) > > is good enough. It does the job, of course, but it is not a string method. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: xmlrpclib and generators

2009-06-10 Thread Hendrik van Rooyen
Ken Seehart wrote: 8< implementation -- >The practical constraints of my specific application are: >1. The rpc server is a highly specialized slave system that does heavy duty work. >2. The rpc client is itself a web server that dispatches work requests to the rpc serve

Re: question about a command like 'goto ' in Python's bytecode orit's just a compiler optimization?

2009-06-17 Thread Hendrik van Rooyen
"Diez B. Roggisch" wrote: > Getting a depression because of a compiler is a bit strong... > > However, yes, bytecode is similar to assembler, and in that respect > higher-level control-structures are created using (conditional) jumps. > > The same is true for other bytecode-languages, see here f

Re: Tool for browsing python code

2009-06-17 Thread Hendrik van Rooyen
Horace Blegg wrote: >I've heard from my cousin that his former high school classmate's >uncle did a research on a large statistical sample of programmers and >found that emacs users' brains are about 12% smaller than vi users' :) >I'm afraid it's the other way around, really. You see, emacs cont

Re: Developing GUI applications

2009-06-21 Thread Hendrik van Rooyen
"Grant Ito" wrote: > Hi everyone. > > I'm looking to find out what people are using for an open source wysiwyg GUI > developer. I'm running both Linux and Windows but prefer to do my > development in Linux. I've got the most experience with Tkinter but am > willing to look at wxPython and Ti

Re: Status of Python threading support (GIL removal)?

2009-06-21 Thread Hendrik van Rooyen
"Kay Schluehr" wrote: > This implies that people stay defensive concerning concurrency ( like > me right now ) and do not embrace it like e.g. Erlang does. Sometimes > there is a radical change in the way we design applications and a > language is the appropriate medium to express it succinctly.

Re: Status of Python threading support (GIL removal)?

2009-06-22 Thread Hendrik van Rooyen
"Paul Rubin" <http://phr...@nospam.invalid> wrote: > "Hendrik van Rooyen" writes: > > I think that this is because (like your link has shown) the problem > > is really not trivial, and also because the model that can bring > > sanity to the party

Re: Meta question: disappearing posts (was Re: calculating aself.value, self.randomnum = normalvariate(x, y))

2009-06-24 Thread Hendrik van Rooyen
"Aahz" wrote: > While that's also a bug in Mailman (I have a long-standing to-do item to > fix that), there are also plenty of posts that simply aren't showing up > in c.l.py. As I said, I'm pretty sure (based on what was happening with > c.l.py.announce) that it's some kind of weird problem wit

Re: Measuring Fractal Dimension ?

2009-06-24 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: > >> In my universe the standard definition of "log" is different froim what >> log means in a calculus class > >Now I'm curious what the difference is. > Maybe he is a lumberjack, and quite all right... - He

Fw: Meta question: disappearing posts (was Re: calculating aself.value, self.randomnum = normalvariate(x, y))

2009-06-25 Thread Hendrik van Rooyen
Below is one that just disappeared, without any feedback: (unless I just missed it) - Hendrik - Original Message - From: "Hendrik van Rooyen" To: "Aahz" ; Sent: Wednesday, June 24, 2009 10:08 AM Subject: Re: Meta question: disappearing posts (was Re: cal

Re: Beginning with Python; the right choice?

2009-06-27 Thread Hendrik van Rooyen
"Terry Reedy" wrote: > I consider Python the Basic of the 21st century. Oh Dear. Was it not Dijkstra who said that learning basic rotted your brain, or words more or less to that effect? And here I am, feeling rather dull lately... :-) To the OP: - Learning Python will get you goin

Re: The Python Way for module configuration?

2009-06-28 Thread Hendrik van Rooyen
"kj" wrote: > I want to write a module that serves as a Python front-end to a > database. This database can be either in the form of tab-delimited > flat files, XML files, or a PostgreSQL server. The module is meant > to hide these database implementation details from its users. > > But, mini

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-05 Thread Hendrik van Rooyen
"John Nagle" wrote: > Python doesn't have a "switch" or "case" statement, and when > you need a state machine with many states, that makes for painful, > slow code. There's a comment in the code that it would be useful > to run a few billion lines of HTML through an instrumented version > of the

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-05 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >On Sun, 05 Jul 2009 10:12:54 +0200, Hendrik van Rooyen wrote: > >> Python is not C. > >John Nagle is an old hand at Python. He's perfectly aware of this, and >I'm sure he's not trying to program C in Python. > &g

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-05 Thread Hendrik van Rooyen
"Paul Rubin" wrote: > The series of tests is written that way because there is no case > statement available. It is essentially switching on a bunch of > character constants and then doing some additional tests in each > branch. > > It could be that using ord(c) as

Re: A Bug By Any Other Name ...

2009-07-06 Thread Hendrik van Rooyen
"Terry Reedy" wrote: > Gabriel Genellina wrote: > > > > In this case, a note in the documentation warning about the potential > > confusion would be fine. > > How would that help someone who does not read the doc? It obviously won't. All it will do, is that it will enable people on this group

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-06 Thread Hendrik van Rooyen
"Jean-Michel Pichavant" wrote: > Woot ! I'll keep this one in my mind, while I may not be that concerned > by speed unlike the OP, I still find this way of doing very simple and > so intuitive (one will successfully argue how I was not figuring this > out by myself if it was so intuitive). > A

Re: Remoting over SSH

2009-07-08 Thread Hendrik van Rooyen
"Hussein B" wrote: > Hey, > I want to perform commands on a remote server over SSH. > What do I need? > Thanks. Access privileges for the remote machine. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: tough-to-explain Python

2009-07-10 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: > >>> persistent idea "out there" that programming is a very accessible >>> skill, like cooking or gardening, anyone can do it, and even profit >>> from it, monetarily or otherwise, etc., and to some extent I am >>

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >On Fri, 10 Jul 2009 12:54:21 +0200, Hendrik van Rooyen wrote: > >> "Steven D'Aprano" wrote: >> >>>On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: >>> >>>>> persistent idea "o

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
"pdpi" wrote; >I've always found cooking an apt metaphor for programming. No this is wrong. Writing a recipe or a cookbook is like programming. Cooking, following a recipe, is like running a program. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
"D'Arcy J.M. Cain" > One might also argue that divorcing the design from the code is the > problem in a lot of legacy code. See Agile Programming methods. Now > you could say that there is a design step still in talking to the > client and making a plan in your head or in some notes but that's

Re: tough-to-explain Python

2009-07-11 Thread Hendrik van Rooyen
John O'Hagan wrote: >The drawings produced by an architect, the script of a play, the score of a piece of music, and the draft of a piece of >legislation are all examples of other things which are "useless" until they are interpreted in some way. Granted. But... >There are countless human act

Re: missing 'xor' Boolean operator

2009-07-15 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >Unfortunately, outside of boolean algebra and simulating electrical >circuits, I can't think of any use-cases for an xor operator. Do you have >any? A bitwise xor is a poor man's comparator - if the result is binary zero, the operands were equal, no matter what they

Re: missing 'xor' Boolean operator

2009-07-16 Thread Hendrik van Rooyen
"Hrvoje Niksic" wrote: > Note that in Python A or B is in fact not equivalent to not(not A and > not B). De Morgan would turn in his grave. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: How to receive a data file of unknown length using a python socket?

2009-07-19 Thread Hendrik van Rooyen
On Sunday 19 July 2009 02:12:32 John Machin wrote: > > Apologies in advance for my ignorance -- the last time I dipped my toe > in that kind of water, protocols like zmodem and Kermit were all the > rage -- but I would have thought there would have been an off-the- > shelf library for peer-to-peer

Re: How to receive a data file of unknown length using a python socket?

2009-07-19 Thread Hendrik van Rooyen
On Sunday 19 July 2009 15:18:21 pyt...@bdurham.com wrote: > Hi Hendrik, > > If anybody is interested I will attach the code here. It is not a big > > module. > > I am interested in seeing your code and would be grateful if you shared > it with this list. All right here it is. Hope it helps - He

Re: Help understanding the decisions *behind* python?

2009-07-21 Thread Hendrik van Rooyen
On Monday 20 July 2009 21:26:07 Phillip B Oldham wrote: > On Jul 20, 6:08 pm, Duncan Booth wrote: > > The main reason why you need both lists and tuples is that because a > > tuple of immutable objects is itself immutable you can use it as a > > dictionary key. > > Really? That sounds interesting,

Re: Help understanding the decisions *behind* python?

2009-07-21 Thread Hendrik van Rooyen
On Tuesday 21 July 2009 15:49:59 Inky 788 wrote: > On Jul 20, 12:27 pm, Phillip B Oldham > > wrote: > > [snip] We > > understand that lists are mutable and tuples are not, but we're a > > little lost as to why the two were kept separate from the start. They > > both perform a very similar job as f

Re: binary literal

2009-07-23 Thread Hendrik van Rooyen
On Wednesday 22 July 2009 12:03:44 superpollo wrote: > can i do something like the above, but using a *binary* number? (e.g. > 00101101 instead of 45) ? 00101101 is not hex 45. hex 45 is 01000101 >>> chr(int('01000101',2)) 'E' >>> - Hendrik -- http://mail.python.org/mailman/listinfo/python-

Re: Help understanding the decisions *behind* python?

2009-07-23 Thread Hendrik van Rooyen
On Wednesday 22 July 2009 16:36:51 Inky 788 wrote: > On Jul 22, 2:36 am, Hendrik van Rooyen > > wrote: > > The good reason is the immutability, which lets you use > > a tuple as a dict key.   > > Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm

Re: Gedcom and Genealogy

2009-07-24 Thread Hendrik van Rooyen
On Friday 24 July 2009 00:14:19 Gordon wrote: > We have many small libraries in JAVA or Ruby that need to be ported to > Python. Actually it's so simple a rewrite is possible too. Is this: 1 - A question? 2 - A job offer? 3 - A piece of random news? - Hendrik -- http://mail.python.org/mailman/

Re: len() should always return something

2009-07-25 Thread Hendrik van Rooyen
On Friday 24 July 2009 16:45:40 Mark Dickinson wrote: > On Jul 24, 3:11 pm, "Rhodri James" > > wrote: > > Which doesn't make your point less valid.  In fact I'd go so > > far as to argue that what len() gives you is the number of > > items in a container, so len(7) should return 0. > > Nah. 7 c

Re: Help understanding the decisions *behind* python?

2009-07-25 Thread Hendrik van Rooyen
On Friday 24 July 2009 17:07:30 Inky 788 wrote: > On Jul 23, 3:42 am, Hendrik van Rooyen > > wrote: 8< > > Steven showed why you cannot have a mutable thing > > as a key in a dict. > > > > if you think it is contrived, then please cons

Re: len() should always return something

2009-07-25 Thread Hendrik van Rooyen
On Friday 24 July 2009 21:04:55 Roy Smith wrote: > Compressing strings to a single bit is easy. It's the uncompressing that's > tricky. Not really - all you have to do is to apply the EXACT same sequence of operations that compressed it, in reverse. The unfortunate part is that this informatio

Re: len() should always return something

2009-07-25 Thread Hendrik van Rooyen
On Friday 24 July 2009 22:09:15 Marcus Wanner wrote: > First one to correctly decompress the value 0 into an ASCII character > wins the title of the world's most capable hacker :p that is easy. the xor of 0 and 1 is 1, which is ASCII soh, if I remember right. soh is start of header. Burroughs

Re: len() should always return something

2009-07-25 Thread Hendrik van Rooyen
On Saturday 25 July 2009 14:59:43 Steven D'Aprano wrote: > On Sat, 25 Jul 2009 10:03:58 +0200, Piet van Oostrum wrote: > >>S> And there's nothing ambiguous about len(42). > > > > len(42) should be 7.5 million. > > And "I don't understand your reasoning".upper() should be "Millennium > Hand and Shri

Re: Distinguishing active generators from exhausted ones

2009-07-26 Thread Hendrik van Rooyen
On Saturday 25 July 2009 20:30:54 Michal Kwiatkowski wrote: > Hi, > > Is there a way to tell if a generator has been exhausted using pure > Python code? I've looked at CPython sources and it seems that > something like "active"/"exhausted" attribute on genobject is missing > from the API. For the t

Re: If Scheme is so good why MIT drops it?

2009-07-27 Thread Hendrik van Rooyen
On Sunday 26 July 2009 21:26:46 David Robinow wrote: > > I'm a mediocre programmer. Does this mean I should switch to PHP? I have searched, but I can find nothing about this mediocre language. Could you tell us more? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: If Scheme is so good why MIT drops it?

2009-07-28 Thread Hendrik van Rooyen
On Monday 27 July 2009 16:49:25 Aahz wrote: > In article , > > Hendrik van Rooyen wrote: > >On Sunday 26 July 2009 21:26:46 David Robinow wrote: > >> I'm a mediocre programmer. Does this mean I should switch to PHP? > > > >I have searched, but I can

Re: If Scheme is so good why MIT drops it?

2009-07-29 Thread Hendrik van Rooyen
On Tuesday 28 July 2009 17:11:02 MRAB wrote: > If you were a "COBOL" programmer, would you want to shout about it? :-) Hey don't knock it! - at the time, it was either COBOL or FORTRAN or some assembler or coding in hex or octal. And if code is data, where is Pythons ALTER statement? *Ducks* :

Re: If Scheme is so good why MIT drops it?

2009-07-31 Thread Hendrik van Rooyen
On Thursday 30 July 2009 03:09:14 greg wrote: > Hendrik van Rooyen wrote: > > And if code is data, where is Pythons ALTER statement? > > class Duck: > >def quack(self): > print "Quack!" > > def moo(): >print "Moo!" > >

Re: Does python have the capability for driver development ?

2009-07-31 Thread Hendrik van Rooyen
On Thursday 30 July 2009 15:20:45 Dave Angel wrote: > As far as I know, nobody has yet built a microcode implementation of a > Python VM (Virtual Machine). Nor have I seen one for the Java VM. Atmel has made an ARM that has support for Java Bytecode. AT91SAM9X512 and friends (smaller versions)

Re: file comparison

2009-07-31 Thread Hendrik van Rooyen
On Friday 31 July 2009 11:25:17 learner learner wrote: > Hi all, > > I want to compare two text files line by line and eliminate the > matching/repeated line and store the unmatched/leftout lines into a third > file or overwrite into one of them. This is not as simple as it seems. You will probab

Re: Which GUI framework to use?

2009-08-04 Thread Hendrik van Rooyen
On Tuesday 04 August 2009 06:09:05 koranthala wrote: > Hi, >I am creating a very minimal application (a networking app). >I have written the application using Twisted. >Now, I need to put a GUI wrapper on the application. >The application needs a login screen and also it needs to be

Re: Using Python to automate builds

2009-08-05 Thread Hendrik van Rooyen
On Tuesday 04 August 2009 21:13:10 Kosta wrote: > I am a Python newbie, tasked with automating (researching) building > Windows drivers using the WDK build environment. I've been looking > into Python for this (instead of writing a bunch of batch files). > Why do you not use make and a makefile -

Re: Using Python to automate builds

2009-08-05 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 14:08:18 David Cournapeau wrote: > On Wed, Aug 5, 2009 at 4:56 PM, Hendrik van > > Rooyen wrote: > > On Tuesday 04 August 2009 21:13:10 Kosta wrote: > >> I am a Python newbie, tasked with automating (researching) building > >> Wi

Re: Datetime with float seconds

2009-08-05 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 14:50:04 kpal wrote: > Hello Everybody, > > The standard datetime has 1 microsecond granularity. My application > needs finer time resolution, preferably float seconds. Is there an > alternative to the out-of-the-box datetime? Timezone support is not > essential. I am c

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 16:46:13 Martin P. Hellwig wrote: > Hi List, > > On several occasions I have needed (and build) a parser that reads a > binary piece of data with custom structure. For example (bogus one): > > BE > +-+-+-+-+--++ > > | V

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 20:12:05 Paul Rubin wrote: > "Martin P. Hellwig" writes: > > what I usually do is read the packet in binary mode, convert the > > output to a concatenated 'binary string'(i.e. '0101011000110') and > > Something wrong with reading the data words as an integer and using >

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 21:41:26 Martin P. Hellwig wrote: > Yes you are (of course) right, my 'dream' solution would be something > that accepts slice indeces on bit level. Your reasoning did reveal some > flaws in my approach though ;-) This is the first time I have been compared to the sand

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-07 Thread Hendrik van Rooyen
On Thursday 06 August 2009 20:50:30 Martin P. Hellwig wrote: > Thanks all for your insights and suggestions. > It seems to me that there are a couple of ways to this bit manipulation > and a couple of foreign modules to assist you with that. > > Would it be worth the while to do a PEP on this? > Pe

<    3   4   5   6   7   8   9   >