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
a derived class that does just what you want. In the present case I guess that would mean something like null = os.open('/dev/null', os.O_RDWR) os.dup2(null, 0) os.dup2(null, 2) (depending) os.close(null) along with other stuff you can just copy from Popen4. Donn -- http://mail.python.org/mailman/listinfo/python-list

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

Re: Complementary language?

2004-12-27 Thread Donn Cave
age for software development. Not a gem, but not a toy. Someone who already has Objective CAML and Python on hand might be interested in Felix, http://felix.sourceforge.net. I haven't actually used it, and for all I know it fails my utility test since it is not a very mature language, but I mention in in case anyone is interested in what the author of the "vyper" Python implementation is up to these days. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: argument type

2004-12-27 Thread Donn Cave
point the way to great programming models. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Stylistic question about inheritance

2005-03-31 Thread Donn Cave
functionality, or when they are conceptually related in ways that might lead > to shared functionality later? No -- inheritance is for implementation, not to express conceptual relationship. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: boring the reader to death (wasRe: Lambda: the Ultimate DesignFlaw

2005-04-02 Thread Donn Cave
parates statements from expressions". | | Python is for terse, pithy prose; Python is not for poetry. That's an odd thing to say. Poetry is verbose, florid? Python is Dutch. Donn -- http://mail.python.org/mailman/listinfo/python-list

Re: question about functions

2005-04-14 Thread Donn Cave
ge, and there is a similar way to pass parameters to a function from a tuple. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine ip address

2005-04-15 Thread Donn Cave
there is nothing I know of that specifically distinguishes "the" external network. If you want something that reliably finds a network that will be used for a certain type of connection, then the best thing to do is make a connection like that, and inspect the results. The getsockname

Re: Strings and Lists

2005-04-18 Thread Donn Cave
array a = array.array('c', strdata) As I understand it, this object simply contains character data, not a list of 1 character string objects, so it's much more economical to store and examine. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Variables

2005-04-24 Thread Donn Cave
's a nested sequence, not a linear one. So I'm proposing that Python's = operator is like Haskell's "<-", and "foo = 5" is conceptually like "bind 5 to a lambda with one argument "foo" implementing the rest of the procedure body." The confusion is not because foo needs to be so different, it's that Python "=" is not at all math "=". Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Variables

2005-04-25 Thread Donn Cave
" means "important to implementors". Cf. my prior post on this. Variables are semantically the same, "=" is different but can be modeled in equational terms with a fairly simple transformation. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: select() on pipe

2005-04-25 Thread Donn Cave
ifd = os.open('test.fifo', os.O_RDONLY) ... while 1: ... data = os.read(fifd, 8192) Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure FTP

2005-04-27 Thread Donn Cave
know it's purely internal and never supported in Microsoft's own software for any of the client/server protocols that use it elsewhere. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: mbx repair script

2005-04-28 Thread Donn Cave
the NUL characters, you could probably write something. Again, you have to be able to recognize the start of message data (or rather, the first MBX message header line.) If the NULs are gone, this is probably preceded by a series of CRLF ('\r\n'.) Keep track of how much has been writ

Re: mbx repair script: Python vs perl

2005-04-30 Thread Donn Cave
rary to do this, but more to the point it isn't what you want to do, with a damaged file. Just read the file from one end to the other and find everything that looks like a header line, and then rewrite the file with adjusted header lines required so that - they are in ascending order by ID n

Re: OO in Python? ^^

2005-12-12 Thread Donn Cave
man from Chalmers. You're right that addition is polymorphic, but that doesn't mean that it can be performed on any two instances of Num. I had constructed a test something like that to check my thinking, but it turns out that Haskell was able to interpret "1" as Double

Re: OO in Python? ^^

2005-12-12 Thread Donn Cave
ed expressions instead of series of statements - so maybe it's not surprising if the layout notation can be more complex. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: executing a system command from my Python app

2005-12-13 Thread Donn Cave
that the expression that appears there on the right hand side of % is not and will never be a tuple, then the (a,) one-tuple is unnecessary. If you aren't sure, it _is_ necessary. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: OO in Python? ^^

2005-12-14 Thread Donn Cave
;] foldr (++) [] [[1, 2, 3], [4, 4, 4]] Really, this kind of abstraction of data types is not only well supported in Haskell, it can be almost a curse, at least for someone like myself who has fairly superficial experience with this kind of programming. After all the functions have been zealo

Re: IsString

2005-12-14 Thread Donn Cave
ons, I suppose, whether that's really a good idea, since there's no question that some understanding of the principles involved has to come fairly early. But I think we really lose out when we try to make it be about the words - "Python doesn't have variables"/"Does too", "Python passes by value"/"Does not", etc. When the words really clearly express the right thing to anyone with a reasonable background, that's great. But usually, they don't. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: IsString

