Re: python3: 'where' keyword

2005-01-08 Thread Carlos Ribeiro
On Sat, 08 Jan 2005 12:53:05 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Andrey Tatarinov wrote: > > >>> print words[3], words[5] where: > > >>> words = input.split() > > > > - defining variables in "where" block would restrict their visibility to > > one expression > > Then your exampl

Re: Ranting about the state of Python IDEs for Windows

2005-01-08 Thread AkioIto
Carlos Ribeiro wrote: > Oh well. A mailing list is not the most appropriate place for rants (a > blog is better), but it's still better than keeping it for myself. > > I'm frustrated. My search for a good IDE to support my activities -- > doing development for Python in the Windows environment -- a

Re: "A Fundamental Turn Toward Concurrency in Software"

2005-01-08 Thread Carlos Ribeiro
On Sat, 08 Jan 2005 11:52:03 -0800, aurora <[EMAIL PROTECTED]> wrote: > One of the author's idea is many of today's main stream technology (like > OO) did not come about suddenly but has cumulated years of research before > becoming widely used. A lot of these ideas may not work or does not seems >

Re: Another look at language comparisons

2005-01-08 Thread Rick Parsons
On Sat, 08 Jan 2005 14:18:15 +0100, Jan Dries wrote: > > The bottom line of the article is that languages authored by men with > beards are more successful than those authored by people without beards. > At least the anecdotical evidence to that is overwhelming :-) > > And there is hope for Py

printing line numbers for debugging purpose

2005-01-08 Thread Philippe C. Martin
Hi, All of the methods from my program return None on error (i.e; I do not want to assert and have the program exit). Is it possible to print the current source file name/line number ? ex: in C/C++ I would use the macros __FILE__ and __LINE__. Regards, Philippe -- *

Re: EOF for binary?

2005-01-08 Thread flamesrock
ahh..that does make sense. But maybe getsize() should have a way of inferring what file is specified. I might actually submit a request.. -- http://mail.python.org/mailman/listinfo/python-list

Re: printing line numbers for debugging purpose

2005-01-08 Thread Mark McEahern
Philippe C. Martin wrote: Hi, All of the methods from my program return None on error (i.e; I do not want to assert and have the program exit). Is it possible to print the current source file name/line number ? ex: in C/C++ I would use the macros __FILE__ and __LINE__. Consider something like this:

Re: Embedding a restricted python interpreter

2005-01-08 Thread Paul Rubin
Dieter Maurer <[EMAIL PROTECTED]> writes: > It uses a specialized compiler that prevents dangerous bytecode operations > to be generated and enforces a restricted builtin environment. Does it stop the user from generating his own bytecode strings and demarshalling them? -- http://mail.python.

Re: Python Operating System???

2005-01-08 Thread Paul Rubin
"Roose" <[EMAIL PROTECTED]> writes: > > Is an OS written in Lisp also ludicrous? Because it's been done. > > Can you point me to this? I'd like to see how "truly" Lisp it is. http://en.wikipedia.org/wiki/Lisp_machine > My first guess would be -- not very. And I'd like to install it on my PC.

Re: windows mem leak

2005-01-08 Thread Bob Smith
Steve Holden wrote: Bob Smith wrote: Does the Win32 port of Python have a memory leak? I have some code that runs flawlessly on Linux, but bombs after a few hours on Windows. It's threaded and uses a lot of memory. Thanks! Yes, that's a well-known problem. Code that runs with a few errors will

Re: printing line numbers for debugging purpose

2005-01-08 Thread Michael Fuhr
"Philippe C. Martin" <[EMAIL PROTECTED]> writes: > All of the methods from my program return None on error (i.e; I do not > want to assert and have the program exit). > > Is it possible to print the current source file name/line number ? Someone else posted an example using an exception handler.

Re: Pre/Postconditions with decorators

2005-01-08 Thread Stephen Thorne
On Fri, 7 Jan 2005 20:01:50 +0200, George Sakkis <[EMAIL PROTECTED]> wrote: > > Hi George, > > it would be nice to see how you have tackled > > the task. > > Maybe we will have a checker > > module in Python one day... ;-) > > I posted my module on http://rafb.net/paste/results/voZYTG78.html and i

Re: Pre/Postconditions with decorators

