How to get 4 numbers from the user in one line for easy comparision?

2005-07-02 Thread Nathan Pinno
I saw that great idea from Steven, and I appreciate it. I think it will work. Just need to figure out how to get 4 numbers from the player on one line for easy comparison, e.g. telling whether the number is correct position and number, incorrect position and correct number, or both are incorr

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

2005-07-02 Thread Erik Max Francis
Ron Adam wrote: > But together, sum and product, probably cover about 90% of situations in > which you would use reduce. Getting a total (sum) from a list probably > covers 80% of the situations reduce would be used on it's own. (I can't > think of any real uses of product at the moment. It's

Re: What's wrong with this code?

2005-07-02 Thread Nathan Pinno
Hi all, Sure I'm able to publish the code, only the previous version though. If you want the first version; find Josh Cogliati, and ask him. It didn't have a random function, though. I got the idea to improve it from my computer course. Here is the code: #Plays the guessing game higher

Re: Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-02 Thread [EMAIL PROTECTED]
Thanks! Even the fact that these ideas have been organized into a PEP is exciting to methere is hope that they may *someday* be implemented. Maybe sooner than people think. Another reason to love Python like no other. Chris -- http://mail.python.org/mailman/listinfo/python-list

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

2005-07-02 Thread Ron Adam
Steven D'Aprano wrote: > On Sat, 02 Jul 2005 20:26:31 -0700, Devan L wrote: > > >> Claiming that sum etc. do the same job is the whimper of >>someone who doesn't want to openly disagree with Guido. >> >>Could you give an example where sum cannot do the job(besides the >>previously mentioned prod

Re: Favorite non-python language trick?

2005-07-02 Thread James
Steven D'Aprano wrote: > On Fri, 24 Jun 2005 14:29:37 -0700, James wrote: > > > Interesting thread ... > > > > 1.) Language support for ranges as in Ada/Pascal/Ruby > > 1..10 rather than range(1, 10) > > What advantages do Pascal-like for loops give over Python for loops? > > The only two I can thi

Re: POP3 and "seen" flag

2005-07-02 Thread Miki Tebeka
Hello Peter, > > Is there a way to know in a POP session of a message was seen (old) or not > > (new)? > > Define "seen". It could be interpreted as either "TOP" or "RETR" having > been executing for a message, or something like "this client has seen > this message before" ... not sure what yo

Re: Folding in vim

2005-07-02 Thread Ron Adam
Terry Hancock wrote: > My general attitude towards IDEs and editors has been > extremely conservative, but today I decided to see what > this "folding" business was all about. > > I see that vim (and gvim, which is what I actually use) > has this feature, and it is fairly nice, but at present i

Re: PIL question: keeping metadata

2005-07-02 Thread Ilpo Nyyssönen
"Will McCutchen" <[EMAIL PROTECTED]> writes: >> Is there any way of keeping this info in PIL? > > I don't think so... when I investigated in the past, I think I > discovered that the PIL can't write EXIF data (I might be wrong, > though, or my information might be outdated). There is this: http:

Re: Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-02 Thread Jordan Rastrick
Python 3000 is the proveribal and so far hypothetical version of the language in which backward incompatible changes will be allowed (and encouraged). See http://www.python.org/peps/pep-3000.html for details. [EMAIL PROTECTED] wrote: > Guido gave a nice "Python Regrets" Power Point talk at OSCO

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 10:50 pm, Peter Hansen wrote: > Terry Hancock wrote: > > On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > > And for that matter, some of the posters here have *been* 14. > > Terry, almost every single one of the posters here have been 14. > At some time. :-) U

Re: Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Guido gave a nice "Python Regrets" Power Point talk at OSCON few years > ago. > > I was wondering if the plan is to ever implement these ideas. > > e.g. Guido said he'd prefer 'print' to be a *function* with perhaps a > 'println' version IIRC. > >He also had a

Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-02 Thread [EMAIL PROTECTED]
Guido gave a nice "Python Regrets" Power Point talk at OSCON few years ago. I was wondering if the plan is to ever implement these ideas. e.g. Guido said he'd prefer 'print' to be a *function* with perhaps a 'println' version IIRC. He also had a ton of stuff he'd rather see become iterato

