sys.argv as a list of bytes

2012-01-17 Thread Olive
In Unix the operating system pass argument as a list of C strings. But C strings does corresponds to the bytes notions of Python3. Is it possible to have sys.argv as a list of bytes ? What happens if I pass to a program an argumpent containing funny "character", for example (with a bash shell)? py

Re: thread example question

2012-01-17 Thread Mark Hammond
On 18/01/2012 4:22 PM, Rodrick Brown wrote: import _thread as thread import time class thread_counter(object): def __init__(self, thr_cnt, sleep_int): self.thr_cnt = thr_cnt self.sleep_int = sleep_int def counter(myId, count): for i in range(count): time.sle

thread example question

2012-01-17 Thread Rodrick Brown
Can any idea help me figure out why the following output is sequential? I'm running this example on a 4 core system. I would expect the output to look random. import _thread as thread import time class thread_counter(object): def __init__(self, thr_cnt, sleep_int): self.thr_cnt = thr_

Re: THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON. (e-mail get by the list moderator)

2012-01-17 Thread Rick Johnson
On Jan 16, 12:03 am, "_" wrote: > # THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON: > Worddr = "56" # CREATE A STRING: "56" > Word = ["12"] # CREATE A LIST WITH ONE SIGNED: "12" > Word = Word.append("34") # APPEND TO LIST ONE MORE SIGNED: "34" > Word = Word + "34" # MUST APPEND TO LIST ONE MORE SI

Using python to dynamically divine the contents of a CORBA (omniORB) interface