2005-01-08 Thread Paul Rubin
Stephen Thorne <[EMAIL PROTECTED]> writes: > Unresolved Problems: > 1) How do you handle duck types, i.e. a method that accepts StringIO, > cStringIO or any other object that has a .readlines(), .seek() and > .read() method? That should really be done through having those classes inherit a file-op

Re: python3: 'where' keyword

2005-01-08 Thread Carl Banks
Peter Hansen wrote: > Andrey Tatarinov wrote: > > >>> print words[3], words[5] where: > > >>> words = input.split() > > > > - defining variables in "where" block would restrict their visibility to > > one expression > > Then your example above doesn't work... print takes a > sequence of expr

Re: python3: 'where' keyword

2005-01-08 Thread Paul Rubin
"Carl Banks" <[EMAIL PROTECTED]> writes: > You misunderstand. There "where" is not part of the expression but the > statement. The above example would be a modified print statement, a > print...where statement, if you will. Under this suggestion, there > would be modified versions of various sim

pyparsing: how to negate a grammar

2005-01-08 Thread knguyen
Hi, I want to define a rule for a line that does NOT start with a given Literal. How do I do that? I try the following and my program just hang there: BodyLine = ~Literal("HTTP/1.1") + restOfLine Thanks, Khoa -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-08 Thread Carl Banks
Bengt Richter wrote: > And, is the whole thing after the '=' an expression? E.g., > > x = ( foo(x) where: > x = math.pi/4.0 > ) where: > def foo(x): print 'just for illustration', x How would that be any improvement over this? . x = foo(x) where: . x = math.pi/4.0 .

Re: python3: 'where' keyword

2005-01-08 Thread Carl Banks
Paul Rubin wrote: > "Carl Banks" <[EMAIL PROTECTED]> writes: > > You misunderstand. BTW, Peter, I guess I should have said "I misunderstand, but it can be legal if you consider it part of the statements", since it appears the author did intend it to be part of an expression. > > There "where" i

Speed revisited

2005-01-08 Thread Bulba!
On 4 Jan 2005 14:33:34 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: >(b) Fast forwarding 30+ years, let's look at the dictionary method, >assuming you have enough memory to hold all your data at once: > >Step 1: read the "left" table; for each row, if english not in mydict, >then do mydict[engl

Re: Python Operating System???

