Re: [RFC] Parametric Polymorphism

2005-09-26 Thread Donn Cave
ter may in fact be the more ideal usage? This isn't hypothetical either. Your example is a fine one, and some kind of table to resolve the function according to type of input argument is a good idea. I'm just saying that more general application of this idea is best left to languages li

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Donn Cave
ely enough to be very interesting. In the functional language approach I'm familiar with, you introduce a variable into a scope with a bind - let a = expr in ... do something with a and initialization is part of the package. Type is usually inferred. The kicker though is that the variab

Re: "no variable or argument declarations are necessary."

2005-10-04 Thread Donn Cave
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Bengt Richter) wrote: > On Tue, 04 Oct 2005 10:18:24 -0700, Donn Cave <[EMAIL PROTECTED]> wrote: > [...] > >In the functional language approach I'm familiar with, you > >introduce a variable into a scope with

Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Donn Cave
_the_ definition. The word is used in such broad and vague ways that to use it is practically a sign of sloppy thinking. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: new forum -- homework help/chit chat/easy communication

2005-10-09 Thread Donn Cave
an be performed | automatically. I don't think the shell is any exception - I think it's reasonable to see it as a control+UI language embedded in the UNIX operating system. It wouldn't really be a very useful stand-alone application on a computer platform without the same basic prope

Re: Python's Performance

2005-10-09 Thread Donn Cave
hon runtime doesn't even look at the source code. Fair to say that byte code is interpreted? Seems to require an application we commonly call an interpreter. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-10 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > Donn Cave wrote: > > > | > Except it is interpreted. > > | > > | except that it isn't. Python source code is compiled to byte code, which > > | is then exec

Re: subprocess and non-blocking IO (again)

2005-10-10 Thread Donn Cave
oesn't have pty functionality. It's hard to say for sure who said what in that page, after the incredible mess Google has made of their USENET archives, but I believe that's why you see dup2 there - the author is using a pty library, evidently pexpect. As far as I know, things have not moved on in this respect, not sure what kind of movement you expected to see in the intervening month. I don't think you need ptys, though, so I wouldn't worry about it. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-10 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: > Donn Cave <[EMAIL PROTECTED]> writes: > > I agree that there are many shades of grey here, but there's also a > > real black that's sharply distinct and easy to find -- real n

Re: tuple versus list

2005-10-17 Thread Donn Cave
re, as opposed to the way we are typically more interested in positional access to a tuple. Maybe a more computer literate reader will have a better word for this, that doesn't collide with Python terminology. My semi-formal operational definition is "a is similar to a[x:

Re: Writing an immutable object in python

2005-10-17 Thread Donn Cave
erve the same pattern with respect to object identities. Mutability doesn't really play any role here. > Is there a way to bypass it (or perhaps to write a self-defined > immutable object)? Bypass what? What do you need? Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Run process with timeout

2005-10-17 Thread Donn Cave
this. (Interesting that it's a function parameter, not a method to be overridden by a subclass.) Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: KeyboardInterrupt vs extension written in C

2005-10-20 Thread Donn Cave
peek into Python for this, I'm wondering if your module could set its own signal handler for SIGINT, which would set a library flag. Then call PyErr_SetInterrupt(), to emulate the normal signal handler. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Read/Write from/to a process

2005-10-25 Thread Donn Cave
e for all I know it may have evolved in this respect.) The pipe-like VMS device was called a "mailbox", and the interesting feature was that you could be notified when a read had been queued on the device. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: popen2

2005-10-29 Thread Donn Cave
open Hello, it seems fairly clear that the stdin/stdout in question belongs to another process, which cannot be instructed at this point to execute freopen(). If there's a way to do this, it will be peculiar to the platform and almost certainly not worth the effort. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Rich __repr__

2005-11-02 Thread Donn Cave
_name__, id(self), special) def __repr__(self): return self.make_repr(repr(self.my_favorite_things)) This omits the module qualifier for the class name, but arguably that's a bit of a nuisance anyway. If there's a best, common practice way to do it, I wouldn't care to pose as an expert in such things, so you have to decide for yourself. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Class Variable Access and Assignment

2005-11-03 Thread Donn Cave
2] > > I can understand that Guido was a bit reluctant to introduce > += etc into Python, and it's important to understand that they > typically behave differently for immutable and mutable objects. As far as I know, Guido has never added a feature reluctantly. He can take full

Re: O_DIRECT on stdin?