Re: What are the other options against Zope?

2005-07-02 Thread Christopher Subich
Dennis Lee Bieber wrote: > The Windows registry is "a maze of twisty little passages, all > alike" ITYM "a maze of twisty little passeges, {058C1536-2201-11D2-BFC1-00805F858323}" > The registry a cryptic, bloated, system by which M$ can hide > details about anything they want... In

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

2005-07-02 Thread Jp Calderone
On Sun, 03 Jul 2005 01:01:18 -0400, Christopher Subich <[EMAIL PROTECTED]> wrote: >Steven D'Aprano wrote: >> comps. But reduce can't be written as a list comp, only as a relatively >> complex for loop at a HUGE loss of readability -- and I've never used >> Lisp or Scheme in my life. I'm surely not

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

2005-07-02 Thread Christopher Subich
Steven D'Aprano wrote: > comps. But reduce can't be written as a list comp, only as a relatively > complex for loop at a HUGE loss of readability -- and I've never used > Lisp or Scheme in my life. I'm surely not the only one. See my reply to your other post for a more detailed explanation, but I

Re: What are the other options against Zope?

2005-07-02 Thread Mike Meyer
Terry Hancock <[EMAIL PROTECTED]> writes: > This is true in the same sense that Python is unnecessary > because all programs can be written in assembler. Or machine > code for that matter. Entered by flipping switches, even -- throw > away that keyboard. > > I have actually seen this done, BTW.

Re: Favorite non-python language trick?

2005-07-02 Thread Christopher Subich
Devan L wrote: > sum(sequence[0] + [1/element for element in sequence[1:]]) > > I think that should work. That won't work, because it misses the x*y part of the expression (x[n]*x[n+1] + 1/x[n+1], for people who haven't immediately read the grandparent). Personally, I think demanding that it b

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

2005-07-02 Thread Steven D'Aprano
On Sat, 02 Jul 2005 20:26:31 -0700, Devan L wrote: > Claiming that sum etc. do the same job is the whimper of > someone who doesn't want to openly disagree with Guido. > > Could you give an example where sum cannot do the job(besides the > previously mentioned product situation? There is an inf

Re: Favorite non-python language trick?

2005-07-02 Thread Devan L
sum(sequence[0] + [1/element for element in sequence[1:]]) I think that should work. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, mysql, floating point values question

2005-07-02 Thread Peter Hansen
Terry Hancock wrote: > On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > And for that matter, some of the posters here have *been* 14. Terry, almost every single one of the posters here have been 14. At some time. :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

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

2005-07-02 Thread Peter Hansen
Steven D'Aprano wrote: > On Fri, 01 Jul 2005 13:42:10 -0400, Mike Meyer wrote: >>No, he wants Python to be Pythonic. TMTOWTDI is not Pythonic. > > Too Many T--- Only Way To Do It? > > There Might Tangle One Way To Do It? > > T--- M--- Two Obvious Ways To Do It? > > Nope, sorry, still not gettin

Folding in vim

2005-07-02 Thread Terry Hancock
My general attitude towards IDEs and editors has been extremely conservative, but today I decided to see what this "folding" business was all about. I see that vim (and gvim, which is what I actually use) has this feature, and it is fairly nice, but at present it's very manual --- and frankly it

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

2005-07-02 Thread Devan L
Claiming that sum etc. do the same job is the whimper of someone who doesn't want to openly disagree with Guido. Could you give an example where sum cannot do the job(besides the previously mentioned product situation? Also, map is easily replaced. map(f1, sequence) == [f1(element) for element i

math.nroot [was Re: A brief question.]