2012-01-17 Thread Jeff Frontz
I'm trying to write a self-maintaining test tool that can be used from the command line against a server via CORBA (omniORB). To start, I'd be happy with a tool that could describe the interface(s) that the server implements (e.g., essentially regenerating the IDL that defined the interfaces to beg

Re: First python project : Tuner

2012-01-17 Thread Chris Angelico
On Wed, Jan 18, 2012 at 7:38 AM, Rick Johnson wrote: > On Jan 17, 1:38 pm, Ben Finney wrote: >> You have attracted the attention of a troll. > > What is worse: A wolf, or a wolf in sheep's clothing? > > There is no "trolling" in my reply. A nice quip, yes. Trolling, no. Well, as we learn from In

Re: First python project : Tuner

2012-01-17 Thread Rick Johnson
On Jan 17, 1:38 pm, Ben Finney wrote: > Jérôme writes: > > Rick Johnson a écrit: > > > Besides, not everyone in this community is a "card carrying" > > > pacifist. > > ? > You have attracted the attention of a troll. What is worse: A wolf, or a wolf in sheep's clothing? There is no "trolling" i

Re: First python project : Tuner

2012-01-17 Thread Jean-Michel Pichavant
Jérôme wrote: Hi all. Like others before me, I'd like to show you my first python attempt, in the hope in can get advices on how to improve my coding. I started learning python and pyGTK last november. I had had a short experience of GTK with C, but had given up as I lacked time and I found it

Re: First python project : Tuner

2012-01-17 Thread Ben Finney
Jérôme writes: > Anyway, I was trying to bring people's attention to the python program > itself Welcome! You have some replies now, that's good. > Rick Johnson a écrit: > > Besides, not everyone in this community is a "card carrying" > > pacifist. > > ? You have attracted the attention of a

Re: First python project : Tuner

2012-01-17 Thread Jérôme
Tue, 17 Jan 2012 10:16:02 -0800 (PST) gst a écrit: > you have quite lot of such test: > > > if self._index is 0: > > I think it's better to compare with equality against 0 (or other > needed value) ; that is: > > if self._index == 0: Yes, I just saw that thanks to Alex Willmer's e-mail. I use

Re: Finding x is 1, and x is 'foo' comparisons in a code base

2012-01-17 Thread Thomas Heller
Am 17.01.2012 18:10, schrieb Alex Willmer: Hello, I'm looking for a way to find the occurrences of x is y comparisons in an existing code base. Except for a few special cases (e.g. x is [not] None) they're a usually mistakes, the correct test being x == y. However they happen to work most of the

Re: Finding x is 1, and x is 'foo' comparisons in a code base

2012-01-17 Thread MRAB
On 17/01/2012 17:10, Alex Willmer wrote: Hello, I'm looking for a way to find the occurrences of x is y comparisons in an existing code base. Except for a few special cases (e.g. x is [not] None) they're a usually mistakes, the correct test being x == y. However they happen to work most of the t

Re: First python project : Tuner

2012-01-17 Thread gst
On 17 jan, 15:16, Jérôme wrote: > Hi all. > hi, just my 2 cents: you have quite lot of such test: > if self._index is 0: I think it's better to compare with equality against 0 (or other needed value) ; that is: if self._index == 0: otherwise your code looks very nice to me, though I just ha

Finding x is 1, and x is 'foo' comparisons in a code base

2012-01-17 Thread Alex Willmer
Hello, I'm looking for a way to find the occurrences of x is y comparisons in an existing code base. Except for a few special cases (e.g. x is [not] None) they're a usually mistakes, the correct test being x == y. However they happen to work most of the time on CPython (e.g. when y is a small inte

Re: First python project : Tuner

2012-01-17 Thread Jérôme
Tue, 17 Jan 2012 12:28:11 -0500 Rodrick Brown a écrit: > You would get more responses if you used one of those sites that displayed > the code right in the browser. Thanks for the tip. I thought people would rather open it in their own editor. (And I tend to avoid third-party hosting.) Here's a

Re: First python project : Tuner

2012-01-17 Thread Rodrick Brown
You would get more responses if you used one of those sites that displayed the code right in the browser. On Tue, Jan 17, 2012 at 12:26 PM, Jérôme wrote: > Tue, 17 Jan 2012 08:48:13 -0800 (PST) > Rick Johnson a écrit: > > > On Jan 17, 8:16 am, Jérôme wrote: > > > > > Any comment is welcome, be

Re: First python project : Tuner

2012-01-17 Thread Jérôme
Tue, 17 Jan 2012 08:48:13 -0800 (PST) Rick Johnson a écrit: > On Jan 17, 8:16 am, Jérôme wrote: > > > Any comment is welcome, be it about code optimization, coding style, > > pythonification, good practices, or simply program features and usability. > > Step one would be to show a screen shot i

Re: First python project : Tuner

2012-01-17 Thread Rick Johnson
On Jan 17, 8:16 am, Jérôme wrote: > Any comment is welcome, be it about code optimization, coding style, > pythonification, good practices, or simply program features and usability. Step one would be to show a screen shot in both English AND French language. Besides, not everyone in this communi

First python project : Tuner

2012-01-17 Thread Jérôme
Hi all. Like others before me, I'd like to show you my first python attempt, in the hope in can get advices on how to improve my coding. I started learning python and pyGTK last november. I had had a short experience of GTK with C, but had given up as I lacked time and I found it more difficult t

Re: THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON. (e-mail get by the list moderator)

2012-01-17 Thread Sean Wolfe
On Mon, Jan 16, 2012 at 4:01 AM, Steven D'Aprano wrote: > On Mon, 16 Jan 2012 09:03:54 +0300, _ wrote: > >> # THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON: Worddr = "56" # CREATE >> A STRING: "56" Word = ["12"] # CREATE A LIST WITH ONE SIGNED: "12" Word >> = Word.append("34") > ... > > > Do you

Re: python logging filter limitation, looks intentional?

2012-01-17 Thread Vinay Sajip
> From: Chris Withers > How breaking code? Configuration, maybe, but I can't see anyone being upset > that filtering would begin working "the same as everything else". > This just feels like a bug... Well, it means that filters that don't get called now would get called - and that's a change i

Re: python logging filter limitation, looks intentional?

2012-01-17 Thread Chris Withers
On 16/01/2012 23:21, Vinay Sajip wrote: Why is this? There must be some rationale for this rather than what, for me and others I've talked to, would seem more natural, ie: a filter on the root logger would get messages both logged to it and any messages propagated to it from child loggers to