2005-11-07 Thread Donn Cave
din.read() or > os.read() to reliably use a buffer that fits the alignment restriction. Though of course os.read() would eliminate one layer of buffering altogether. Might be worth a try. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-09 Thread Donn Cave
, the ability to store some state. This is of course useful in situations where we want to propagate state changes, so it naturally comes up in this context, but language per se does not observe any distinction here so far as I know. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-10 Thread Donn Cave
vague or even wrong statement about its relationship to the issue. It has been going on for years, usually I believe from people who understand quite well how it really works. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: running functions

2005-11-17 Thread Donn Cave
ppened to me. As I said, I thought their design was good, but maybe they just didn't get the word out like they should have - that threads are scary. Donn Cave, [EMAIL PROTECTED] (posting this from a Python/BeOS API newsreader) -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding through recursion

2005-11-18 Thread Donn Cave
sure. State variables are analogous to goto in a way, similar sort of spaghetti potential. It may or may not help to have all the strands come out at the same spot, if the route to that spot could be complicated. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: ownership problem?

2005-11-21 Thread Donn Cave
for over a decade, wonder if it had any influence on your C++ zeitgeist? Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.4.2 on AIX 4.3 make fails on threading

2005-11-22 Thread Donn Cave
5 In earlier compilers, and I think this one too, "cc_r" (instead of "xlc") gives you the thread options and libraries. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: pipe related question

2005-11-23 Thread Donn Cave
cation on VMS?) The only thing I can think of is a select() with timeout, with some compromise value that will allow most outputs to complete without stalling longer than is really convenient. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: exception KeyboardInterrupt and os.system command

2005-11-28 Thread Donn Cave
m posed in the original post. But it might be just as well to watch the process status for any non-zero value, and then call the graceful exit procedure. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: python speed

2005-11-30 Thread Donn Cave
still the most efficient library of functions for their purpose for use in supercomputing applications. Apparently hand-optimized assembler for specific processors. http://seattlepi.nwsource.com/business/250070_goto29.html (actually from the NY Times, apparently) Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-11-30 Thread Donn Cave
two similar things interchangeable. So we're happy to see that tuple does not have the features it doesn't need, because it helps in a small way to make Python code better. If only by giving us a chance to have this little chat once in a while. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-12-01 Thread Donn Cave
with something a lot like StructSequence. Meanwhile losing a significant overhead. I wrote a quickie Python API to SequenceStruct and used it to make an (x, y) coord type, to compare with a Coord.x,y class. A list of a million coords used 1/5 space, and took 1/10 the time to create. Hm. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-12-01 Thread Donn Cave
thout necessarily supporting the effort. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-12-01 Thread Donn Cave
ity and purity. Maybe it's more like tuples have a primary intended purpose, and some support for other applications. Not white, but not pure black either. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-12-01 Thread Donn Cave
have some interesting historical perspectives there, but not much of a historical issue, I'd say, without much going on in the way of a user community. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Donn Cave
a #! or not. csh (the shell language that doesn't look anything like C, Bill Joy's attempt at language design before he started over with Java) does that only if the first line is "#"; otherwise it invokes the Bourne shell. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-12-02 Thread Donn Cave
Quoth Mike Meyer <[EMAIL PROTECTED]>: | Donn Cave <[EMAIL PROTECTED]> writes: ... |> For me, conceptually, if an object can't be accessed |> sequentially, then it can't be mapped to a sequence. | | So you're saying that for should implicitly invoke list (or mayb

Re: spawnle & umask

2005-12-08 Thread Donn Cave
part of the published API for os.py, so it would be unseemly to complain if it were to change in later versions. So I guess the right thing to do is write your own spawn function from the ground up. But at least you have some ideas there about how it might work. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: The Industry choice

2005-01-01 Thread Donn Cave
ly where you actually have complete coverage from unit testing, which not everyone can claim and I'm sure even fewer really have. And like the man said, you're doing that work to find a lot of things that the compiler could have found for you. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: The Industry choice

2005-01-01 Thread Donn Cave
ically typed polymorphism. It seems to me they are kind of at odds with static type analysis, especially if you want type inference -- kind of a type laundering system, where you can't tell what was supposed to be there by looking at the code. Some alternatives would be needed, I

Re: The Industry choice

