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: 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: 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-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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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: 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-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: 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: 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: 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: 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-25 Thread Hendrik van Rooyen
On Thursday, 24 September 2009 15:42:36 Antoine Pitrou wrote: > Grant Edwards invalid.invalid> writes: > > Back when I worked on one of the first hand-held cellular > > mobile phones, it used co-routines where the number of > > coroutines was fixed at 2 (one for each register set in a Z80 > > CPU)

Re: easy question, how to double a variable

2009-09-22 Thread Hendrik van Rooyen
On Monday, 21 September 2009 22:50:31 daggerdvm wrote: > carl banks.you are a dork No mister_do_my_homework, he is not. He is actually a respected member of this little community. You, however, are beginning to look like one. Why do you not come clean - tell us what you are doing, sho

Re: How to change string or number passed as argument?

2009-09-20 Thread Hendrik van Rooyen
On Sunday 20 September 2009 03:59:21 Peng Yu wrote: > I know that strings or numbers are immutable when they passed as > arguments to functions. But there are cases that I may want to change > them in a function and propagate the effects outside the function. I > could wrap them in a class, which

Re: An assessment of the Unicode standard

2009-09-19 Thread Hendrik van Rooyen
On Saturday 19 September 2009 09:12:34 greg wrote: > From my own experience, I know that it's possible for me to > think about things that I don't have a word for. An example > occured once when I was developing a 3D game engine, and > I was trying to think of a name for the thing that exists > w

Re:OT - people eaters - was: An assessment of the Unicode standard

2009-09-18 Thread Hendrik van Rooyen
On Friday 18 September 2009 06:39:57 Dennis Lee Bieber wrote: > A one-eyed, one-horned, flying purple people eater? > > {Which brings up the confusing question... Is the eater purple, or does > it eat purple people (which is why it is so rare... it only eats people > caught in the last stage

Re: An assessment of the Unicode standard

2009-09-18 Thread Hendrik van Rooyen
On Thursday 17 September 2009 15:29:38 Tim Rowe wrote: > There are good reasons for it falling out of favour, though. At the > time of the Sapir-Whorf hypothesis, anthropologists were arguing that > members of a certain remote tribe did not experience grief on the > death of a child because their

Re: Are min() and max() thread-safe?

2009-09-17 Thread Hendrik van Rooyen
On Thursday 17 September 2009 12:57:18 Carl Banks wrote: > On Sep 17, 2:18 am, Hendrik van Rooyen > > wrote: > > When running min or max on a list of ints, there is probably no > occasion for the function to release the GIL. If a thread doesn't > release the GIL no ot

Re: Are min() and max() thread-safe?

2009-09-17 Thread Hendrik van Rooyen
On Thursday 17 September 2009 06:33:05 Steven D'Aprano wrote: > I have two threads, one running min() and the other running max() over > the same list. I'm getting some mysterious results which I'm having > trouble debugging. Are min() and max() thread-safe, or am I doing > something fundamentally

Fwd: Re: How to improve this code?

2009-09-16 Thread Hendrik van Rooyen
>From a private email, forwarded to the list: -- Forwarded Message -- Subject: Re: How to improve this code? Date: Tuesday 15 September 2009 From: Oltmans To: hend...@microcorp.co.za On Sep 15, 1:13 pm, Hendrik van Rooyen wrote: > > (i) a True if All the elements

Re: An assessment of the Unicode standard

2009-09-16 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 19:04:10 r wrote: > On Sep 15, 4:12 am, Hendrik van Rooyen > wrote: > (snip) > > > When a language lacks a word for a concept like "window", then (I > > believe  :-) ), it kind of puts a crimp in the style of thinking that a > &

Re: OT Language wars - was :An assessment of the Unicode standard

2009-09-16 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 18:22:30 Christopher Culver wrote: > Hendrik van Rooyen writes: > > 2) Is about as useful as stating that any Turing complete language and > > processor pair is capable of solving any computable problem, given enough > > time. So why are we n

Re: str.split() with empty separator

2009-09-16 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 14:50:11 Xavier Ho wrote: > On Tue, Sep 15, 2009 at 10:31 PM, Ulrich Eckhardt > > wrote: > > "'abc'.split('')" gives me a "ValueError: empty separator". > > However, "''.join(['a', 'b', 'c'])" gives me "'abc'". > > > > Why this asymmetry? I was under the impression that

Re: An assessment of the Unicode standard

