Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 05:43:42PM +, OKB (not okblacke) wrote: > Derek Martin wrote: > > > If Python is to say that objects have values, > > then the object can not *be* the value that it has, because that is a > > paradoxical self-reference. It's an object, not

Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 04:26:54AM -0700, Carl Banks wrote: > On Aug 30, 12:33 am, Derek Martin wrote: > [snip rant] I was not ranting. I was explaining a perspective. > > THAT is why Python's behavior with regard to numerical objects is > > not intuitive, and frankly bi

Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 03:52:36AM -0700, Paul McGuire wrote: > > It is surprising how many times we > > think things are "intuitive" when we really mean they are "familiar". > > Of course, just as I was typing my response, Steve D'Aprano beat me to > the punch. Intuition means "The power or facul

Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 03:42:06AM -0700, Paul McGuire wrote: > Python binds values to names. Always. No, actually, it doesn't. It binds *objects* to names. This distinction is subtle, but important, as it is the crux of why this is confusing to people. If Python is to say that objects have va

Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 10:34:17AM +, Steven D'Aprano wrote: > > He's saying that instead of thinking the integer value of 3 itself being > > the object, he expected Python's object model would behave as though the > > entity m is the object, and that object exists to contain an integer > > val

Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sat, Aug 29, 2009 at 07:03:23PM +, Steven D'Aprano wrote: > On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote: > > > I thought that int as object will stay the same object after += but with > > another integer value. My intuition said me that int object which > > represent integer value should

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 04:40:14PM -0300, Gabriel Genellina wrote: > En Mon, 24 Aug 2009 14:40:24 -0300, Derek Martin > escribió: > > >Why is it so hard for you to accept that intelligent people can > >disagree with you, and that what's right for you might be bad for &g

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 05:03:28PM +, Steven D'Aprano wrote: > On Mon, 24 Aug 2009 11:21:46 -0500, Derek Martin wrote: > > since the old syntax is prevalent both within and without the > > Python community, making the change is, was, and always will be a > > bad id

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 04:47:43PM +, Steven D'Aprano wrote: > Except of course to anyone familiar with mathematics in the last, oh, > five hundred years or so. Mathematics has used a positional system for > numbers for centuries now: leading zeroes have been insignificant, just > like trail

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 08:31:13AM -0700, Carl Banks wrote: > On Aug 24, 6:56 am, Derek Martin wrote: > > I think hard-coding dates is more uncommon than using octal. ;-) > > [It unquestionably is, for me personally.] > > You just don't get it, do you? I think

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 05:22:39PM +0200, Hendrik van Rooyen wrote: > > Assuming I'm right about that, then the use of a leading 0 to > > represent octal actually predates the prevalence of using 0 in dates > > by almost two decades. > > Not quite - at the time I started, punch cards and data ent

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Mon, Aug 24, 2009 at 08:56:48AM -0500, Derek Martin wrote: > On Sun, Aug 23, 2009 at 01:13:32PM +, Matthew Woodcraft wrote: > > A more common case is dates. > > I suppose this is true, but [...] > I tend to also discount this example, because when we write dates &g

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Sun, Aug 23, 2009 at 01:13:32PM +, Matthew Woodcraft wrote: > Dennis Lee Bieber writes: > > About the only place one commonly sees leading zeros on decimal > > numbers, in my experience, is zero-filled COBOL data decks (and since > > classic COBOL stores in BCD anyway... binary (usage i

Re: Annoying octal notation

2009-08-24 Thread Derek Martin
On Sun, Aug 23, 2009 at 06:13:31AM +, Steven D'Aprano wrote: > On Sat, 22 Aug 2009 22:19:01 -0500, Derek Martin wrote: > > On Sat, Aug 22, 2009 at 02:55:51AM +, Steven D'Aprano wrote: > >> And the great thing is that now you get to teach yourself to sto

Re: Annoying octal notation

2009-08-22 Thread Derek Martin
On Fri, Aug 21, 2009 at 04:23:57PM -0700, James Harris wrote: > You misunderstand. I was saying that taking a leading zero as > indicating octal is archaic. Octal itself is fine where appropriate. I don't see that the leading zero is any more archaic than the use of octal itself... Both originate

Re: Annoying octal notation

2009-08-22 Thread Derek Martin
On Sat, Aug 22, 2009 at 02:55:51AM +, Steven D'Aprano wrote: > > I can see how 012 can > > be confusing to new programmers, but at least it's legible, and the > > great thing about humans is that they can be taught (usually). > > And the great thing is that now you get to teach yourself to sto

Re: Annoying octal notation

2009-08-22 Thread Derek Martin
On Sat, Aug 22, 2009 at 10:03:35AM +1000, Ben Finney wrote: > > and the former is virtually indistinguishable from 00012, O0012, or > > many other combinations that someone might accidentally type (or > > intentionally type, having to do this in dozens of other programming > > languages). > > Only

Re: Annoying octal notation

2009-08-21 Thread Derek Martin
On Fri, Aug 21, 2009 at 08:25:45PM +, Benjamin Peterson wrote: > > More than flushing out bugs, it will *cause* them in ubiquity, > > requiring likely terabytes of code to be poured over and fixed. > > 2to3, however, can fix it for you extreme easily. Sure, but that won't stop people who've b

Re: Annoying octal notation

2009-08-21 Thread Derek Martin
John Nagle wrote: > Yes, and making lead zeros an error as suggested in PEP 3127 is a > good idea. It will be interesting to see what bugs that flushes > out. James Harris wrote: > It maybe made sense once but this relic of the past should have been > consigned to the waste bin of history long ag

Re: basic thread question

2009-08-18 Thread Derek Martin
On Tue, Aug 18, 2009 at 03:10:15PM -0500, Derek Martin wrote: > I have some simple threaded code... If I run this > with an arg of 1 (start one thread), it pegs one cpu, as I would > expect. If I run it with an arg of 2 (start 2 threads), it uses both > CPUs, but utilization of both

basic thread question

2009-08-18 Thread Derek Martin
I have some simple threaded code... If I run this with an arg of 1 (start one thread), it pegs one cpu, as I would expect. If I run it with an arg of 2 (start 2 threads), it uses both CPUs, but utilization of both is less than 50%. Can anyone explain why? I do not pretend it's impeccable code

Re: why cannot assign to function call

2009-01-05 Thread Derek Martin
On Mon, Jan 05, 2009 at 01:23:04PM -0500, Steve Holden wrote: > Even if they really are small-minded or stupid I agree this wouldn't be > helpful behavior. But neither would your characterization of Python's > assignment model as "bizarre" (even ignoring that you SHOUTED IT AT US), > and I have yet

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
Forgive my indulgence, I find this rather academic discussion kind of interesting, as it turns out. On Sun, Jan 04, 2009 at 10:55:09PM -0600, Derek Martin wrote: > > You can't argue that one semantic or another is more intuitive > > without offering evidence. > > I think

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sun, Jan 04, 2009 at 09:56:33PM -0600, Grant Edwards wrote: > On 2009-01-05, Derek Martin wrote: > > On Sat, Jan 03, 2009 at 11:38:46AM -0600, Grant Edwards wrote: > >> One presumes that Mr. Martin finds anything different from his > >> first computer language to be

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sun, Jan 04, 2009 at 09:30:20PM -0500, Steve Holden wrote: > > I'm going to go out on a limb and assert that there's NO POSSIBLE WAY > > a student could intuit Python's variable assignment behavior, having > > never been exposed to that same behavior prior. It needs to be > > taught. > > > As

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sat, Jan 03, 2009 at 11:38:46AM -0600, Grant Edwards wrote: > > Or are they also "BIZARRE"!? > > One presumes that Mr. Martin finds anything different from his > first computer language to be BIZARRE. He should try out > Prolog or something genuinely different. One's presumption would be mist

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sat, Jan 03, 2009 at 10:15:51AM +, Marc 'BlackJack' Rintsch wrote: > On Fri, 02 Jan 2009 04:39:15 -0600, Derek Martin wrote: > > > On Tue, Dec 30, 2008 at 02:21:29PM +, John O'Hagan wrote: > > What the Python community often overlooks, when this discuss

Re: why cannot assign to function call

2009-01-02 Thread Derek Martin
On Fri, Jan 02, 2009 at 12:50:44PM -0800, Erik Max Francis wrote: >>> Identity isn't defined on math objects, only on Python objects; there >>> is no notion of 'is' in math. >> >> This is also false, it even has its own operator (which requires >> Unicode to display): ≡ > > That can mean a number

Re: why cannot assign to function call

2009-01-02 Thread Derek Martin
On Fri, Jan 02, 2009 at 09:05:51PM +0100, Bruno Desthuilliers wrote: >> Python seems rather weird, and I think from the frequency >> with which these discussions occur on this list, clearly it *IS* >> difficult for a neophyte Python programmer to understand the >> assignment model. > > Took me abou

Re: why cannot assign to function call

2009-01-02 Thread Derek Martin
On Fri, Jan 02, 2009 at 11:43:30AM -0500, Steve Holden wrote: > Derek Martin wrote: > > What the Python community often overlooks, when this discussion again > > rears its ugly head (as it seems to every other hour or so), is that > > its assignment model is BIZARRE, as

Re: why cannot assign to function call

2009-01-02 Thread Derek Martin
On Tue, Dec 30, 2008 at 02:21:29PM +, John O'Hagan wrote: > Fortunately, unlike the murky world of philosophy, Python (AIUI) > simplifies this question by simply declaring that yes, in the case > of mutable objects, we may say that we are still referring to the > same object although we've chan

Re: why cannot assign to function call

2009-01-02 Thread Derek Martin
On a mostly not related note: On Tue, Dec 30, 2008 at 07:52:26AM -0800, Aaron Brady wrote: > According to some rules, these are ungrammatical sentences, due to > plurality disagreement. Ex: > > The Morning Star is ... > The Evening Star is ... > *The Morning Star and The Evening Star is... > *T

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Derek Martin
On Tue, Nov 18, 2008 at 09:23:30AM +, Steven D'Aprano wrote: > > How I can answer the question, "are the objects a and b the same or > > different"? I can look at every aspect of each object, looking for > > something that is different. > > Well, sure, if you care *that much* about potentially

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Derek Martin
On Sun, Nov 16, 2008 at 09:30:45AM +, Arnaud Delobelle wrote: > [...] > > If you like, you could think of the value of an object as the set of > > all possible values to which the object may evaluate in every possible > > context, given a particular state of the object. > > This definition loo

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Derek Martin
On Sun, Nov 16, 2008 at 08:38:25AM +, Steven D'Aprano wrote: > I believe that the language reference says that objects have an identity, > a type and state, but I'm too lazy too look it up. I'd be happy with that > definition. They do indeed say value, not state. As I said in a different me

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Derek Martin
On Sun, Nov 16, 2008 at 06:06:20AM +, Steven D'Aprano wrote: > >>> * Do all objects have values? (Ignore the Python > >>> docs if necessary.) > >> > >> If one allows null values, I am current thinking yes. > > > > I don't see a difference between a "null value" and not having a value. > [...

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Derek Martin
On Thu, Nov 13, 2008 at 11:58:18AM -0800, [EMAIL PROTECTED] wrote: > I have yet to see any reasonable definition of a Python value in the > Python docs or elsewhere, despite the fact that a value is one of > the three defining characteristics of an object, a central concept > in Python. Why does i

Re: open a shell prompt froma python program

2008-10-30 Thread Derek Martin
On Thu, Oct 30, 2008 at 02:47:48AM -0700, gaurav kashyap wrote: > Simply i want to open a shell prompt from a python program. If this is literally true, then you just need to figure out what command will open a terminal window from the shell prompt. Once you figure that out, it's as simple as: c

Re: open a shell prompt froma python program

2008-10-30 Thread Derek Martin
On Thu, Oct 30, 2008 at 03:53:52AM -0700, gaurav kashyap wrote: > HI, > I am getting the following error: > > konsole: cannot connect to X server > > do i need to install the related files. Maybe, but given that error message, probably not. You would do yourself a great favor by providing a lot

Re: Python suitable for Midi ?

2008-10-28 Thread Derek Martin
On Tue, Oct 28, 2008 at 06:54:57PM +0200, Chuckk Hubbard wrote: > The problem I've run into is that I can't set the audio to a higher > priority than the GUI (Tkinter). If I move the mouse over the app, no > matter what, I get audio dropouts. AFAICT this is the same for all > Python, regardless o

Re: How to examine the inheritance of a class?

2008-10-24 Thread Derek Martin
On Fri, Oct 24, 2008 at 11:59:46AM +1000, James Mills wrote: > On Fri, Oct 24, 2008 at 11:36 AM, John Ladasky <[EMAIL PROTECTED]> wrote: > > etc. The list of subclasses is not fully defined. It is supposed to > > be extensible by the user. > > Developer. NOT User. It's a semantic argument, but

Re: Python equivalent for C module

2008-10-20 Thread Derek Martin
On Mon, Oct 20, 2008 at 10:28:15AM -0700, Gary Herron wrote: > > The other weird behavior was, once I changed the value of DEBUG, > > dprint() started to behave oddly. No matter what I passed as an > > argument (and no matter what I set the value of DEBUG to be), it > > started printing the exact

Re: Python equivalent for C module

2008-10-20 Thread Derek Martin
On Mon, Oct 20, 2008 at 10:43:55PM +, Steven D'Aprano wrote: > All of this is just splitting hairs, Indeed... :) > because you don't really mean Python is making a copy of the name > 'DEBUG', but of the *data* that DEBUG refers to, namely the object > True. Well, as long as we're having se

Re: Python equivalent for C module

2008-10-20 Thread Derek Martin
On Mon, Oct 20, 2008 at 07:29:16PM +0200, Bruno Desthuilliers wrote: > This should have been: > > fprintf(STDERR, "DEBUG: %s", msg); No, it shouldn't have. If I turn on debugging, I want the debug messages to go to stdout, so that they can be captured along with the output (of which there i

Python equivalent for C module

2008-10-20 Thread Derek Martin
I'd like to know if it's possible to code something in Python which would be equivalent to the following C: [Assume bool is typedef'd to int, and TRUE and FALSE are #defined to 1 and 0, respectively] debug.c #include bool DEBUG; void dprint(char *msg) { if (DEBUG){

Re: indentation

2008-10-19 Thread Derek Martin
On Sun, Oct 19, 2008 at 06:05:08PM +, Jorgen Grahn wrote: > Doesn't pretty much everyone use spaces and a four-position indent? I can't speak for everyone, or even "pretty much everyone"... but I know of several people who favor the idea of "indent with tab, align with space." The advantage

Re: Set Environment for java based tools thru python script

2008-10-14 Thread Derek Martin
On Mon, Oct 13, 2008 at 05:07:16PM -0700, [EMAIL PROTECTED] wrote: > I run a Java app with subprocess from Python script. This python > script is called from another Python Wrapper. > > > python = subprocess.Popen(["toolname.sh", "-args", arg1, arg2], > stdout=su

Re: Using subprocess module to launch a shell shell script that itself forks a process

2008-10-09 Thread Derek Martin
On Tue, Oct 07, 2008 at 05:43:41PM -0700, Samuel A. Falvo II wrote: > p = subprocess.Popen( > command, > shell=True, > stdin=subprocess.PIPE, > stdout=subprocess.PIPE, > stderr=subprocess.STDOUT, > close_fds=True > ) > > outputChannel = p

Re: Test if list contains another list

2008-09-29 Thread Derek Martin
On Mon, Sep 29, 2008 at 04:12:13AM -0700, [EMAIL PROTECTED] wrote: > Derek Martin: > >Unless you're doing lots and lots of these in your application,< > > I don't agree. That's library code, so it has to be efficient and > flexible, because it's designed

Re: Test if list contains another list

2008-09-28 Thread Derek Martin
On Fri, Sep 26, 2008 at 01:39:16PM -0700, [EMAIL PROTECTED] wrote: > # building prefix-function > m = 0 > for i in xrange(1, len_sub): > while m > 0 and sub[m] != sub[i]: > m = table[m - 1] > if sub[m] == sub[i]: > m += 1 > table[i] = m >

Re: Test if list contains another list

2008-09-26 Thread Derek Martin
On Thu, Sep 18, 2008 at 03:24:16AM -0700, [EMAIL PROTECTED] wrote: > I looked inside this thread for my query which brought me the > following google search result > "Test if list contains another list - comp.lang.python | Google > Groups" > > But then I was disappointed to see the question asked

test list post

2008-09-26 Thread Derek Martin
Sorry for the noise, my recent posts seem to have been eaten by the list management software, as far as I can tell. Just testing if that's still the case. -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0x81CFE75D pgp611hi0GmSx.pgp Description: PGP signature -- http://mail.python.or

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Derek Martin
On Wed, Sep 03, 2008 at 03:16:00PM -0700, Dennis Lee Bieber wrote: > On Wed, 3 Sep 2008 03:09:18 -0400, Derek Martin <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > struct run { > > int speed; > > direction_type di

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Derek Martin
On Wed, Sep 03, 2008 at 06:40:10AM +, Marc 'BlackJack' Rintsch wrote: > On Tue, 02 Sep 2008 19:54:12 -0400, Derek Martin wrote: > > >> And if they model an action there must be some way to activate the > >> action > > > > That's a reasonab

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Wed, Sep 03, 2008 at 12:20:18AM -0400, Miles wrote: > Derek Martin wrote: > > On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: > >> but the instances of `Popen` are no actions. There's no way to > >> "execute" a `Pop

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Wed, Sep 03, 2008 at 12:20:18AM -0400, Miles wrote: > Derek Martin wrote: > > On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: > >> but the instances of `Popen` are no actions. There's no way to > >> "execute" a `Pop

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: > On Tue, 02 Sep 2008 18:15:07 -0400, Derek Martin wrote: > > >> Classes represent "things", and class names should be nouns. > > > > Is that a law? > > It's a com

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 05:22:51PM -0300, Gabriel Genellina wrote: > > The name popen is an abbreviation of "pipe open" -- the function, and > > the class, open pipes to communicate with another process. What you > > said is correct; however there are numerous other ways to open > > subprocesses.

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 06:47:39PM +, Marc 'BlackJack' Rintsch wrote: > That's why I think the name `Popen` is not so good for it. Because it > does more than `popen()` and if it is called `Subprocess` or just > `Process` then it would be merely an implementation detail, that the > `popen()

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 01:57:26PM +, Marc 'BlackJack' Rintsch wrote: > > I would argue that they don't represent processes at all; the object is > > a set of files which connect the standard I/O streams of a subprocess to > > its parent, and methods to operate on those files. > > And the proc

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 12:27:49PM +, Marc 'BlackJack' Rintsch wrote: > > The Python class is a generalization of the standard Posix function of > > (almost) the same name: > > http://opengroup.org/onlinepubs/007908775/xsh/popen.html > > So it's a name of a *function* and it's a little bit uns

Re: Processes in Linux from Python

2008-09-01 Thread Derek Martin
On Mon, Sep 01, 2008 at 08:40:42AM +0200, Diez B. Roggisch wrote: > Johny schrieb: > >To get a number of the http processes running on my Linux( Debia box) > >I use > >ps -ef | grep "[h]ttpd" | wc -l [...] > The shell does the exact same thing. And by the way: i think you miss a > > grep -v grep

Re: How to delete a last character from a string

2008-08-29 Thread Derek Martin
On Fri, Aug 29, 2008 at 07:37:50PM +, Steven D'Aprano wrote: > On Fri, 29 Aug 2008 14:46:53 -0400, Derek Martin wrote: > > > On Fri, Aug 29, 2008 at 07:28:40PM +0100, [EMAIL PROTECTED] wrote: > >> dirListFinal = [] > >> for item in dirList: > >&

Re: How to delete a last character from a string

2008-08-29 Thread Derek Martin
On Fri, Aug 29, 2008 at 07:28:40PM +0100, [EMAIL PROTECTED] wrote: > dirListFinal = [] > for item in dirList: >print item >if item.endswith('\\') == True: if item[-1] == '\\': -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0x81CFE75D pgp5fVWPp4A

Re: Setting my Locale

2008-08-27 Thread Derek Martin
On Wed, Aug 27, 2008 at 01:25:49AM -0300, Gabriel Genellina wrote: > En Tue, 26 Aug 2008 07:52:21 -0300, Robert Rawlins > >How can I get a list of available locales? > > I'd like to know how to retrieve that too... On a Linux system (and likely most modern Unix systems): locale -a -- Derek D

Re: programming toolbox

2008-08-22 Thread Derek Martin
On Fri, Aug 22, 2008 at 08:17:27AM -0500, William Purcell wrote: > I am still wondering if C++ would be worth learning and I think it could be > answered by these three questions... > > 1. Are programs written in C++ better (in any form of the word) than > programs written in python or vise versa

Re: Having trouble with tail -f standard input

2008-08-21 Thread Derek Martin
On Thu, Aug 21, 2008 at 02:58:24PM -0700, sab wrote: > I have been working on a python script to parse a continuously growing > log file on a UNIX server. If you weren't aware, there are already a plethora of tools which do this... You might save yourself the trouble by just using one of those.

Re: python custom command interpreter?

2008-08-21 Thread Derek Martin
On Thu, Aug 21, 2008 at 05:17:41AM +, Marc 'BlackJack' Rintsch wrote: > On Wed, 20 Aug 2008 18:46:42 -0400, Derek Martin wrote: > > > How so? What could be easier than "rm -rf directory"? > > C:\>rm -rf directory Yeah, except the application spe

Re: Negative integers

2008-08-20 Thread Derek Martin
On Wed, Aug 20, 2008 at 02:38:11PM -0700, johnewing wrote: > I am trying to figure out how to test if two numbers are of the same > sign (both positive or both negative). I have tried > > abs(x) / x == abs(y) / y Zero is a problem, no matter how you slice it. Zero can be considered positive or

Re: python custom command interpreter?

2008-08-20 Thread Derek Martin
On Wed, Aug 20, 2008 at 03:19:19PM -0400, joey boggs wrote: > In the end I'd like to be able to run a custom interpreter and just feed it > one command and a directory. The end result in the kickstart something like > this: > > %post --interpreter #!/usr/bin/myinterpreter > DROP /tmp/directory > D

Re: sending to an xterm

2008-08-08 Thread Derek Martin
On Fri, Aug 08, 2008 at 08:25:19PM +, Kent Tenney wrote: > Howdy, > > I want to open an xterm, send it a command and have it execute it. You can't do that. xterm doesn't execute shell commands passed on stdin... It can, however, execute one passed on the command line. Instead of just runni

Re: Change PC to Win or Windows

2008-08-02 Thread Derek Martin
On Tue, Jul 22, 2008 at 08:19:05PM +0700, Lie Ryan wrote: > But until the dictionary is rewritten, it is incorrect usage. That's complete nonsense, much like the rest of your argument. People use words all the time that aren't even IN a dictionary. Their absence from any dictionary makes them n

Terminology (Re: Strong/weak typing)

2008-08-02 Thread Derek Martin
On Fri, Aug 01, 2008 at 03:57:10PM +, Alan Franzoni wrote: > [EMAIL PROTECTED] was kind enough to say: > > > I'm writing Python as if it were strongly typed, never recycling a > > name to hold a type other than the original type. [...] > Python *is* strongly typed. That's debatable. It depen

Re: Attack a sacred Python Cow

2008-07-27 Thread Derek Martin
On Sun, Jul 27, 2008 at 09:39:26PM +0200, Bruno Desthuilliers wrote: > >As for the latter part of #3, self (or some other variable) is > >required in the parameter list of object methods, > > It's actually the parameter list of the *function* that is used as the > implementation of a method. Not

Re: Attack a sacred Python Cow

2008-07-27 Thread Derek Martin
On Sun, Jul 27, 2008 at 08:19:17AM +, Steven D'Aprano wrote: > > You take the name down to a single letter. As I suggested in an earlier > > post on this thread, why not take it down to zero letters? > > The question isn't "why not", but "why". The status quo works well as it > is, even if i

Re: Attack a sacred Python Cow

2008-07-27 Thread Derek Martin
On Sun, Jul 27, 2008 at 08:13:53AM +, Steven D'Aprano wrote: > On Sun, 27 Jul 2008 10:23:06 +0800, Marcus.CM wrote: > > > Well after reading some of these posts on "sacred python cow" on the > > "self" , i would generally feel that most programmers who started with > > C++/Java would find it o

Re: Attack a sacred Python Cow

2008-07-27 Thread Derek Martin
On Sat, Jul 26, 2008 at 12:06:05AM -0400, Terry Reedy wrote: > There is no requirement to have 'self' in the parameter list. But there is a requirement to have *something* which refers to the object instance. Why can't this be implicit with a keyword defined in python to refer to it? > So the

Re: Change PC to Win or Windows

2008-07-22 Thread Derek Martin
On Mon, Jul 21, 2008 at 02:47:31PM -0700, Lie wrote: > Common usage isn't always correct. Actually it is, inherently... When usage becomes common, the language becomes redefined, and its correctness is therefore true by identity (to borrow a mathematical term). The scholars complain for a while

Re: Change PC to Win or Windows

2008-07-21 Thread Derek Martin
On Mon, Jul 21, 2008 at 12:32:00PM -0700, Lie wrote: > > The term "PC" is commonly used in English, in the United States > > and other English speaking countries, to mean a computer running > > Microsoft Windows. > > As far as I am aware, they're like that because most people aren't > even aware t

Re: Change PC to Win or Windows

2008-07-21 Thread Derek Martin
On Sat, Jul 19, 2008 at 02:56:07AM -0700, Lie wrote: > government, etc. IBM PC is one of the first computers that ordinary > people could possess, when IBM-clones appeared on the market, they're > referred as PCs too because they are Personal Computer, a computer > that is designed for personal use

Re: Change PC to Win or Windows

2008-07-21 Thread Derek Martin
On Sat, Jul 19, 2008 at 02:56:07AM -0700, Lie wrote: > On Jul 19, 6:14 am, Derek Martin <[EMAIL PROTECTED]> wrote: > > On Fri, Jul 18, 2008 at 03:46:13PM -0700, Joel Teichroeb wrote: > > Much like the English word "bank" (and numerous others), the term "PC&qu

Re: Change PC to Win or Windows

2008-07-21 Thread Derek Martin
On Fri, Jul 18, 2008 at 10:34:41PM -0700, Dennis Lee Bieber wrote: > On Fri, 18 Jul 2008 19:14:43 -0400, Derek Martin <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > On Fri, Jul 18, 2008 at 03:46:13PM -0700, Joel Teichroeb wrote: > > >

Re: Change PC to Win or Windows

2008-07-18 Thread Derek Martin
On Fri, Jul 18, 2008 at 03:46:13PM -0700, Joel Teichroeb wrote: > Calling Windows PC seems to be something that Apple did so they would > not have to directly mention Windows. Actually it's something IBM did when they created the IBM PC. Of course, all IBM PCs ran MS-DOS, since that's how IBM s

Re: Multiple variable control in for loops. Doable in Python?

2008-07-18 Thread Derek Martin
On Fri, Jul 18, 2008 at 05:28:32PM -0400, Derek Martin wrote: > def control(i, j): > print i,j > if not (i < 5 or j < 10): Rather, if not (i < 5 and j < 10): > return > else: > control(some_increment_function(i), other_incre

Re: Multiple variable control in for loops. Doable in Python?

2008-07-18 Thread Derek Martin
On Fri, Jul 18, 2008 at 12:21:49PM -0700, mark floyd wrote: > I'm new to Python and have been doing work converting a few apps > from Perl to Python. I can not figure out the comparable Python > structures for multi-variable for loop control. [...] > I spent a good part of yesterday looking for a

Re: Using Python To Launch Python

2008-07-14 Thread Derek Martin
On Mon, Jul 14, 2008 at 05:40:43PM -0400, Aquil H. Abdullah wrote: > You've hit the proverbial nail with the hammer. The problem is that my > application needs to run under both the Linux and Windows OSs, so while I > would love to use a nice sh, csh, or bash shell script. My hands are tied > beca

Re: Using Python To Launch Python

2008-07-14 Thread Derek Martin
On Mon, Jul 14, 2008 at 02:01:04PM -0700, aha wrote: > Since my application has it's own version of Python installed with > it how should I use the system Python to launch the version of > Python that launches my Application. Yes, this is a convoluted > process, but not all Pythons are built the s

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Derek Martin
Yaieee! On Wed, Jun 18, 2008 at 01:32:28AM -0400, Terry Reedy wrote: > > >Saying a flat "no" alone, without qualifying your statement is > > >generally interpreted as rude in English... > As a very much native English speaker I disagree that 'No' is > necessarily rude. I never said it was n

Re: Does '!=' equivelent to 'is not'

2008-06-17 Thread Derek Martin
On Tue, Jun 17, 2008 at 04:33:03AM -0300, Gabriel Genellina wrote: > > Basically 'a is b' and 'not(a is b)' is similar to 'id(a) == id(b)' > > and 'not(id(a) == id(b))' > > No. Sure it is... he said "similar"... not identical. They are not the same, but they are similar. Saying a flat "no" al

Re: python confusion possibly related to pickle

2008-05-18 Thread Derek Martin
On Sun, May 18, 2008 at 08:28:34PM +0100, Dennis wrote: > The problem that's got me annoyed is that after getting said error I > close the shell window, open a new one, run the python interpreter > and type "import pickle" and get the error that the script I'd run > earlier caused. Why is this ? W

Re: RegEx for matching brackets

2008-05-02 Thread Derek Martin
On Fri, May 02, 2008 at 03:51:16PM -0700, NevilleDNZ wrote: > Thanx for the link to these parsers. ANTLR looks interesting. > Yoyo: http://www-users.cs.york.ac.uk/~fisher/software/yoyovwg/readme > > I figured out a way to do it in python. [...] > > def check_open_close(str): > try: > eval("

Re: Manipulate Large Binary Files

2008-04-03 Thread Derek Martin
On Thu, Apr 03, 2008 at 02:36:02PM -0400, Derek Tracy wrote: > I am running it on a RAID(stiped raid 5 using fibre channel), but I > was expecting better performance. Don't forget that you're reading from and writing to the same spindles. Writes are slower on RAID 5, and you have to read the da

Re: Manipulate Large Binary Files

2008-04-02 Thread Derek Martin
On Wed, Apr 02, 2008 at 02:09:45PM -0400, Derek Tracy wrote: > Both are clocking in at the same time (1m 5sec for 2.6Gb), are there > any ways I can optimize either solution? Buy faster disks? How long do you expect it to take? At 65s, you're already reading/writing 2.6GB at a sustained transf

Re: Manipulate Large Binary Files

2008-04-02 Thread Derek Martin
On Wed, Apr 02, 2008 at 10:59:57AM -0400, Derek Tracy wrote: > I generated code that works wonderfully for files under 2Gb in size > but the majority of the files I am dealing with are over the 2Gb > limit > > ary = array.array('H', INPUT.read()) You're trying to read the file all at once. You n

Re: Python 2.2.1 and select()

2008-03-26 Thread Derek Martin
On Wed, Mar 26, 2008 at 07:11:15PM -0700, Noah Spurrier wrote: > >def set_nonblock(fd): > > flags = fcntl.fcntl(fd, fcntl.F_GETFL) > > fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) > > > >Then in the function, after calling popen: > > set_nonblock(io.fromchild.fileno()) > >

Re: Python 2.2.1 and select()

2008-03-26 Thread Derek Martin
On Wed, Mar 26, 2008 at 09:49:51AM -0700, Noah Spurrier wrote: > On 2008-03-24 22:03-0400, Derek Martin wrote: > >That's an interesting thought, but I guess I'd need you to elaborate > >on how the buffering mode would affect the operation of select(). I > >really

Re: Python 2.2.1 and select()

2008-03-24 Thread Derek Martin
On Mon, Mar 24, 2008 at 05:52:54PM -0700, Noah wrote: > On Mar 24, 2:58 pm, Derek Martin <[EMAIL PROTECTED]> wrote: > > If and only if the total amount of output is greater than the > > specified buffer size, then reading on this file hangs indefinitely. > I think this

Python 2.2.1 and select()

2008-03-24 Thread Derek Martin
Hi kids! I've got some code that uses select.select() to capture all the output of a subprocess (both stdout and stderr, see below). This code works as expected on a variety of Fedora systems running Python > 2.4.0, but on a Debian Sarge system running Python 2.2.1 it's a no-go. I'm thinking thi