2005-07-02 Thread Steven D'Aprano
On Sun, 03 Jul 2005 02:22:23 +0200, Fredrik Johansson wrote: > On 7/3/05, Tom Anderson <[EMAIL PROTECTED]> wrote: >> That's one way. I'd do: >> >> root = value ** 0.5 >> >> Does that mean we can expect Guido to drop math.sqrt in py3k? :) > > I'd rather like to see a well implemented math.nthroo

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > On Sat, 2 Jul 2005 18:49:20 -0400, Christopher Kang > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > I've been doing the epsilon comparisons, i had just hoped that to be a > > temporary solution. > > > Consid

Re: What are the other options against Zope?

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 04:26 pm, phil wrote: > > A rather object-oriented system for managing and serving web > > applications and data (using object inheritance for common behavior, > > etc.) This makes Zope a toolkit, not an end application itself. > > So that would make it Apache, with a Pyth

Re: Inheriting from object

2005-07-02 Thread Bengt Richter
On Sat, 02 Jul 2005 14:17:32 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> BTW, there's something about referring to type(self) by its not >> always dependably bound (though usually global) name that bothers me. >> >> I wonder if the above common use of super could be im

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread flamesrock
I've needed to do something similar in the past and used free ntp servers. Of course you need an internet connection: http://ntp.isc.org/bin/view/Servers/NTPPoolServers http://www.nightsong.com/phr/python/setclock.py You could also have a startup script spawn a thread that stores the time persiste

Re: Favorite non-python language trick?

2005-07-02 Thread Christopher Subich
Steven D'Aprano wrote: > On Fri, 01 Jul 2005 12:24:44 -0700, Devan L wrote: > > >>With the exception of reduce(lambda x,y:x*y, sequence), reduce can be >>replaced with sum, and Guido wants to add a product function. > > > How do you replace: > > reduce(lambda x,y: x*y-1/y, sequence) > > with

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-07-02 Thread Grant Edwards
On 2005-07-03, Darkfalz <[EMAIL PROTECTED]> wrote: > I find this amusing even when they have the most cockney, ghetto > English accent, Americans still find it "sophisticated". No they don't. Americans have pretty much the same stereotypes about regional English accents that the average Brit doe

Re: Another newbie question from Nathan.

2005-07-02 Thread Steven D'Aprano
On Sat, 02 Jul 2005 00:25:00 -0600, Nathan Pinno wrote: > > > Hi all. > > How do I make the computer generate 4 random numbers for the guess? I want > to know because I'm writing a computer program in Python like the game > MasterMind. First you get the computer to generate one random numb

Re: Python for everything?

2005-07-02 Thread Mike Meyer
Christos "TZOTZIOY" Georgiou <[EMAIL PROTECTED]> writes: > On Thu, 30 Jun 2005 20:55:20 -0400, rumours say that Mike Meyer > <[EMAIL PROTECTED]> might have written: > >>Actually, I was thinking of pre-K&R Unix compilers. > > There must be something I am missing here, cause I don't understand what

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

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 19:15:46 -0700, Erik Max Francis wrote: > Sean McIlroy wrote: > >> if that's the case then list >> comprehensions and/or "first class functions" are likely to be the next >> target. > > Slippery slope arguments are logical fallacies, you know. Not if you are actually standin

Re: Inheriting from object

2005-07-02 Thread John Roth
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I wonder if the above common use of super could be implemented as a > property of object, > so you'd normally inherit it and be able to write >self.super.__init__(*args, **kwargs) # (maybe spell it > self.__super

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

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 13:42:10 -0400, Mike Meyer wrote: > "iK" <[EMAIL PROTECTED]> writes: > >> Seems like he wants python programmers to solve their problems all in the >> same way. While that is great for corporate slaves it is terrible for the >> creative programmer. > > No, he wants Python t

Re: Assigning to None (was Re: Question about Python)

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 12:59:20 -0400, François Pinard wrote: > [Peter Hansen] >> Mike Meyer wrote: >> > Yes. I once grabbed an old program that did assignments to None. But >> > that's always been a bad idea. > >> What was the use case!? > > People used to assign None to itself as a keyword argume

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

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 09:13:58 -0700, mcherm wrote: > Lambda serves a very specific purpose: declaring small, in-place > functions which are no bigger than a single expression. I do this often > enough that I DO want special syntax for it. But I'll admit that I > wish "lambda" were about 5 or 6 cha