2009-09-15 Thread Hendrik van Rooyen
On Monday 14 September 2009 14:06:36 Christopher Culver wrote: > This is the old Sapir-Whorf hypothesis, which fell out of favour among > linguists half a century ago already. 1) Language does not constrain > human thought, and 2) any two human languages are both capable of > expressing the same t

Re: Incremental project based programming guide

2009-09-15 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 04:43:46 bouncy...@gmail.com wrote: > I was wondering if anyone had actually designed their programming text > around incremental parts of a project and then taken the results of the > project at each chapter and created something of value. specifically in > referwnce t

Re: How to improve this code?

2009-09-15 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 03:08:59 Oltmans wrote: > match=[1,2,3,4,5] > > def elementsPresent(aList): > result=False > if not aList: > return False > for e in aList: > if e in match: > result=True > else: >

Re: NameError: name '__main__' is not defined

2009-09-14 Thread Hendrik van Rooyen
On Monday 14 September 2009 03:43:19 Peng Yu wrote: > Hi, > > I try the following code. I don't quite understand why __main__ is not > defined. Could somebody let me know what I am wrong about it? > > Regards, > Peng > > $ cat test.py > #!/usr/bin/env python > > if __main__ == '__main__' : > prin

Re: How to define a function with an empty body?

2009-09-13 Thread Hendrik van Rooyen
On Sunday 13 September 2009 05:37:01 Peng Yu wrote: > Hi, > > I want to define a function without anything in it body. In C++, I can > do something like the following because I can use "{}" to denote an > empty function body. Since python use indentation, I am not sure how > to do it. Can somebody

Re: Finite state machine in python

2009-09-13 Thread Hendrik van Rooyen
On Saturday 12 September 2009 22:39:10 Peng Yu wrote: > Hi, > > I have see some discussion on the implementation of finite state > machine in python. Can somebody point to me the best way in implenting > an FSM in python? > > http://code.activestate.com/recipes/146262/ You can go a long way with a

Re: how to return value from button clicked by python

2009-09-12 Thread Hendrik van Rooyen
On Saturday 12 September 2009 06:57:26 Tim Roberts wrote: > chen tao wrote: > > I have several buttons, I want to realize: when I click first > >button, the button will call a function, and the function should > >return some parameter value, because I need this value for the other > >buttons.

Re: New Tkinter windows don't get focus on OS X

2009-09-11 Thread Hendrik van Rooyen
On Friday 11 September 2009 09:53:56 eb303 wrote: > On Sep 11, 9:14 am, Hendrik van Rooyen > wrote: > > look for widget.focus_force() > > and look for widget.grab_set_global() > > Doesn't work. BTW, forcing the focus or setting the grab globally are > usually cons

Re: New Tkinter windows don't get focus on OS X

2009-09-11 Thread Hendrik van Rooyen
On Thursday 10 September 2009 18:19:09 Joshua Bronson wrote: > True, but it'll still be a lot less painful for me to test my app if I > can get it to steal focus > when launched from the command line. If anyone knows how to do this in > Tkinter, help would be much appreciated. > look for widget.f

Re: Output file formatting/loop problems -- HELP?

2009-09-08 Thread Hendrik van Rooyen
On Tuesday 08 September 2009 17:22:30 Maggie wrote: > My code is supposed to enumerate each line of file (1, 2, 3...) and > write the new version into the output file -- > > #!/usr/bin/python > > import os.path > import csv > import sys > > #name of output file > filename = "OUTPUT.txt" > > > #open

Re: The future of Python immutability

2009-09-08 Thread Hendrik van Rooyen
On Monday 07 September 2009 20:26:02 John Nagle wrote: > Right. Tracking mutablity and ownership all the way down without > making the language either restrictive or slow is tough. > > In multi-thread programs, though, somebody has to be clear on who owns > what. I'm trying to figure out

Re: Turn-based game - experimental economics

2009-09-05 Thread Hendrik van Rooyen
On Saturday 05 September 2009 12:07:59 Paolo Crosetto wrote: 8<--- > > The problem I now face is to organise turns. Players, as in Scrabble, will > play in turns. So far I have developed the server and ONE client, and > cannot get my head round to - nor

Re: The future of Python immutability

2009-09-04 Thread Hendrik van Rooyen
On Thursday 03 September 2009 21:07:21 Nigel Rantor wrote: > That is not the challenge, that's the easy part. The challenge is > getting useful information out of a system that has only been fed > immutable objects. Is it really that difficult? (completely speculative): class MyAnswer(object):

Re: string find mystery