2005-01-02 Thread Donn Cave
Quoth Paul Rubin <http://[EMAIL PROTECTED]>: | "Donn Cave" <[EMAIL PROTECTED]> writes: |> Yes, it would be really weird if Python went that way, and the |> sort of idle speculations we were reading recently from Guido |> sure sounded like he knows better. But it&

Re: Securing a future for anonymous functions in Python

2005-01-07 Thread Donn Cave
ipped from Haskell, that would be an atrocity. It may not be essential, but it's eminently useful and natural. Is it useful and natural in Python? Is it worth breaking code over? Why do we even bother to discuss this here? There aren't good answers to those questions. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-07 Thread Donn Cave
on't by any means agree that this notation is worth adopting, and in general I think this kind of readability issue is more or less a lost cause for a language with Python's scoping rules, but the motive makes sense to me. One way to look at it might be, if I observe that "wo

Re: "A Fundamental Turn Toward Concurrency in Software"

2005-01-08 Thread Donn Cave
sonally I wouldn't care to predict anything here. For all I know, someday we may decide that we need cooler and more efficient computers more than we need faster ones. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: accessing the result of 'if'

2005-01-08 Thread Donn Cave
e left hand side of the where clause. What you're trying to do here seems to have almost nothing to do with that. If Python 3 is going to get assignment-as-expression, it will be because GvR accepts that as a reasonable idea. You won't bootleg it in by trying to hide it behind this "where" notion, and you're not doing "where" any good in trying to twist it this way either. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Securing a future for anonymous functions in Python

2005-01-11 Thread Donn Cave
her. :) I'm with him. List incomprehensions do not parse well in my eyes. I am reduced to guessing what they mean by a kind of process of elimination. map is simply a function, so it doesn't pose any extra reading problem, and while lambda is awkward it isn't syntactically a

Re: Securing a future for anonymous functions in Python

2005-01-12 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Jacek Generowicz <[EMAIL PROTECTED]> wrote: > Donn Cave <[EMAIL PROTECTED]> writes: > > > List incomprehensions do not parse well in my eyes. > > Are you familiar with the Haskell syntax for list comprehensions? > > Fo

Re: spawn syntax + os.P_WAIT mode behavior + spawn stdout redirection

2005-01-20 Thread Donn Cave
d spawn call in test.py I do not get any output to | /tmp/test.out and it also returns immediatly. Can anyone tell me why? Might be a problem finding 'sh', since in this case you call spawnl(), not spawnlp(). Just a guess. Also you ought to know that the return from os.spawnl(os.P_WAIT, ...) will not be a pid, rather a status that carries a little (very little) information about the problem. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: debugging os.spawn*() calls

2005-02-03 Thread Donn Cave
t close the pipe. The parent could then read the pipe, even for a NOWAIT case like this, and possibly contrive to re-raise the fork's exception if one showed up. This would account for the class of errors that occurs between the fork and the exec. The _spawnvef I'm looking at doesn't account for these very well - 127 covers a lot of ground, and there wouldn't be much in the way of error output. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: managing multiple subprocesses

2005-02-03 Thread Donn Cave
doubt there are situations where a path lookup is essential, but it just hasn't been happening to me. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding deadlocks in concurrent programming

2005-06-23 Thread Donn Cave
r. Rigorous application of the model can be a little awkward, though, if you're trying to adapt it to a basically procedural application. The original Stackless Python implementation had some interesting options along those lines. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble subclassing str

2005-06-23 Thread Donn Cave
t unexplained is ``true "is-a" relationships''. Sounds like an implicit contradiction -- you can't implement something that truly is something else. Without that, and maybe a more nuanced replacement for "is-implemented-using-a", I don't see how you could really be sure of the point. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble subclassing str

2005-06-24 Thread Donn Cave
s your "is-a" test? What is-a dictionary, or is-not-a dictionary? If you ask me, there isn't any obvious principle, it's just a question of how we arrive at a sound implementation -- and that almost always militates against inheritance, because of liabilities you mentioned els

Re: trouble subclassing str

2005-06-24 Thread Donn Cave
a lot like Rectangle, it still has a couple of differences, and the difference could be a problem in some contexts designed for Rectangle - but no one can fix that. If you need Square, you'll implement it, and whether you choose to inherit from Rectangle is left as a matter of implementation

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Donn Cave
really attractive FP language, maybe out of the "links" initiative by Wadler et al. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Polling, Fifos, and Linux