2005-01-08 Thread Bulba!
On Sat, 08 Jan 2005 08:28:12 GMT, "Roose" <[EMAIL PROTECTED]> wrote: >I am not trying to be insulting... but unless someone would like to educate >me otherwise, the idea of an OS written in Python is almost ludicrous. As I >said, I think you might mean an OS SHELL, which would be a reasonable >(a

Re: python3: 'where' keyword

2005-01-08 Thread Paul Rubin
"Carl Banks" <[EMAIL PROTECTED]> writes: > ># compute sqrt(2) + sqrt(3) > >x = (sqrt(a) where: > > a = 2.) \ > >+ sqrt (a) where: > >a = 3. > > > > Hmmm. > > What would be the advantage of that over this? > > . x = sqrt(a) + sqrt(b) where: > . a = 2.0 > .

Windows XP Installation

2005-01-08 Thread Smitsky
Hi. I am a newbie to Python. I am running Win XP and want to know what the best course is for installing Python on my system. Could someone kindly direct me to some related resources? Thanks in advance, Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed revisited

2005-01-08 Thread Steven Bethard
Bulba! wrote: Following advice of two posters here (thanks) I have written two versions of the same program, and both of them work, but the difference in speed is drastic, about 6 seconds vs 190 seconds for about 15000 of processed records, taken from 2 lists of dictionaries. I've read "Python Per

Re: Python Installation

2005-01-08 Thread Simon John
brolewis wrote: > I need to install Python on a number of laptop computers (at least a > dozen). I am needing to install Python 2.4, pycrypto, win32all, > wxPython, and pyCurl. You could try the recently-announced MOVPY, or NSIS/InnoSetup as you say. Or simply put the five installers on a disk -

Re: Windows XP Installation

2005-01-08 Thread Kartic
Smitsky, Did you at least visit python.org, Python main website? Step 1: Visit www.python.org Step 2: Click on the download link Step 3: Located Windows Binary in the list of downloads (choose the first link - http://python.org/ftp/python/2.4/python-2.4.msi - if you dont know what Itanium is) Ste

Re: Windows XP Installation

2005-01-08 Thread Irmen de Jong
Smitsky wrote: Hi. I am a newbie to Python. I am running Win XP and want to know what the best course is for installing Python on my system. Could someone kindly direct me to some related resources? Thanks in advance, Steve The Python beginners guide contains a lot of information for you: http:/

Re: Python Operating System???

2005-01-08 Thread Andrew Dalke
Paul Rubin: > Lately there are people trying to program PC's to > simulate the Lisp hardware and to get the Lisp Machine software > released (now that the commercial market for it has long since dried > up). However, both of those projects have a ways to go. There's a video of someone demoing how

Re: windows mem leak

2005-01-08 Thread Bulba!
On Sat, 08 Jan 2005 15:00:05 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: >> Does the Win32 port of Python have a memory leak? I have some code that >> runs flawlessly on Linux, but bombs after a few hours on Windows. It's >> threaded and uses a lot of memory. >Yes, that's a well-known proble

Re: Windows XP Installation

2005-01-08 Thread Bob Smith
Smitsky wrote: Hi. I am a newbie to Python. I am running Win XP and want to know what the best course is for installing Python on my system. Could someone kindly direct me to some related resources? Thanks in advance, Steve It's really easy on Windows. Just download the install package and cli

Re: Windows XP Installation

2005-01-08 Thread Smitsky
Thanks Folks. Yes, I did visit the Python site. I just wasn't sure what to try first. :O) Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: accessing the result of 'if'

2005-01-08 Thread Carl Banks
Nick Coghlan wrote: > I have a different suggestion for this. > > 'as' is used for renaming in import statements. 'as' will be used for exception > naming in Python 3k. > > So let's use it for expression naming in 'if' statements, too. > > if someregexp.match(s) as m: ># blah using m > elif som

Re: tuples vs lists

2005-01-08 Thread worzel
yes, "tyoopl" - thats what I meant by 'choo-ple' (not v good at the phonetics) As a scouse git (though living in Australia), I would definitely say 'tyoopl'. "Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > worzel wrote: > >> Cheers - thanks for the feedback guys -

Re: The best way to do web apps with Python?

2005-01-08 Thread worzel
Holy Moly - there's quite a few choices out there! I like the look of Karrigel for my immediate needs. Looking forward to the day there is a more 'j2ee' like standard in place for Python - looks like this is in the works. Thanks for all the feedback guys. "worzel" <[EMAIL PROTECTED]> wrote i

Re: Speed revisited

2005-01-08 Thread John Machin
Bulba! wrote: > On 4 Jan 2005 14:33:34 -0800, "John Machin" <[EMAIL PROTECTED]> > wrote: > > >(b) Fast forwarding 30+ years, let's look at the dictionary method, > >assuming you have enough memory to hold all your data at once: > > > >Step 1: read the "left" table; for each row, if english not in

Re: tuples vs lists

2005-01-08 Thread Sean Dolan
worzel wrote: I get what the difference is between a tuple and a list, but why would I ever care about the tuple's immuutability? Also, do you say 'too-ple' or 'chu-ple' - if you get my drift. (tomato or tomato kind of thing) TIA I use the Festival Speech Synthesis System to learn pronunciatio

Re: Python Operating System???

2005-01-08 Thread Bengt Richter
On Sat, 08 Jan 2005 12:47:52 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: >Paul Rubin wrote: >> When Unix was first written, people thought implementing an OS in C >> was ludicrous. Everyone knew OS's had to be written in assembler. > >Actually, when Unix was first written that belief was entir

Re: python3: 'where' keyword

2005-01-08 Thread Bengt Richter
On 8 Jan 2005 16:13:39 -0800, "Carl Banks" <[EMAIL PROTECTED]> wrote: > >Bengt Richter wrote: >> And, is the whole thing after the '=' an expression? E.g., >> >> x = ( foo(x) where: >> x = math.pi/4.0 >> ) where: >> def foo(x): print 'just for illustration', x > >How woul

Make predictions about Python in a New Google Game

2005-01-08 Thread Amir Michail
Hi, I have added over 50 Python related (Query, URL) pairs into the Speculative Search Game -- a new Google game. Just search for "python" to find them when making predictions: http://www.cse.unsw.edu.au/~amichail/spec/ The Speculative Search Game allows you to predict which web pages will rank

Re: Python Operating System???

2005-01-08 Thread John Roth
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Sat, 08 Jan 2005 12:47:52 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: Paul Rubin wrote: When Unix was first written, people thought implementing an OS in C was ludicrous. Everyone knew OS's had to be written in as

Re: Python Operating System???

2005-01-08 Thread John Roth
"jtauber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] My experiment, Cleese, was making progress before I got distracted by other things. The approach was a micro-kernel in C made up of the CPython bytecode interpreter with the file-related calls to libc ripped out and some bare-me

Re: The Industry choice

2005-01-08 Thread Bulba!
On 6 Jan 2005 20:07:19 -0500, [EMAIL PROTECTED] (Aahz) wrote: >>Nope. That is not what I'm arguing. Really, I think you have >>jumped to conclusion about that: I merely pointed out that >>I don't like what I perceive as end effect of what GPL license >>writers are attempting to achieve: vendor loc

time module precision

2005-01-08 Thread Jane Austine
What is the precision (and accuracy) of time module on a Windows XP machine? threading module depends on time module so it's precision(and accuracy) is up to time module's. | for i in xrange(1000): |time.sleep(0.001) This sleeps for awhile, which means 0.001 sec is not ignored. On the other

Re: Python Operating System???

2005-01-08 Thread Roose
OK I've heard of that. But the original poster didn't ask to make a Python machine and then a Python OS. My point was that you can't do a lot of hardware interface programming in pure Python -- there would be so much non-trivial code in C that it would be hard to call it a Python OS. So this bas

Re: Python Operating System???

2005-01-08 Thread Paul Rubin
"Roose" <[EMAIL PROTECTED]> writes: > My point was that you can't do a lot of hardware interface programming in > pure Python -- there would be so much non-trivial code in C that it would be > hard to call it a Python OS. Why do you say that? Is the same thing not true of C, where you need some a

Re: python3: 'where' keyword

2005-01-08 Thread Nick Coghlan
Bengt Richter wrote: On Sat, 08 Jan 2005 16:42:16 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: And, is the whole thing after the '=' an expression? E.g., x = ( foo(x) where: x = math.pi/4.0 ) where: def foo(x): print 'just for illustration', x or is this legal? for y i

mysterious buggy behavior

2005-01-08 Thread Sean McIlroy
While fiddling with a little script I ran into a problem that baffles me completely. Maybe I'm missing something completely obvious, and somebody out there can diagnose the problem at a glance. Anyway, that's the hope. Here's the code (it plays tic tac toe): """ Something goes wrong with the "tim

Re: python3: 'where' keyword

2005-01-08 Thread Nick Coghlan
Paul Rubin wrote: What would be the advantage of that over this? . x = sqrt(a) + sqrt(b) where: . a = 2.0 . b = 3.0 The idea of "where" is to allow re-using variable names instead of having to keep track of which ones are in use. I just tried to give a very simple example of how you might

Are there some resources about Python's VM and Python's implementation?

2005-01-08 Thread cr999
I am very interested in Python's VM and also Python's implementation. I want to read the Phton's source code but i think it is very helpful if there are some resources and docuemnts about this topic. Anybody knows about this?   Thanks :)   Robert -- http://mail.python.org/mailman/

Re: The best way to do web apps with Python?

2005-01-08 Thread Joe Francia
worzel wrote: What is the best way to web developemnt with Python? Is there anything close to PHP style in-page script placement that can create and use other Python objects? I am not really interested in Zope (I believe that is more a CMS than anything else?) I am also looking for something a litt

Re: python3: accessing the result of 'if'

2005-01-08 Thread Nick Coghlan
Carl Banks wrote: What if the condition you wanted to test wasn't the same as the thing you want to save? In other words, how would you convert this? . where: . m = something() . if m > 20: . do_something_with(m) Yeah, this problem eventually occurred to me as well. However, I think a litt

Re: python3: 'where' keyword

2005-01-08 Thread Paul Rubin
Nick Coghlan <[EMAIL PROTECTED]> writes: > I think having to keep the names unique within the statement you are > currently writing is a reasonable request :) Um, you could say the same thing about the function, the module, etc. ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning same type as self for arithmetic in subclasses

2005-01-08 Thread michele . simionato
Max. M.: > So I wondered if there was a simlpler way to coerce the result into my > desired types rather than overwriting the __add__, __sub__ etc. methods? Tim Peters: >> Generally speaking, no. But I'm sure someone will torture you with a >> framework that purports to make it easy . I will not

Re: mysterious buggy behavior

2005-01-08 Thread Nick Coghlan
Sean McIlroy wrote: While fiddling with a little script I ran into a problem that baffles me completely. Maybe I'm missing something completely obvious, and somebody out there can diagnose the problem at a glance. Anyway, that's the hope. Here's the code (it plays tic tac toe): You need to be a lit

Re: python3: accessing the result of 'if'

2005-01-08 Thread Carl Banks
Nick Coghlan wrote: > Carl Banks wrote: > > What if the condition you wanted to test wasn't the same as the thing > > you want to save? In other words, how would you convert this? > > > > . where: > > . m = something() > > . if m > 20: > > . do_something_with(m) > > Yeah, this problem even

Re: python3: 'where' keyword

2005-01-08 Thread Nick Coghlan
Paul Rubin wrote: AdSR <[EMAIL PROTECTED]> writes: Killer app for this keyword: class C(object): x = property(get, set) where: def get(self): return "Silly property" def set(self, val): self.x = "Told you it was silly" Hey, this is super-elegant! Heh, even further: z = C() whe

Re: python3: accessing the result of 'if'

2005-01-08 Thread Donn Cave
Quoth "Carl Banks" <[EMAIL PROTECTED]>: ... | As a compromise, howabout: | | . if m > 20 where m=something(): | . do_something_with(m) | | In this case, the m=something() is NOT an assignment statement, but | merely a syntax resembling it. The "where m=something()" is part of | the if-statemen

Re: time module precision

2005-01-08 Thread Tim Peters
[Jane Austine] > What is the precision (and accuracy) of time module on a Windows XP > machine? There are many functions in the time module. You shouldn't assume that any two have similar behavior (because, in fact, they may not). > threading module depends on time module so it's precision(and >

Re: Python Operating System???

2005-01-08 Thread Bengt Richter
On Sat, 8 Jan 2005 21:29:47 -0600, "John Roth" <[EMAIL PROTECTED]> wrote: > >"Bengt Richter" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> On Sat, 08 Jan 2005 12:47:52 -0500, Peter Hansen <[EMAIL PROTECTED]> >> wrote: >> >>>Paul Rubin wrote: When Unix was first written, pe

Re: Python Operating System???

2005-01-08 Thread Roose
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > "Roose" <[EMAIL PROTECTED]> writes: > > My point was that you can't do a lot of hardware interface programming in > > pure Python -- there would be so much non-trivial code in C that it would be > > hard to call it a

Re: Python Operating System???

2005-01-08 Thread Paul Rubin
"Roose" <[EMAIL PROTECTED]> writes: > But are you really going to write a virtual memory system in Python? Are > you going to write a file system, and a task scheduler in Python? Are you > going to have people write device drivers in Python? Do you know how virtual memory systems, file systems,

Re: python3: 'where' keyword

2005-01-08 Thread Nick Coghlan
Paul Rubin wrote: Nick Coghlan <[EMAIL PROTECTED]> writes: I think having to keep the names unique within the statement you are currently writing is a reasonable request :) Um, you could say the same thing about the function, the module, etc. ;) And, indeed, that is what Python currently says. Whe

Re: python3: 'where' keyword

2005-01-08 Thread Paul Rubin
Nick Coghlan <[EMAIL PROTECTED]> writes: >x = (sqrt(a) where (a=2.0)) + (sqrt(b) where (a=3.0)) Hmm, I like that too. -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: accessing the result of 'if'

2005-01-08 Thread Nick Coghlan
Carl Banks wrote: I'm sorry, I really can't agree that this helper function "solves" it. IMO, it's a workaround, not a solution. And, if I may be frank, it's a pretty ugly one. Heck, I thought it was ugly and I wrote it :) So in reality, I'd continue to use the nested-if approach that works right

Re: python3: accessing the result of 'if'

2005-01-08 Thread Carl Banks
Donn Cave wrote: > 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. I suspect

<    1   2