2005-12-14 Thread Donn Cave
Quoth Mike Meyer <[EMAIL PROTECTED]>: | Donn Cave <[EMAIL PROTECTED]> writes: ... |> Historically, the way I remember it, there was a time not too |> long ago when GvR and his minions sort of dismissed the idea |> that you needed to understand the reference/object model from |

Re: Haskell Typeclasses (was Re: OO in Python? ^^)

2005-12-15 Thread Donn Cave
higher up in the application hierarchy. That might be an interesting philosophical question, as a contrast between the basic world views of FP versus OOP, but of course you'd want to check it with someone with a lot more Haskell than I have. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Interprocess communication and memory mapping

2005-12-15 Thread Donn Cave
f so, how do I avoid the problem of > wasting extra memory by having all of the children processes hold all > of the data in memory as well? Pipes might likely be a better idea, but a lot depends on the design. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: IsString

2005-12-15 Thread Donn Cave
rives as a parameter with its properties unchanged, so obviously the same semantics obtain. Moreover, thinking about anything in terms of mutability is worse than a waste of time, outside of a few odd cases like dictionary keys. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: SMP, GIL and Threads

2005-12-16 Thread Donn Cave
nking that the processor affinity would essentially serialize execution, so SMP hardware doesn't matter because your threads won't execute concurrently anyway? > Threads most often use Queue.Queue to communicate, precisely because its > operations are guaranteed thread-safe. (

Re: closing stdin, stdout and stderr

2005-12-27 Thread Donn Cave
They're special. I suppose because of internal dependencies - last chance exception handler etc. - they are created without a close function, internally, so close() has no effect. I don't know if it really makes any sense, since anyway one may close the file descriptors directly as

Re: Detecting problems in a forked process

2005-12-29 Thread Donn Cave
, you can set the 'close on exec' flag on the pipe write end file descriptor and make sure no process holds this open but the child fork. See the subprocess module for example code (or just use the subprocess module, if it's supported in the deployed Python version.) Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuning a select() loop for os.popen3()

2005-12-30 Thread Donn Cave
should be 1) avoid gratuitous branches in the flow of control, 2) reduce number of state variables that you have to account for, and 3) express your intentions clearly with respect to the timeouts -- what do you do when it times out, and why? Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: how to show Chinese Characters in the value set of a dictionary

2006-01-03 Thread Donn Cave
% self.value dict['c1'] = Xtring('...') print dict.values() (Of course you should use unicode instead of string - if you can figure out how to require the default encoding that supports your character set. Python has an unfortunate preference for "ascii" as a de

Re: Is 'everything' a refrence or isn't it?

2006-01-04 Thread Donn Cave
in believers are coming from. People who don't already understand what's being explained, need to have a little patience and make sure to test their understanding with a few experiments. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-04 Thread Donn Cave
role in programming (or mathematics), a thing whose value may vary according to the logic of the program. C and FORTRAN don't own this word, and it isn't just their version against the way Python and some other languages do it. Each language has its own angle on it, and they're all going to be called variables. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread Donn Cave
arrot what was said in the > past with no concern for the consequences of what we say? The latter. I know this from the number of times I have read that parameter passing has something to do with whether the parameter is a mutable or immutable object. Donn Cave, [EMAIL PROTECTED] -- h

Re: Is 'everything' a refrence or isn't it?

2006-01-06 Thread Donn Cave
*/ } Maybe the cure for hardened C programmers who aren't getting it is to emphasize the pointer angle - and note that there isn't any way to write "*i = 4". "Everything is a pointer", let's say -- or maybe, "Everything is a reference" would be

Re: Is 'everything' a refrence or isn't it?

2006-01-08 Thread Donn Cave
rite some software, and if we dive in without understanding, our attempts will be plagued with conceptual errors. Is there something about value in particular that seems to be a problem here? ``No, you idiot, that's not a value - THIS is a value!'' Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: thread hangs when using subprocess only in specific circumstances

2006-01-09 Thread Donn Cave
not subprocess, no problem (I can use os.popen, or os.pipe/fork/execve, etc.) I imagine this is related to the problem on Linux. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-10 Thread Donn Cave
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > "Donn Cave" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] ... > > So you've had time to think about how you would define value, in a > > few words. Any ideas? > > Not y

Re: Is 'everything' a refrence or isn't it?

2006-01-13 Thread Donn Cave
#x27;t a simple problem. It isn't, in principle, it's a huge bucket of worms. But if you have a practical focus that comes out of your actual application for this function, it could be pretty trivial. Your choice, and likewise for the notion of value in general. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-13 Thread Donn Cave
straints on how you may use these namespaces. You can use an instance, or a class, like you would use a dictionary object, and then it's all value. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   >