2005-07-08 Thread Donn Cave
ry about the first one, since if data could be lost in this way it would be much more complicated to close a file descriptor without running this risk. But I don't see the second one as much of a problem either. The writer blocks - so? Now, what would really be useful is a way for the writer to detect whether open will block, and potentially time out. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

PPC floating equality vs. byte compilation

2005-07-08 Thread Donn Cave
hut them out of the hardware internals. They use a Metrowerks PPC compiler that of course hasn't seen much development in the last 6 years, probably a lot longer. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Defending Python

2005-07-09 Thread Donn Cave
the nearest equivalent thing in their own familiar context. Say good things about language X, and people will hear you saying "give up using language Y and rewrite everything in language X." Then they will conclude that if you would say that, you don't know very much about their e

Re: Reading variables from a forked child (Python C/API)

2005-07-15 Thread Donn Cave
r temporary files or something. You probably don't need to call Python from C, may as well just invoke python (cf. os.spawnv) Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Need to interrupt to check for mouse movement

2005-07-20 Thread Donn Cave
et, provided along with a callback function by the application. Am I hearing that wxWindows or other popular toolkits don't provide any such feature, and need multiple threads for this reason? Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Something that Perl can do that Python can't?

2005-07-22 Thread Donn Cave
he problem is with the (Python) program on the other end - it's buffering output, because the output device is not a terminal. Donn Cave, [EMAIL PROTECTED] > Here is the child process script (bufcallee.py): > import time > print 'START' > time.sleep(10) &

Re: socket and os.system

2005-08-05 Thread Donn Cave
quot;use the subprocess module." If that's not helpful, either because it doesn't provide any feature that allows you to close a descriptor in a fork (I seem to recall it does), or it isn't supported in your version of Python (< 2.4), then you have your choice of two slightly a

Re: Fat and happy Pythonistas (was Re: Replacement for keyword 'global' good idea? ...)

2005-08-06 Thread Donn Cave
outside of North America, citing failure to penetrate the "enterprise" market as a reason. Ask the enterprise world if they think Python is changing fast enough. Maybe they're giving up on Python because they decided they'd never get code blocks. (Ha ha.) Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Decline and fall of scripting languages ?

2005-08-07 Thread Donn Cave
concepts you need most e.g. concurrency: | | http://cml.cs.uchicago.edu/ My vote would be Haskell first, then other functional languages. Learning FP with Objective CAML is like learning to swim in a wading pool -- you won't drown, but there's a good chance you won't really learn to swim either. H

Re: Decline and fall of scripting languages ?

2005-08-08 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > "Donn Cave" <[EMAIL PROTECTED]> writes: > > My vote would be Haskell first, then other functional languages. > > Learning FP with Objective CAML is like learning to swim i

Re: Decline and fall of scripting languages ?

2005-08-08 Thread Donn Cave
m even (gasp) thinking of checking out Ada. It's up to you, I'm just saying. Speaking of C++, would you start someone with Python or Java for their first OOPL? Kind of the same idea. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Decline and fall of scripting languages ?

2005-08-08 Thread Donn Cave
;s global lock, instead of locks around each memory management function etc. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Decline and fall of scripting languages ?

2005-08-09 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Michael Hudson <[EMAIL PROTECTED]> wrote: > Donn Cave <[EMAIL PROTECTED]> writes: > > > On the contrary, there are a couple. Ghc is probably the > > leading implementation these days, and by any reasonable > > measure

Re: Bug on Python2.3.4 [FreeBSD]?

2005-08-12 Thread Donn Cave
e (period.) They claim conformance with the ISO C90 standard. I couldn't dig up a (free) copy of that document, so don't know what it says on this matter. GNU C man pages say it positions the stream at end for write and at beginning for read. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug on Python2.3.4 [FreeBSD]?

2005-08-12 Thread Donn Cave
Quoth "Terry Reedy" <[EMAIL PROTECTED]>: | "Donn Cave" <[EMAIL PROTECTED]> wrote in message | news:[EMAIL PROTECTED] | > I don't think Python pretends to have any intentions here, | > it has to take what it gets from the C library fopen(3) | > funct

Re: Bug on Python2.3.4 [FreeBSD]?