2009-09-03 Thread Hendrik van Rooyen
On Thursday 03 September 2009 07:10:37 Helvin wrote: > Hi, > > I have come across this very strange behaviour. Check this code: > > if file_str.find('Geometry'): > #if file_str.endswith('Data_Input_Geometry.txt'): > print 'I found geometry' > elif file_str.find('

Re: map

2009-09-02 Thread Hendrik van Rooyen
On Wednesday 02 September 2009 09:38:20 elsa wrote: > > in my own defense - firstly, I was able to implement what I wanted to > do with loops, and I used this to solve the problem I needed to. My rant was not intended as a personal attack - far from it - if all the people on this list were to po

Re: An assessment of the Unicode standard

2009-09-02 Thread Hendrik van Rooyen
On Wednesday 02 September 2009 08:52:55 Gabriel Genellina wrote: > En Tue, 01 Sep 2009 19:49:57 -0300, r escribió: > > On Sep 1, 1:52 pm, Hyuga wrote: > > (snip) > > > >> I'd say don't feel the troll, but too late for that I guess.   > > > > The only trolls in this thread are you and the others w

Re: Daemon process

2009-09-02 Thread Hendrik van Rooyen
On Wednesday 02 September 2009 05:57:02 Shan wrote: > I have XML RPC Server listening on a port. This XML RPC Server works > fine when i run it as foreground process. All the clients are able to > connect with the XML RPC Server. But when i run it as daemon(not using > &. I am doing it in python wa

Re: Executing python script stored as a string

2009-09-01 Thread Hendrik van Rooyen
On Tuesday 01 September 2009 11:32:29 Steven D'Aprano wrote: > Possibly there is a way to have a thread halt itself after a certain > amount of time? I'm not an expert on threads, I've hardly ever used them. Not automagically, as far as I can see. You are on your own if you want to somehow kill a

Re: map

2009-08-31 Thread Hendrik van Rooyen
On Monday 31 August 2009 11:31:34 Piet van Oostrum wrote: > But ultimately it is also very much a matter of taste, preference and > habit. This is true, but there is another reason that I posted - I have noticed that there seems to be a tendency amongst newcomers to the group to go to great len

Re: map

2009-08-31 Thread Hendrik van Rooyen
On Monday 31 August 2009 06:55:52 elsa wrote: 8< - map question > > (Ultimately, I want to call myFunc(myList[0], 'booHoo'), myFunc(myList > [1], 'booHoo'), myFunc(myList[2], 'booHoo') etc. However, I might want > to call myFunc(myList[0], 'woo'), myFunc(myLis

Re: An assessment of the Unicode standard

2009-08-31 Thread Hendrik van Rooyen
On Sunday 30 August 2009 22:46:49 Dennis Lee Bieber wrote: > Rather elitist viewpoint... Why don't we just drop nukes on some 60% > of populated landmasses that don't have a "western" culture and avoid > the whole problem? Now yer talking, boyo! It will surely help with the basic problem w

Re: Annoying octal notation

2009-08-30 Thread Hendrik van Rooyen
On Monday 24 August 2009 16:14:25 Derek Martin wrote: > In fact, now that I think of it... > > I just looked at some old school papers I had tucked away in a family > album. I'm quite sure that in grammar school, I was tought to use a > date format of 8/9/79, without leading zeros. I can't prove

Re: An assessment of the Unicode standard

2009-08-30 Thread Hendrik van Rooyen
On Sunday 30 August 2009 15:37:19 r wrote: > What makes you think that diversity is lost with a single language? I am quite sure of this - it goes deeper than mere regional differences - your first language forms the way you think - and if we all get taught the same language, then on a very f

Re: An assessment of the Unicode standard

2009-08-30 Thread Hendrik van Rooyen
On Sunday 30 August 2009 02:20:47 John Machin wrote: > On Aug 30, 8:46 am, r wrote: > > Take for instance the Chinese language with it's thousands of > > characters and BS, it's more of an art than a language.  Why do we > > need such complicated languages in this day and time. Many languages > >

Re: Combining C and Python programs

2009-08-29 Thread Hendrik van Rooyen
On Saturday 29 August 2009 09:54:15 Sortie wrote: > I want to write a program that will use ode for the physics > simulation, whose python bindings are outdated. So I'm writing > the physics engine in C and want to write the drawing code in > Python. What will be the best way of making those two pr

Re: What python can NOT do?

2009-08-29 Thread Hendrik van Rooyen
On Saturday 29 August 2009 02:14:39 Tim Chase wrote: > I've also been sorely disappointed by Python's ability to make a > good chocolate cream silk pie. This is not pythons fault - it is yours, for failing to collaborate with a good hardware designer for the robotics. - Hendrik -- http://mail

Re: comparison on list yields surprising result

2009-08-29 Thread Hendrik van Rooyen
On Friday 28 August 2009 21:00:31 Dr. Phillip M. Feldman wrote: > In [21]: x > Out[21]: [1, 2, 3, 5] > > In [22]: x>6 > Out[22]: True > > Is this a bug? No, it is a feature, so that you can use sorted on this: [[1,2,3,4,5],6] - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Protecting against callbacks queuing up?

2009-08-28 Thread Hendrik van Rooyen
On Friday 28 August 2009 00:42:16 Esben von Buchwald wrote: > OK, now things starts to make sense. > > You tell me to do something like this? > > > def doCallback(self): > if self.process_busy==False: > self.process_busy=True > self.at.after(0.01,self.data_c

Re: [OT] How do I reply to a thread by sending a message to python-list@python.org

2009-08-28 Thread Hendrik van Rooyen
On Thursday 27 August 2009 22:57:44 Terry Reedy wrote: > > Nope. I got a duplicate sent to my mailbox, which I hate. > > In particular, because there is no indication that it is an exact > duplicate of what I will also find on the list itself. Please use reply > instead of reply-all. If I do tha

Re: List iterator thread safety

2009-08-28 Thread Hendrik van Rooyen
On Thursday 27 August 2009 16:50:16 Carl Banks wrote: > On Aug 27, 7:25 am, Hendrik van Rooyen > wrote: > > Its not too bad - if you crook a bit - the trick is that you iterate over > > the list backwards when you are removing stuff based on index, so that > > the remain

Re: List iterator thread safety

2009-08-27 Thread Hendrik van Rooyen
On Thursday 27 August 2009 15:26:04 Carl Banks wrote: > Deleting items from a list while iterating over it is a bad idea, > exceptions or not. > > Hmm, this sounds like something someone might do for a game. You have > a list of objects, and in a given time step you have to iterate > through the

Re: Need help with Python scoping rules

2009-08-27 Thread Hendrik van Rooyen
On Thursday 27 August 2009 11:31:41 Steven D'Aprano wrote: > > What you are calculating might actually be quite complicated to enter as > a literal. You might have something like: 8< -- Complicated Table Example --- Me? - never! I am just an assembler program

Re: Need help with Python scoping rules

2009-08-27 Thread Hendrik van Rooyen
On Thursday 27 August 2009 11:14:41 Steven D'Aprano wrote: > On Thu, 27 Aug 2009 08:38:29 +0200, Hendrik van Rooyen wrote: > > On Wednesday 26 August 2009 17:14:27 kj wrote: > >> As I described at length in another reply, the function in question is > >> not inte

Re: Python for professsional Windows GUI apps?

2009-08-27 Thread Hendrik van Rooyen
On Wednesday 26 August 2009 22:47:23 David C Ullrich wrote: > That's great. But do you know of anything I can use as a > visual form design tool in wxPython? Boa Constructor - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Protecting against callbacks queuing up?

2009-08-27 Thread Hendrik van Rooyen
On Wednesday 26 August 2009 22:06:01 Esben von Buchwald wrote: > > I don't really get it... > > I can see that I should put a t.after(...) around the function that does > the work, when calling it. That delays each call for the given period. I > just tried it out, the console keeps saying > --

Re: Need help with Python scoping rules

2009-08-27 Thread Hendrik van Rooyen
On Wednesday 26 August 2009 17:45:54 kj wrote: > In <02a54597$0$20629$c3e8...@news.astraweb.com> Steven D'Aprano writes: > >Why are you defining a method without a self parameter? > > Because, as I've explained elsewhere, it is not a method: it's a > "helper" function, meant to be called only on

Re: Need help with Python scoping rules

2009-08-26 Thread Hendrik van Rooyen
On Wednesday 26 August 2009 17:14:27 kj wrote: > As I described at length in another reply, the function in question > is not intended to be "callable outside the class". And yes, I think this might go to nub of your problem - It might help you to think as follows: A Python class, even after

Re: Object Reference question

2009-08-25 Thread Hendrik van Rooyen
On Tuesday 25 August 2009 21:32:09 Aahz wrote: > In article , > > Hendrik van Rooyen wrote: > >On Friday 21 August 2009 08:07:18 josef wrote: > >> My main focus of this post is: "How do I find and use object reference > >> memory locations?" > >&

Re: Protecting against callbacks queuing up?

2009-08-25 Thread Hendrik van Rooyen
On Tuesday 25 August 2009 15:21:16 Esben von Buchwald wrote: > Dennis Lee Bieber wrote: > > On Mon, 24 Aug 2009 17:32:23 +0200, Esben von Buchwald > > declaimed the following in > > > > gmane.comp.python.general: > >> I'm new to python, what is an after function and an after call? Couldn't > >> fi

Re: Protecting against callbacks queuing up?

2009-08-25 Thread Hendrik van Rooyen
On Monday 24 August 2009 17:32:23 Esben von Buchwald wrote: > Hendrik van Rooyen wrote: 8< -- some stuff about an "after" call -- > > I'm new to python, what is an after function and an after call? Couldn't > find excact answ

Re: Protecting against callbacks queuing up?

2009-08-24 Thread Hendrik van Rooyen
On Monday 24 August 2009 02:14:24 Esben von Buchwald wrote: > Hello > > I'm using Python for S60 1.9.7 on my Nokia phone. > > I've made a program that gets input from an accelerometer sensor, and > then calculates some stuff and displays the result. > > The sensor framework API does a callback to a

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-24 Thread Hendrik van Rooyen
On Monday 24 August 2009 01:04:37 bartc wrote: > That's a neat idea. But an even simpler scheme might be: > > .octal.100 > .decimal.100 > .hex.100 > .binary.100 > .trinary.100 > > until it gets to this anyway: > > .thiryseximal.100 Yeah right. So now I first have to type a string, which probably

Re: your favorite debugging tool?

2009-08-23 Thread Hendrik van Rooyen
On Saturday 22 August 2009 16:49:22 Aahz wrote: > In article , > > Esmail wrote: > >What is your favorite tool to help you debug your code? I've been > >getting along with 'print' statements but that is getting old and > >somewhat cumbersome. > > Despite the fact that I've been using Python for m

Re: Blank Line at Program Exit

2009-08-23 Thread Hendrik van Rooyen
On Thursday 20 August 2009 07:31:14 Steven Woody wrote: > Hi, > Any python program, even that does absolutely nothing in the code, will > cause a blank line printed out when the program exit. What's the reason? not for me: h...@linuxbox:~/Sasol/lib> cat blank.py h...@linuxbox:~/Sasol/lib> pytho

Re: Object Reference question

2009-08-20 Thread Hendrik van Rooyen
On Friday 21 August 2009 08:07:18 josef wrote: > My main focus of this post is: "How do I find and use object reference > memory locations?" >>> a = [1,2,3,4] >>> id(a) 8347088 >>> - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Parallelization in Python 2.6

2009-08-19 Thread Hendrik van Rooyen
On Wednesday 19 August 2009 10:13:41 Paul Rubin wrote: > Hendrik van Rooyen writes: > > Just use thread then and thread.start_new_thread. > > It just works. > > The GIL doesn't apply to threads made like that?! The GIL does apply - I was talking nonsense again. M

Re: Parallelization in Python 2.6

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 22:45:38 Robert Dailey wrote: > Really, all I'm trying to do is the most trivial type of > parallelization. Take two functions, execute them in parallel. This > type of parallelization is called "embarrassingly parallel", and is > the simplest form. There are no dependenc

Re: Inheriting dictionary

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 21:44:55 Pavel Panchekha wrote: > I want a dictionary that will transparently "inherit" from a parent > dictionary. So, for example: > > """ > a = InheritDict({1: "one", 2: "two", 4: "four"}) > b = InheritDict({3: "three", 4: "foobar"}, inherit_from=a) > > a[1] # "one" > a

Re: Diversity in Python

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 12:38:36 Ben Finney wrote: > Hendrik van Rooyen writes: > > On Tuesday 18 August 2009 06:45:39 Aahz wrote: > > > Mainly an opportunity to flog the new diversity list. > > > > Here my English fails me - flog as in "whip", or flog a

Re: Diversity in Python (was Re: Need cleanup advice for multiline string)

2009-08-18 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 06:45:39 Aahz wrote: > In article , > > Steven D'Aprano wrote: > >The comments were made a week ago -- why the sudden flurry of attention? > > Mainly an opportunity to flog the new diversity list. Here my English fails me - flog as in "whip", or flog as in "sell"? - He

Re: Need cleanup advice for multiline string

2009-08-18 Thread Hendrik van Rooyen
On Monday 17 August 2009 23:06:04 Carl Banks wrote: > On Aug 17, 10:03 am, Jean-Michel Pichavant > > wrote: > > I'm no English native, but I already heard women/men referring to a > > group as "guys", no matter that group gender configuration. It's even > > used for group composed exclusively of w

Re: GUI interface builder for python

2009-08-17 Thread Hendrik van Rooyen
On Monday 17 August 2009 07:59:02 l...@d@n wrote: > Which is the best GUI interface builder with drag and drop > capabilities. > I am using Ubuntu GNU/Linux. > Please help me. > Thank you. Have a look at Boa Constructor. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-17 Thread Hendrik van Rooyen
On Sunday 16 August 2009 15:55:31 Grant Edwards wrote: > On 2009-08-15, Hendrik van Rooyen wrote: > > I am still confused about pyserial and serial - I found serial > > in my distribution library, (on the SuSe machine, not on the > > 2.5 in Slackware) but I had to download

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Hendrik van Rooyen
On Sunday 16 August 2009 12:18:11 Steven D'Aprano wrote: > In any case, after half a century of left-from-right assignment, I think > it's worth the experiment in a teaching language or three to try it the > other way. The closest to this I know of is the family of languages > derived from Apple's

Re: Is it possible to use python to get True Full Duplex on a Serial port? - conclusions

2009-08-16 Thread Hendrik van Rooyen
On Sunday 16 August 2009 08:20:34 John Nagle wrote: > Hendrik van Rooyen wrote: > > On Saturday 15 August 2009 14:40:35 Michael Ströder wrote: > >> Hendrik van Rooyen wrote: > >>> In the past, on this group, I have made statements that said that on > >>&g

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Hendrik van Rooyen
>"Steven D'Aprano" wrote: >Now that I understand what the semantics of cout << "Hello world" are, I >don't have any problem with it either. It is a bit weird, "Hello world" >>> cout would probably be better, but it's hardly the strangest design in >any programming language, and it's probably

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 16:25:03 Grant Edwards wrote: > > Are you using python file operations open/read/write or OS > file-descriptor operations os.open/os.read/os.write? The former - that seems to be the source of my trouble. I have now written a little test that uses serial.Serial and it w

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 14:40:35 Michael Ströder wrote: > Hendrik van Rooyen wrote: > > In the past, on this group, I have made statements that said that on > > Linux, the serial port handling somehow does not allow transmitting and > > receiving at the same time, and n

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 04:03:42 Terry Reedy wrote: > greg wrote: > > You can't read and write with the same stdio file object > > at the same time. Odd things tend to happen if you try. > > I believe the C standard specifies that the behavior of mixed reads and > writes is undefined without int

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 03:25:45 Dr. Phillip M. Feldman wrote: > It seems as though Python is actually expanding range(2,n) into a list of > numbers, even though this is incredibly wasteful of memory. There should be > a looping mechanism that generates the index variable values incrementally >

Re: Why does my ftp script quit after couple of hours?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 18:25:50 kk wrote: > As far as robustness, I agree with your assestment. I guess my main > confusion with my result is that the console window just disappears. I > wonder if I can make the window stay even if it crashesor if there are > connection issues? I will createa s

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 18:11:52 Steven D'Aprano wrote: > On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > > "I saw `cout' being shifted "Hello world" times to the left and stopped > > right there." --Steve Gonedes > > Assuming that's something real, and not invented for humour, I presume > that

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:28:26 Grant Edwards wrote: > On 2009-08-14, greg wrote: > > Hendrik van Rooyen wrote: 8<--- > Doh! It didn't even occur to me that somebody would use python > "file"

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:19:36 Grant Edwards wrote: > On 2009-08-14, exar...@twistedmatrix.com wrote: > > One strategy you might employ to get rid of the busy looping > > is to use Twisted and its serial port support. This also > > addresses the full- duplex issue you've raised. > > There are

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:03:22 Diez B. Roggisch wrote: > You should *really* just use pyserial. No hassle, instant satisfaction. :-) I have downloaded and had a quick look, and I see it is based on the standard library's serial.Serial class - another battery that I have not used before. An

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:19:04 Grant Edwards wrote: > On 2009-08-14, Hendrik van Rooyen wrote: > > In the meantime I have had another idea which I have also not tried yet, > > namely to do independent opens for reading and writing, to give me two > > file instances inste

  1   2   3   4   5   6   7   8   9   >