Re: Favorite non-python language trick?

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 12:24:44 -0700, Devan L wrote: > With the exception of reduce(lambda x,y:x*y, sequence), reduce can be > replaced with sum, and Guido wants to add a product function. How do you replace: reduce(lambda x,y: x*y-1/y, sequence) with sum? Inquiring minds want to know. -- S

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-07-02 Thread Darkfalz
muldoon wrote: > Americans consider having a "British accent" a sign of sophistication > and high intelligence. Many companies hire salespersons from Britain to > represent their products,etc. Question: When the British hear an > "American accent," does it sound unsophisticated and dumb? > > Be blu

Re: Inheriting from object

2005-07-02 Thread Steven Bethard
Bengt Richter wrote: > I wonder if the above common use of super could be implemented as a property > of object, > so you'd normally inherit it and be able to write > self.super.__init__(*args, **kwargs) # (maybe spell it > self.__super__.__init__(...) I suppose) > > I.e., self.__super__ wo

Re: What's wrong with this code?

2005-07-02 Thread John Machin
John Machin wrote: > Nathan Pinno wrote: >> guess = input("Guess a number: ") > > > "guess" will refer to a string e.g. "42" which will *not* compare equal > to the integer 42. Also you should use raw_input, not input. > > so do this: > > guess = int(raw_input("Guess a number: ")) > A

Re: A brief question.

2005-07-02 Thread Fredrik Johansson
On 7/3/05, Tom Anderson <[EMAIL PROTECTED]> wrote: > That's one way. I'd do: > > root = value ** 0.5 > > Does that mean we can expect Guido to drop math.sqrt in py3k? :) I'd rather like to see a well implemented math.nthroot. 64**(1/3.0) gives 3.9996, and this error could be avoided.

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread John Machin
Roy Smith wrote: > Peter Hansen <[EMAIL PROTECTED]> wrote: > >>I guess as long as the NTP client is set up to ensure the time >>adjustments are smaller than some value X, it would be acceptable. > > > NTP is generally capable of keeping the various system clocks on a LAN > within a few ms of e

Re: Regular Expression for pattern substitution

2005-07-02 Thread James Stroud
You might want to be a little more explicit. Do you know that this = "this" that = "that" or do you mean this = `the part before the \D*` that = `the part after the \D*` If you mean the former, then the previously proposed py> import re py> line = 'see this man with that woman holding this do

Re: A brief question.

2005-07-02 Thread Tom Anderson
On Sat, 2 Jul 2005, Tom Brown wrote: > On Saturday 02 July 2005 10:55, Nathan Pinno wrote: > >> Brief question for anyone who knows the answer, because I don't. Is >> there anyway to make Python calculate square roots? > > from math import sqrt That's one way. I'd do: root = value ** 0.5 Does

Re: What's wrong with this code?

2005-07-02 Thread John Machin
Nathan Pinno wrote: > Hi all, > > What's wrong with the following code? It says there is name error, that > random is not defined. How do I fix it? Others have already answered that question. This posting is a pre-emptive strike to head off the next half-a-dozen questions. > > # Plays th

Re: A brief question.

2005-07-02 Thread Tom Brown
On Saturday 02 July 2005 10:55, Nathan Pinno wrote: > Brief question for anyone who knows the answer, because I don't. Is > there anyway to make Python calculate square roots? from math import sqrt -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread Tim Peters
[Peter Hansen] > Hmmm... not only that, but at least under XP the return value of > time.time() _is_ UTC. At least, it's entirely unaffected by the > daylight savings time change, or (apparently) by changes in time zone. On all platforms, time.time() returns the number of seconds "since the epoch

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread Peter Hansen
Roy Smith wrote: > Peter Hansen <[EMAIL PROTECTED]> wrote: >>Using time.time() doesn't appear to be suitable, since time might jump >>forwards or backwards at the user's whim, if the system clock is reset, >>or when a daylight savings time change occurs. > > If you get the UTC time, daylight sav