2005-08-15 Thread Donn Cave
. Along with already documented FreeBSD, I find MacOS X, NetBSD 2 and Ultrix 4.2 position the read stream to EOF. Linux, AIX and DEC/OSF1 (or whatever it's called these days) position it to 0. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: while c = f.read(1)

2005-08-18 Thread Donn Cave
ly needed. You are no doubt wondering when I'm going to get to the part where you can exploit this to save you those 3 lines of code. Sorry, it won't help with that. | Is this related to Python's expression vs. statement syntactic | separation? How can I be write this code more nic

Re: while c = f.read(1)

2005-08-19 Thread Donn Cave
Sure, if your function's type is "None | int", then certainly you must explicitly check for None. That is not the case with fileobject read(), nor with many functions in Python that reasonably and ideally return a value of a type that may meaningfully test false. In this cas

Re: global interpreter lock

2005-08-19 Thread Donn Cave
's interpreter provides a cheap and moderately effective support that compensates for most programmers' unrealistic assessment of their skill and discipline. Not that you can't go wrong, but the chances you'll get nailed for it are greatly reduced - especially in an SMP environment. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: global interpreter lock

2005-08-20 Thread Donn Cave
mply whether or how Python could support SMP. Mike, care to mention an example or two of the better models you had in mind there? Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: global interpreter lock

2005-08-20 Thread Donn Cave
uot;Timber" with some added support for time as an event source. The most on topic thing about it -- its author implemented a robot controller in Timber, and the robot is a little 4-wheeler called ... "Timbot". Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: while c = f.read(1)

2005-08-22 Thread Donn Cave
't go anywhere, but she goes on to write a well articulated case that makes very interesting reading, and possibly has had some effect on how people think about it around here. http://groups-beta.google.com/group/comp.lang.python/msg/2de5e1c8384c0360 Donn Cave, [EMAIL PROTECTED

Re: pipes like perl

2005-08-24 Thread Donn Cave
ot a shell command. The basic problem is that you have to fork first, then exec, and by the time the forked interpreter finds out that the exec didn't work, its parent has gone on to do the I/O it's expecting. I think subprocess gets around that, on UNIX, with a trick involving an extra p

Re: named pipe input

2005-09-01 Thread Donn Cave
adline() instead (in a loop, of course, I think you'll get the data one line at a time, but "in file" apparently reads the whole file first. That's what I vaguely remember, I don't use it myself. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Find day of week from month and year

2005-09-02 Thread Donn Cave
What do you mean by, "the 9 element tuple need to be populated correctly"? Do you need someone to tell you what values it needs? What happens if you use (2005, 9, 1, 0, 0, 0, 0, 0, 0), for example? If you make this tuple with localtime or gmtime, do you know what the 7th (tm[6]) element of

Re: Find day of week from month and year

2005-09-02 Thread Donn Cave
, 0, 0, 0, 0, 0, 0), > > for example? If you make this tuple with localtime or gmtime, > > do you know what the 7th (tm[6]) element of the tuple is? > > What tricks did you try, exactly? > > > >Donn Cave, [EMAIL PROTECTED] > > Thanks for pointing out. tm[6

Re: read stdout/stderr without blocking

2005-09-15 Thread Donn Cave
ing it there are supposed to be two separate pipes from the same process, since if one is allowed to fill up, that process will block, causing a deadlock if the reading process blocks on the other pipe. Hope I'm not missing anything here. I just follow this group to answer this question over and over, so after a while it gets sort of automatic. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Odd behavior with os.fork and time.sleep

2005-09-16 Thread Donn Cave
he mix, there are even more issues as signals may be delivered to one thread and handled in another, etc. If you're dispatching on I/O, for example with select, you can use an otherwise unused pipe to notice the child fork's exit -- close the parent's write end right away, and th

Re: End or Identify (EOI) character ?

2005-09-19 Thread Donn Cave
figuration. The documentation is probably the place to find out more about this stuff. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory Allocation?

2005-02-07 Thread Donn Cave
sn't clear that this is all still allocated - malloc() doesn't necessarily reuse a freed block right away, and in fact the most interesting thing about this experiment is how different this part looks on different platforms. Of course we're still a bit in the dark as to how much memory is really allocated for overhead. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Kill GIL

2005-02-13 Thread Donn Cave
e tend to be a lot of undefined behaviors in events like termination of the main thread, receipt of signals, etc. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Kill GIL

2005-02-14 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Dave Brueck <[EMAIL PROTECTED]> wrote: > Donn Cave wrote: [... re stackless inside-out event loop ] > > I put that together with real OS threads once, where the I/O loop was a > > message queue instead of select. A message queueing mult

Re: Kill GIL

2005-02-14 Thread Donn Cave
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Aahz) wrote: > Yes. I just get a bit irritated with some of the standard lines that > people use. Hey, stop me if you've heard this one: "I used threads to solve my problem - and now I have two problems!"

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-19 Thread Donn Cave
ses a function f over x and y this way f(x, y) sometimes this way (+ is a function, really) x f y and sometimes this way x.f(y) ? I don't know, I'm just thinking that while Python's notation might be just fine for people who've gotten here the way most of us have, it's not obvious from this that it's just fine 4 everyone. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: select + ssl

2005-02-23 Thread Donn Cave
x27;t see ?) > > Why does the server block ? Probably you're seeing the initial exchange of data during the SSL connection - certificates and so forth. You may find that after this is done, further exchanges will work OK with select(). Or maybe not -- I really don't know enou