Re: What's wrong with this code?

2005-07-02 Thread Tim Roberts
"Nathan Pinno" <[EMAIL PROTECTED]> wrote: > > Hi all, > > What's wrong with the following code? It says there is name error, that >random is not defined. How do I fix it? > > # Plays the guessing game higher or lower. > # Originally written by Josh Cogliati, improved first by Quique, then by >N

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Jun 29)

2005-07-02 Thread John Machin
Christos TZOTZIOY Georgiou wrote: > On Fri, 01 Jul 2005 23:45:57 +1000, rumours say that John Machin > <[EMAIL PROTECTED]> might have written: > > >>Simon Brunning wrote: >> >>>On 7/1/05, Peter Maas <[EMAIL PROTECTED]> wrote: >>> >>> Simon Brunning schrieb: > Sibylle Koczian n

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread Peter Hansen
Roy Smith wrote: > Peter Hansen <[EMAIL PROTECTED]> wrote: >>I'll have to look into how to set up Windows XP to prevent users from >>changing the time on their own, assuming that's possible. > > On a single-user system like Windows, you pretty much have to assume the > user can do anything. The

Re: Python, mysql, floating point values question

2005-07-02 Thread Christopher Kang
Thanx all for responding. I've been doing the epsilon comparisons, i had just hoped that to be a temporary solution. anyway, thanx for the responses -- http://mail.python.org/mailman/listinfo/python-list

Re: Running Python interpreter in Emacs

2005-07-02 Thread Rex Eastbourne
Yes, I knew that copying it to my root was a kludge. But between that and not having it work, I chose the former. (As you might be able to tell from my posts, I tried multiple things and was frustrated.) I tried putting quotes around "c:\program files\python24". It still didn't work. I chose to in

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 05:04 am, Ralf W. Grosse-Kunstleve wrote: > I often find myself writing:: > > class grouping: > > def __init__(self, x, y, z): > self.x = x > self.y = y > self.z = z > # real code, finally Fortunately, you don't

Re: What are the other options against Zope?

2005-07-02 Thread [EMAIL PROTECTED]
If you're looking for a leight weight web development enviroment acting as a front end for a database take a look at http://www.cherrypy.org -- http://mail.python.org/mailman/listinfo/python-list

Re: What are the other options against Zope?

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 10:55 am, phil wrote: > Zope is like that to me. I ask what is it and the answer > sounds like "Oh, it's oierbv for the zxcvioupo of 7cvn^djh'. > > Now understand, I know what very well what Python, Apache, PhP, > MySQL, IE and javascript do. I just don't know what Zope

Re: Python for everything?

2005-07-02 Thread Roy Smith
Christos "TZOTZIOY" Georgiou <[EMAIL PROTECTED]> wrote: > Were there other Unix C compilers before K&R wrote one? Considering that K&R (along with T) invented both Unix and C, I would say that the answer to the above has to be "No". -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread Roy Smith
Peter Hansen <[EMAIL PROTECTED]> wrote: > I guess as long as the NTP client is set up to ensure the time > adjustments are smaller than some value X, it would be acceptable. NTP is generally capable of keeping the various system clocks on a LAN within a few ms of each other, and within a few 10'

Re: shelve in a ZipFile?

2005-07-02 Thread Terry Hancock
On Friday 01 July 2005 04:40 pm, Andreas Kostyrka wrote: > It's even worse: shelve is basically a class that wraps a dictionary. It > provides a dictionary string -> pickable object based on a dictioary > string -> string. bsddb, gdbm etc. probably access files via lowlevel > calls that are not int

Re: What are the other options against Zope?

2005-07-02 Thread phil
> either... It sits under... Well that's a relief, cause ...sits on top of was confusing. > A rather object-oriented system for managing and serving web > applications and data (using object inheritance for common behavior, > etc.) This makes Zope a toolkit, not an end application itself.

Re: Python for everything?

2005-07-02 Thread TZOTZIOY
On Thu, 30 Jun 2005 20:55:20 -0400, rumours say that Mike Meyer <[EMAIL PROTECTED]> might have written: >Actually, I was thinking of pre-K&R Unix compilers. There must be something I am missing here, cause I don't understand what you mean; what is the earliest K&R C compiler ("Unix" compiler) you

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-07-02 Thread TZOTZIOY
On Thu, 30 Jun 2005 18:29:56 +0100, rumours say that Tom Anderson <[EMAIL PROTECTED]> might have written: >On Thu, 30 Jun 2005, Benji York wrote: > >> python-needs-more-duct-tape'ly yours, > >You're in luck: Python 3000 will replace duck typing with duct taping. I would bet that somewhere in the

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-07-02 Thread TZOTZIOY
On 28 Jun 2005 13:24:42 -0700, rumours say that "muldoon" <[EMAIL PROTECTED]> might have written: > Now, what forum would you recommend? Any help would be appreciated. alt.usage.english? alt.languages.english? alt.english.usage? uk.culture.language.english? -- TZOTZIOY, I speak England very be

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Friday 01 July 2005 11:13 pm, John Machin wrote: > x BETWEEN y AND z Ah, even better, thank you. >The python equivalent would be to write it out as: > > > > if a > b-epsilon and a < b+epsilon: > > print "a~=b" > > Try this: > > if b-epsilon < a < b+epsilon: This I knew, but I

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-02 Thread Mike C. Fletcher
Ralf W. Grosse-Kunstleve wrote: ... >class grouping: > >def __init__(self, x, y, z): >self.x = x >self.y = y >self.z = z ># real code, finally > >This becomes a serious nuisance in complex applications with long >argument lists, especiall

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread Peter Hansen
Roy Smith wrote: > Peter Hansen <[EMAIL PROTECTED]> wrote: > If you get the UTC time, daylight savings time doesn't enter the equation. Of course... I didn't think of that approach. I don't actually care about absolute time, so this should work fine for at least the DST case. > If you care ab

Re: wxPython: Terminal Output -> Scrollable Panel?

2005-07-02 Thread flamesrock
Exactly what I'm looking for! Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread Roy Smith
Peter Hansen <[EMAIL PROTECTED]> wrote: > I would like to determine the "actual" elapsed time of an operation > which could take place during a time change, in a platform-independent > manner (at least across Linux/Windows machines). > > Using time.time() doesn't appear to be suitable, since tim

Determining actual elapsed (wall-clock) time

2005-07-02 Thread Peter Hansen
I would like to determine the "actual" elapsed time of an operation which could take place during a time change, in a platform-independent manner (at least across Linux/Windows machines). Using time.time() doesn't appear to be suitable, since time might jump forwards or backwards at the user's

Re: wxPython: Terminal Output -> Scrollable Panel?

2005-07-02 Thread Peter Hansen
flamesrock wrote: > I looked at PyCrust, and while its given me a few cool ideas, I may > have described the problem incorrectly. What I really need is not > something that takes input, but merely redirects the 'print' statements > to something like a terminal window. > > Is this even possible wi

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-02 Thread jcarlson
Ralf W. Grosse-Kunstleve wrote: > A shorter alternative (my personal favorite since minimally redundant):: > > class grouping: > > def __init__(self, .keep_this, .and_this, but_not_this, > .but_this_again): > # real code right here There is also the variant which I proposed on p

Re: wxPython: Terminal Output -> Scrollable Panel?

2005-07-02 Thread flamesrock
Thanks much for your response. I looked at PyCrust, and while its given me a few cool ideas, I may have described the problem incorrectly. What I really need is not something that takes input, but merely redirects the 'print' statements to something like a terminal window. Is this even possible

Re: A brief question.

2005-07-02 Thread Terry Reedy
"Nathan Pinno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Brief question for anyone who knows the answer, because I don't. > Is there anyway to make Python calculate square roots? Python can calculate any calculable function of the objects it has to work with. So the answer

Re: Modules for inclusion in standard library?

2005-07-02 Thread Terry Reedy
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Isn't this where the discussion should start? There should be some >general policy guiding the types of modules which should be in the >standard library. A couple of times, Guido has given his general policy as gen

Re: Inheriting from object

2005-07-02 Thread Scott David Daniels
Bengt Richter wrote: > On Thu, 30 Jun 2005 08:54:31 -0700, Scott David Daniels <[EMAIL PROTECTED]> > wrote: >>Or, perhaps: >>class foo(object): >>def __init__(self, *args, **kwargs): >>super(foo, self).__init__(self, *args, **kwargs) >>... >> > > Doesn't super(

Re: Bad Math

2005-07-02 Thread Brian van den Broek
Patrick Rutkowski said unto the world upon 02/07/2005 09:25: > On 7/2/05, Brian van den Broek <[EMAIL PROTECTED]> wrote: > >>Patrick Rutkowski said unto the world upon 02/07/2005 00:12: >> >>>That's... annoying, to say the least. And my number 4/5 was a rational >>>number too; I can understand how

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Walter Brunswick" <[EMAIL PROTECTED]> wrote: > Why not just update the local dictionary? > > class Grouping: > def __init__(self,x,y,z): > self.__dict__.update(locals()) That's pretty clever. The only minor annoyance is that it creates a self.self

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-02 Thread Ron Adam
Ralf W. Grosse-Kunstleve wrote: > class grouping: > > def __init__(self, .x, .y, .z): > # real code right here The way this would work seems a bit inconsistent to me. Args normally create local variables that receive references to the objects passed to them. In this c

Re: Inheriting from object

2005-07-02 Thread Peter Hansen
Bengt Richter wrote: > BTW, there's something about referring to type(self) by its not > always dependably bound (though usually global) name that bothers me. > > I wonder if the above common use of super could be implemented as a property > of object, > so you'd normally inherit it and be able t

Re: What are the other options against Zope?

2005-07-02 Thread Peter Hansen
Florian Lindner wrote: > Peter Hansen wrote: >>[Zope] doesn't include >>database interfaces other than to its own ZODB. > > That's not correct. Zope2 includes DB interfaces to MySQL, PostGre, ODBC and > many others. It actually *includes* them? I thought those were all add-in modules, not one

Re: Inheriting from object

2005-07-02 Thread Bengt Richter
On Thu, 30 Jun 2005 08:54:31 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Sion Arrowsmith wrote: >> ... And if you were to do so, surely: >> class foo(object): >> def __init__(self, *args, **kwargs): >> super(foo, self).__init__(self) >> >> would be the preferred way to go? >>

Re: email link and foreign accent

2005-07-02 Thread Peter Hansen
Vittorio wrote: > print"""mailto:%s";>""" %(campovalore.encode('iso-8859-1')) > print campovalore.encode('iso-8859-1') > print "" > > campovalore is an email address with special (italian) characters. > [snip] > Any suggestion is welcome, It might help if you showed us the output of "repr(x)

Re: A brief question.

2005-07-02 Thread Robert Kern
Nathan Pinno wrote: > > Hi all, > > Brief question for anyone who knows the answer, because I don't. Is > there anyway to make Python calculate square roots? http://docs.python.org/ There is a search facility. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-02 Thread Walter Brunswick
Why not just update the local dictionary? class Grouping: def __init__(self,x,y,z): self.__dict__.update(locals()) -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-07-02 Thread Bernhard Herzog
Scott David Daniels <[EMAIL PROTECTED]> writes: > Rocco Moretti wrote: >> Joseph Garvin wrote: >> >> I'm not aware of a language that allows it, but recently I've found >> myself wanting the ability to transparently replace objects >> I mainly look for it in the "object replaces self" form, bu

A brief question.

2005-07-02 Thread Nathan Pinno
Hi all,   Brief question for anyone who knows the answer, because I don't. Is there anyway to make Python calculate square roots?   Thanks, Nathan Pinnohttp://www.npinnowebsite.ca/ -- http://mail.python.org/mailman/listinfo/python-list

Re: What's wrong with this code?

2005-07-02 Thread Robert Kern
Nathan Pinno wrote: > Hi all, > > What's wrong with the following code? It says there is name error, that > random is not defined. How do I fix it? You need to import random. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allow

Re: What's wrong with this code?

2005-07-02 Thread Sébastien Boisgérault
Nathan Pinno a écrit : > Hi all, > > What's wrong with the following code? It says there is name error, that > random is not defined. How do I fix it? Add "import random" at the top of your file Cheers, SB > # Plays the guessing game higher or lower. > # Originally written by Josh Cogli

What's wrong with this code?

2005-07-02 Thread Nathan Pinno
Hi all, What's wrong with the following code? It says there is name error, that random is not defined. How do I fix it? # Plays the guessing game higher or lower. # Originally written by Josh Cogliati, improved first by Quique, then by Nathan Pinno. print "Higher or Lower" print nu

email link and foreign accent

2005-07-02 Thread Vittorio
Hi, I have one problem ( I am a python beginner) in a cgi: print"""mailto:%s";>""" %(campovalore.encode('iso-8859-1')) print campovalore.encode('iso-8859-1') print "" campovalore is an email address with special (italian) characters. >From IE6 everything is fine and the link launches my p

Re: Splitting string into dictionary

2005-07-02 Thread Christopher Subich
Robert Kern wrote: > David Pratt wrote: > >> I have string text with language text records that looks like this: >> >> 'en' | 'the brown cow' | 'fr' | 'la vache brun' > translations = [x.strip(" '") for x in line.split('|')] > d = dict(zip(translations[::2], translations[1::2])) One caevat is th

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

2005-07-02 Thread Mike Meyer
Jamey Cribbs <[EMAIL PROTECTED]> writes: > Code blocks allow you to wrap up any Ruby code and pass it to a method > and have it executed within that method. It is more powerful than > lambda, because you can have multiple statements in the code block and > you can do assignment within the code blo

Re: Which kid's beginners programming - Python or Forth?

2005-07-02 Thread André
Scanning quickly through the various response, I noticed that at least one person suggested rur-ple (rur-ple.sf.net), hence Python. I would second that ;-) ... but then, I am biased as the author of rur-ple! rur-ple is intended to be a complete learning environment for learning programming and P

Re: What are the other options against Zope?

2005-07-02 Thread phil
Peter Hansen wrote: > godwin wrote: > >> I wanna thank Martin for helping out with my ignorance concerning >>execution of stored procedure with python. Now i have decided to write >>a web app that googles into my companies proprietary database. >> > > Just checking... do you really mean "g

Re: Re:

2005-07-02 Thread Andreas Kostyrka
Am Samstag, den 02.07.2005, 15:11 +0100 schrieb Tom Anderson: > On Fri, 1 Jul 2005, Andreas Kostyrka wrote: > > > Am Freitag, den 01.07.2005, 08:25 -0700 schrieb George Sakkis: > > > >>> Again, how? Is there a way to force that an external user of my lib can > >>> not use my internal data/methods/

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

2005-07-02 Thread Jamey Cribbs
Tom Anderson wrote: > So, if you're a pythonista who loves map and lambda, and disagrees with > Guido, what's your background? Functional or not? I have no functional language background. Until recently, I had no use for programming "expression to be evaluated later" or "deferred expressions"

Re: What are the other options against Zope?

2005-07-02 Thread Florian Lindner
Peter Hansen wrote: > godwin wrote: >> I wanna thank Martin for helping out with my ignorance concerning >> execution of stored procedure with python. Now i have decided to write >> a web app that googles into my companies proprietary database. > > Just checking... do you really mean "googl

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-02 Thread Roy Smith
"Andrew Koenig" <[EMAIL PROTECTED]> wrote: > In Python, unlike many other languages, the names of formal parameters are > part of a function's interface. For example: > > def f(x, y): > return x-y > > Now f(3, 4) is -1 and f(y=3,x=4) is 1. > > The names of instance variables are gen

  1   2   >