Re: Threading and consuming output from processes

2005-02-25 Thread Donn Cave
s multiple file descriptors as data becomes available on them. When using select(), you should read from the file descriptor, using os.read(fd, size), socketobject.recv(size) etc., to avoid reading into local buffers as would happen with a file object. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading and consuming output from processes

2005-02-26 Thread Donn Cave
uot;. I have no idea what he was talking about, but you might be interested in this issue. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Popen3 and capturestderr

2005-03-08 Thread Donn Cave
Quoth Kenneth Pronovici <[EMAIL PROTECTED]>: ... | If ignoreStderr=False, I use popen2.Popen4 so that stderr and stdout are | intermingled. If ignoreStderr=True, I use popen2.Popen3 with | capturestderr=True so stderr doesn't appear in the output. This | functionality exists so I have an equivale

Re: non blocking read()

2004-12-01 Thread Donn Cave
ot to mix buffered I/O (like file object I/O functions) with select() at all, because select() actually applies to system level file descriptors and doesn't know anything about the buffer. Get the file descriptor with fileno(), and never refer to the file object again after that. Donn Ca

Re: non blocking read()

2004-12-01 Thread Donn Cave
a pipe, socket or similar, but it's kind of implied by the use of select() also mentioned. It's also kind of implied by use of the term "block" - disk files don't block. If we are indeed talking about a pipe or something that really can block, and you call fileobject.read(1024), it will block until it gets 1024 bytes. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: non blocking read()

2004-12-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Greg Ewing <[EMAIL PROTECTED]> wrote: > Donn Cave wrote: > > If we are indeed talking about a pipe or something that > > really can block, and you call fileobject.read(1024), > > it will block until it gets 1024 bytes. > >

Re: results of division

2004-12-09 Thread Donn Cave
01] You will get something more like what you want with the str() function instead. str(1.775) == '1.775' from types import FloatType class ClassicFloat(FloatType): def __repr__(self): return self.__str__() print map(ClassicFloat, [1.775, 1.949]) yields

Re: subprocess vs. proctools

2004-12-14 Thread Donn Cave
rser seems to be ignoring the progress that os.spawnv and popen2.Popen3 made on this. Of course you don't need to repeat their blunders either and accept either string or list of strings in the same parameter, which makes for kind of a shabby API, but maybe a keyword parameter or a separate function would make sense. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: how to start a new process while the other ist running on

2004-12-22 Thread Donn Cave
'/bin/su', ['su', '-c', '%s %s %s' % (cmd, parameter1, parameter2)]) so you have almost as much work to scan the parameters for shell metacharacters as you would have with system(). Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Optional Static Typing - Haskell?

2004-12-24 Thread Donn Cave
in scope than what Haskell et al. do. Donn Cave, [EMAIL PROTECTED] ---== Posted via Newsfeed.Com - Uncensored Usenet News ==-- http://www.newsfeed.com The #1 Newsgroup Service in the World! -= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =--

Re: Optional Static Typing - Haskell?

2004-12-24 Thread Donn Cave
Quoth [EMAIL PROTECTED] (Alex Martelli): | Donn Cave <[EMAIL PROTECTED]> wrote: ... | > He didn't dwell much on it, but there was some mention of type | > inference, kind of as though that could be taken for granted. | > I guess this would necessarily be much more limited in

Re: Optional Static Typing - Haskell?

2004-12-26 Thread Donn Cave
han I did and you can decide for oneself whether it's an important one. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Optional Static Typing

2004-12-27 Thread Donn Cave
ramming? What would he say about unit testing to catch up with changes in dependent modules, do you think? Do we have a combinatorial explosion potential here? Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >