On Wed, Apr 10, 2013 at 3:18 AM, wrote:
> sorry i just started using google groups, not really all that sure how to use
> it properly.
The best way to use Google Groups is to not use it, frankly. Just
subscribe to the mailing list in gmail; it has its own issues (eg it
encourages top-posting by
sorry i just started using google groups, not really all that sure how to use
it properly.
--
http://mail.python.org/mailman/listinfo/python-list
loop the entire program. When I insert a while loop it only loops the first
2 lines. Can someone provide a detailed beginner friendly explanation. Here is
my program. Also suddenly I'm getting an invalid syntax error next to my elif
statements when I wasn't a minute ago. What is wrong
On Wed, Apr 10, 2013 at 2:57 AM, wrote:
> I responded before I saw this message, this was very helpful so I appreciate
> your quick and helpful responses. So do you think prompting for a string and
> then checking if the string is true is a good practice for something like
> this? When would c
I responded before I saw this message, this was very helpful so I appreciate
your quick and helpful responses. So do you think prompting for a string and
then checking if the string is true is a good practice for something like this?
When would checking for true/false be necessary?
--
http://ma
So what would be the proper way to perform a loop of this program. I still
can't quite figure out the best way to do it.
--
http://mail.python.org/mailman/listinfo/python-list
;, but that's optional.
> Also what confuses me is that python doesn't use brackets. How do I contain
> all of my if/else statements into one while loop? Do I have to indent each
> line of code and extra indentation? I'm used to highschool doing c++ and java
> when I woul
;true" then the loop would continue but i
> imagine there is a better way then matching strings and integers like i
> have been.
>
> Also what confuses me is that python doesn't use brackets. How do I
> contain all of my if/else statements into one while loop? Do I have to
>
ke i have been.
Also what confuses me is that python doesn't use brackets. How do I contain all
of my if/else statements into one while loop? Do I have to indent each line of
code and extra indentation? I'm used to highschool doing c++ and java when I
would just say:
whi
On Wed, Apr 10, 2013 at 1:47 AM, wrote:
> ... I'm not sure what version I'm using ...
Try putting these lines into a Python script:
import sys
print(sys.version)
That, on any version of Python (back a fairly long way, Steven
D'Aprano can probably say how far), will give you a line or so of
out
On Tue, Apr 9, 2013 at 11:47 AM, wrote:
> Sorry I'm just starting to learn python and I'm not sure what version I'm
> using to be quite honest. I just started typing it up in Komodo edit (Which
> I'm not personally a fan in particular) I fixed the missing parenthesis
> which fixed the invalid syn
Sorry I'm just starting to learn python and I'm not sure what version I'm using
to be quite honest. I just started typing it up in Komodo edit (Which I'm not
personally a fan in particular) I fixed the missing parenthesis which fixed the
invalid syntax problem. Also, I apologize for submitting c
On Tue, Apr 9, 2013 at 11:58 PM, wrote:
> Also I'm getting a invalid syntax next to my elif statements that i wasnt
> getting before. why is this happening now?
Ah! That's relating to the close parenthesis problem I mentioned.
That's the exact issue I saw.
When you get told about a problem, so
On Tue, Apr 9, 2013 at 11:32 PM, wrote:
> I'm new to learning python and creating a basic program to convert units of
> measurement which I will eventually expand upon but im trying to figure out
> how to loop the entire program. When I insert a while loop it only loops the
&
Also I'm getting a invalid syntax next to my elif statements that i wasnt
getting before. why is this happening now?
--
http://mail.python.org/mailman/listinfo/python-list
On Tuesday, April 9, 2013 9:32:18 AM UTC-4, thomasa...@gmail.com wrote:
> I'm new to learning python and creating a basic program to convert units of
> measurement which I will eventually expand upon but im trying to figure out
> how to loop the entire program. When I insert a whil
I'm new to learning python and creating a basic program to convert units of
measurement which I will eventually expand upon but im trying to figure out how
to loop the entire program. When I insert a while loop it only loops the first
2 lines. Can someone provide a detailed beginner fri
Am 01.03.2013 17:28, schrieb Isaac Won:
What I really want to get from this code is m1 as I told. For this
purpose, for instance, values of fpsd upto second loop and that from
third loop should be same, but they are not. Actually it is my main
question.
You are not helping yourself...
In any
Thank you Ulich for reply,
What I really want to get from this code is m1 as I told. For this purpose, for
instance, values of fpsd upto second loop and that from third loop should be
same, but they are not. Actually it is my main question.
Thank you,
Isaac
On Friday, March 1, 2013 6:00:42 AM UTC
On Friday, March 1, 2013 7:41:05 AM UTC-6, Chris Angelico wrote:
> On Fri, Mar 1, 2013 at 7:59 PM, Isaac Won wrote:
>
> > while c <24:
>
> > for columns in ( raw.strip().split() for raw in f ):
>
> > while d <335:
>
>
>
> Note your indentation levels: the code does not agree
Thank you, Chris.
I just want to acculate value from y repeatedly.
If y = 1,2,3...10, just have a [1,2,3...10] at onece.
On Friday, March 1, 2013 7:41:05 AM UTC-6, Chris Angelico wrote:
> On Fri, Mar 1, 2013 at 7:59 PM, Isaac Won wrote:
>
> > while c <24:
>
> > for columns in ( raw.strip
On Fri, Mar 1, 2013 at 7:59 PM, Isaac Won wrote:
> while c <24:
> for columns in ( raw.strip().split() for raw in f ):
> while d <335:
Note your indentation levels: the code does not agree with your
subject line. The third loop is not actually inside your second.
Should it be?
Ch
On Fri, Mar 1, 2013 at 7:00 AM, Ulrich Eckhardt <
ulrich.eckha...@dominolaser.com> wrote:
> Am 01.03.2013 09:59, schrieb Isaac Won:
>
> try to make my triple nested loop working. My code would be:
>> c = 4
>>
> [...]
>
> while c <24:
>> c = c + 1
>>
>
> This is bad style and you shouldn
Am 01.03.2013 09:59, schrieb Isaac Won:
try to make my triple nested loop working. My code would be:
c = 4
[...]
while c <24:
c = c + 1
This is bad style and you shouldn't do that in python. The question that
comes up for me is whether something else is modifying "c" in that loop,
1 = m1 + [m]
print m1
My purpose is make a list of [mean(fpsd[0]), mean(fpsd[1]), mean(fpsd[2])..
mean(fpsd[335])]. Each y1 would be the list of fpsd[d].
I check it is working pretty well before second while loop and I can get
indi
hd for Mac
OS X, and Cron for other *nixes).
> On Wed, Apr 4, 2012 at 2:25 PM, John O'Hagan
> wrote:
>>
>> On Tue, 3 Apr 2012 23:00:22 +0200
>> Anatoli Hristov wrote:
>>
>> > On 03 Apr 2012, at 22:45, Ian Kelly wrote:
>> >
>> > > O
; On Tue, 3 Apr 2012 23:00:22 +0200
> Anatoli Hristov wrote:
>
> > On 03 Apr 2012, at 22:45, Ian Kelly wrote:
> >
> > > On Tue, Apr 3, 2012 at 2:36 PM, Anatoli Hristov
> wrote:
> > >> Hi,
> > >>
> > >> I'm trying to do a while
On Tue, 3 Apr 2012 23:00:22 +0200
Anatoli Hristov wrote:
> On 03 Apr 2012, at 22:45, Ian Kelly wrote:
>
> > On Tue, Apr 3, 2012 at 2:36 PM, Anatoli Hristov wrote:
> >> Hi,
> >>
> >> I'm trying to do a while loop with condition of time if time i
On Tue, Apr 3, 2012 at 3:00 PM, Anatoli Hristov wrote:
> On 03 Apr 2012, at 22:45, Ian Kelly wrote:
>
>> On Tue, Apr 3, 2012 at 2:36 PM, Anatoli Hristov wrote:
>>> Hi,
>>>
>>> I'm trying to do a while loop with condition of time if time is
>>
On 03 Apr 2012, at 22:45, Ian Kelly wrote:
> On Tue, Apr 3, 2012 at 2:36 PM, Anatoli Hristov wrote:
>> Hi,
>>
>> I'm trying to do a while loop with condition of time if time is
>> 12:00:00 print text, but for this one second the text is printed at
>> lea
On Tue, Apr 3, 2012 at 2:36 PM, Anatoli Hristov wrote:
> Hi,
>
> I'm trying to do a while loop with condition of time if time is
> 12:00:00 print text, but for this one second the text is printed at
> least 50 times, how can I print only once?
Set a flag when you print the t
Hi,
I'm trying to do a while loop with condition of time if time is
12:00:00 print text, but for this one second the text is printed at
least 50 times, how can I print only once?
Thank
Anatoli
--
http://mail.python.org/mailman/listinfo/python-list
elopment?
> (Octavian Rasnita)
> 3. Re: Why did Quora choose Python for its development?
> (Chris Angelico)
> 4. NEED HELP- read file contents, while loop to accept user
> input, andenter to exit (Cathy James)
> 5. Re: NEED HELP- read file contents, whil
Cathy James wrote:
f = open ('c:/testing.txt'', 'r')
replace the double quote by a single quote.
JM
--
http://mail.python.org/mailman/listinfo/python-list
27;', 'r')
> f.readlines()
> #2) and 3) use while loop to write user input to file, save to file, close
> when press enter:
> while True:
> s = input ('enter name: ').strip()
> f = open ('c:/testing.txt', 'a')
> if f.w
On Tue, May 24, 2011 at 6:31 PM, Cathy James wrote:
> s = input ('enter name: ').strip()
Are you using Python 2 or Python 3? If it's Python 2, this should be
raw_input().
> f = open ('c:/testing.txt', 'a')
> ...
> f = open ('c:/testing.txt', 'r')
You may be having trouble here a
On 24/05/2011 09:31, Cathy James wrote:
dear mentor,
I need help with my code:
1) my program won't display file contents upon opening
#1) open file and display current file contents:
f = open ('c:/testing.txt'', 'r')
f.readlines()
If you're running this in an interactive interpreter, I would
dear mentor,
I need help with my code:
1) my program won't display file contents upon opening
2) my program is not writing to file
3) my program is not closing when user presses enter- gow do I do this with
a while loop?
please see my attempt below and help:
#1) open file and display cu
Dear Stephen,
Thanks for telling me this all looked very peculiar. As you said, it did not
really need solving.
Cheers,
Dwayne
2011/2/4 Stephen Hansen
> On 2/4/11 9:16 AM, Dwayne Blind wrote:
> > @ Stephen Hansen
> > Now I am pretty much worried. :'(
>
> Why? This is all sounding like a probl
On 2/4/11 9:16 AM, Dwayne Blind wrote:
> @ Stephen Hansen
> Now I am pretty much worried. :'(
Why? This is all sounding like a problem that isn't actually a problem.
I think you may have over-analyzed yourself into a corner and think you
have something to solve which doesn't really need solving.
e requested number of bytes but
> the network layer has every possibility of just giving you partial
> responses.
>
> So the network layer should just gather up the data as it arrives,
> buffer it -- and pass it off to the game logic layer as each line is
> complete (i.e., as \r\n
as every possibility of just giving you partial
responses.
So the network layer should just gather up the data as it arrives,
buffer it -- and pass it off to the game logic layer as each line is
complete (i.e., as \r\n or \n's are received). But there's no reason at
all to do a while lo
Dwayne Blind wrote:
Thanks to all of you.
@ Jean-Michel Pichavant
I am writing a small multiplayer game. Several clients are connected
to the server. Games last, say, 20 seconds.
You can think of the game as a small chat lasting 20 seconds. All the
data received by the server is sent back to
AM, Dwayne Blind wrote:
>>
>>
>>> However I would like to set timeout on the socket rcv method, so that
>>> the while loop stops exactly after 3 seconds. Is this possible ?
>>>
>>>
>>
>> I rarely do low-level socket stuff -- [snip]
>&g
Stephen Hansen wrote:
On 2/3/11 9:56 AM, Dwayne Blind wrote:
However I would like to set timeout on the socket rcv method, so that
the while loop stops exactly after 3 seconds. Is this possible ?
I rarely do low-level socket stuff -- [snip]
Good point. Python has a module for
On 01/-10/-28163 02:59 PM, Dwayne Blind wrote:
or rather
timeout = s.gettimeout()
b=time.clock()
while time.clock()-b<3 :
s.settimeout(3-time.clock()+b)
try :
data=s.recv(1024)
except :
break
s.settimeout(t
meout ?
> s.settimeout(3) # I guess this is a 3 second timeout
> s.recv(1024)
> s.settimeout(timeout) # You change it back ?
Yes.
> So with a while loop, it should be :
I don't understand why you're doing this while loop business. Your
original question is ask
ments :
>>
>> timeout = s.gettimeout()# Is that the default timeout ?
>> s.settimeout(3) # I guess this is a 3 second timeout
>> s.recv(1024)
>> s.settimeout(timeout) # You change it back ?
>>
>> So with a while loop, it should b
is a 3 second timeout
> s.recv(1024)
> s.settimeout(timeout) # You change it back ?
>
> So with a while loop, it should be :
>
>
> timeout = s.gettimeout()
> s.settimeout(3)
> b=time.clock()
> while time.clock()-b<3 :
>
>
(1024)
s.settimeout(timeout) # You change it back ?
So with a while loop, it should be :
timeout = s.gettimeout()
s.settimeout(3)
b=time.clock()
while time.clock()-b<3 :
data=s.recv(1024)
s.settimeout(timeout)
Am I right ?
Thanks again,
Dwayne
2011/2/3
On 2/3/11 10:13 AM, Dwayne Blind wrote:
> Thanks for your answer. I don't want to reset my socket. I want to apply
> the timeout to the rcv method only.
Setting the timeout does not "reset [your] socket", I don't think. And I
get that you want to only timeout recv... that's why I pointed out its a
ne Blind wrote:
> > However I would like to set timeout on the socket rcv method, so that
> > the while loop stops exactly after 3 seconds. Is this possible ?
>
> I rarely do low-level socket stuff -- but I think s.settimeout() is what
> you're looking for. It applies to
On 2/3/11 9:56 AM, Dwayne Blind wrote:
> However I would like to set timeout on the socket rcv method, so that
> the while loop stops exactly after 3 seconds. Is this possible ?
I rarely do low-level socket stuff -- but I think s.settimeout() is what
you're looking for. It applies t
Hi everybody,
I am using Python 3.0.
I have such a code :
b=time.clock()
while time.clock()-b<3 :
data=s.recv(1024)
However I would like to set timeout on the socket rcv method, so that the
while loop stops exactly after 3 seconds. Is this possible ?
Thanks a lot,
Dwayne
--
h
Nobody writes:
> On Mon, 11 Oct 2010 05:42:39 -0700, Ethan Furman wrote:
>
If I'm catching exceptions in order to perform clean-up, I'll use a bare
except and re-raise the exception afterwards. In that situation, a bare
except is usually the right thing to do.
>>>
>>> Wrong way to do
On Mon, 11 Oct 2010 05:42:39 -0700, Ethan Furman wrote:
>>>If I'm catching exceptions in order to perform clean-up, I'll use a bare
>>>except and re-raise the exception afterwards. In that situation, a bare
>>>except is usually the right thing to do.
>>
>> Wrong way to do it.
>
> What, then, is
Lawrence D'Oliveiro wrote:
In message , Nobody wrote:
If I'm catching exceptions in order to perform clean-up, I'll use a bare
except and re-raise the exception afterwards. In that situation, a bare
except is usually the right thing to do.
Wrong way to do it.
What, then, is the right way to
Steven D'Aprano wrote:
> On Tue, 05 Oct 2010 13:57:11 +1100, Ben Finney wrote:
>
>> chad writes:
>>
>>> while 1:
>>
>> A minor point: this is more explanatory and less misleading if you write
>> it as ‘while True’.
>
> Why is it misleading? Is there some circumstance in Python where the
> lit
In message , Nobody wrote:
> If I'm catching exceptions in order to perform clean-up, I'll use a bare
> except and re-raise the exception afterwards. In that situation, a bare
> except is usually the right thing to do.
Wrong way to do it.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 05 Oct 2010 13:57:11 +1100, Ben Finney wrote:
> Here's your problem. Don't ever use a bare ‘except’ unless you know
> exactly why you're doing so. Rather, figure out what exception types you
> want to catch, and catch *only* those types.
If I use a bare except, I usually have a good reaso
On Tue, 05 Oct 2010 11:13:53 +0800, Von wrote:
> Try to use sys.exit(0)
> Maybe you should print out the error in your except block.
Not exiting with a status-code of 0 is no more helpful than not exiting
with a status-code of 1.
It's actually *less* helpful, if the intention is actually to exi
In message , Seebs wrote:
> On 2010-10-05, Lawrence D'Oliveiro
> wrote:
>
>> In message <87iq1hz6rc@benfinney.id.au>, Ben Finney wrote:
>>
>>> Don't ever use a bare ‘except’ unless you know exactly why you're doing
>>> so.
>>
>> In other news, don’t ever put a loaded gun in your mouth and pul
On 2010-10-05, Lawrence D'Oliveiro wrote:
> In message <87iq1hz6rc@benfinney.id.au>, Ben Finney wrote:
>> Don't ever use a bare ???except??? unless you know exactly why you're doing
>> so.
> In other news, don???t ever put a loaded gun in your mouth and pull the
> trigger unless you know exa
In message <87iq1hz6rc@benfinney.id.au>, Ben Finney wrote:
> Don't ever use a bare ‘except’ unless you know exactly why you're doing
> so.
In other news, don’t ever put a loaded gun in your mouth and pull the
trigger unless you know exactly why you’re doing so.
Some people have a problem. T
Steven D'Aprano writes:
> Why is it misleading? Is there some circumstance in Python where the
> literal 1 could have a false value?
It's misleading as to the intent.
> "while 1" was the accepted idiom for infinite loops in Python for many
> years, before the introduction of bools in (I think
On Tue, 05 Oct 2010 13:57:11 +1100, Ben Finney wrote:
> chad writes:
>
>> while 1:
>
> A minor point: this is more explanatory and less misleading if you write
> it as ‘while True’.
Why is it misleading? Is there some circumstance in Python where the
literal 1 could have a false value?
"whil
ttp://www.google.com";)
> data = con.read()
> print "connected"
> #The loop doesn't exit if I use sys.exit(1)
> break
> except:
> time.sleep(2)
>
>
> If I would replace 'break' with 'sys.exit(1)'
On 10/4/2010 10:38 PM, chad wrote:
Given the following..
#!/usr/bin/python
import urllib2
import sys
import time
while 1:
try:
con = urllib2.urlopen("http://www.google.com";)
data = con.read()
print "connected"
#The loop doesn't exit if I use sys.exit(1
ime.sleep(2)
>
> If I would replace 'break' with 'sys.exit(1)', the while loop will
> keep printing connected every 2 seconds? Why I this?> I thought exit
> meant exit.
Have a read of the documentation for ‘sys.exit’ to see how it exits;
you'll then see h
your bare except is catching the SystemExit raised by sys.exit(1)
--
http://mail.python.org/mailman/listinfo/python-list
break
except:
time.sleep(2)
If I would replace 'break' with 'sys.exit(1)', the while loop will
keep printing connected every 2 seconds? Why I this? I thought exit
meant exit.
--
http://mail.python.org/mailman/listinfo/python-list
Ulrich Eckhardt wrote:
so why not:
while as :
...
and also:
if as :
...
This sort of thing has been suggested repeatedly in the
past, and it's always been rejected. That's not likely to
change. Look up the past threads for the reasons why.
--
Greg
--
http://mail.python.or
Peter Otten wrote:
> Duncan Booth wrote:
>> for rq in incoming_requests(...):
>>handle_request(rq)
>
> ...and a likely implementation would be
>
> def incoming_requests(...):
> while True:
> rq = ... # inlined version of get_request()
> if not rq:
> break
>
Duncan Booth wrote:
> Peter Otten <__pete...@web.de> wrote:
>
>> Ulrich Eckhardt wrote:
>>
>>> I'm looking for a way to write code similar to this C code:
>>>
>>> while(rq = get_request(..)) {
>>> handle_request(rq);
>>> }
>>>
>> Assuming get_request(...) is called with the same argum
Peter Otten <__pete...@web.de> wrote:
> Ulrich Eckhardt wrote:
>
>> I'm looking for a way to write code similar to this C code:
>>
>> while(rq = get_request(..)) {
>> handle_request(rq);
>> }
>>
> Assuming get_request(...) is called with the same arguments on each
> iteration and uses
Ulrich Eckhardt wrote:
> I'm looking for a way to write code similar to this C code:
>
> while(rq = get_request(..)) {
> handle_request(rq);
> }
>
> Currently I'm doing
>
> while True:
> rq = get_request(...)
> if not rq:
> break
> handle_request(rq)
>
>
Ulrich Eckhardt wrote:
> Hi!
>
> I'm looking for a way to write code similar to this C code:
>
> while(rq = get_request(..)) {
> handle_request(rq);
> }
>
> Currently I'm doing
>
> while True:
> rq = get_request(...)
> if not rq:
> break
> handle_request(rq)
Hi!
I'm looking for a way to write code similar to this C code:
while(rq = get_request(..)) {
handle_request(rq);
}
Currently I'm doing
while True:
rq = get_request(...)
if not rq:
break
handle_request(rq)
in Python 2.6. Any suggestions how to rewrite tha
On 1/23/2010 9:44 AM, Roald de Vries wrote:
Dear all,
I sometimes want to use an infinite while loop with access to the loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i)
I assume a function like 'naturals' already exists, or
On Jan 23, 2010, at 3:58 PM, Mark Dickinson wrote:
On Jan 23, 2:44 pm, Roald de Vries wrote:
I assume a function like 'naturals' already exists, or a similar
construction for the same purpose. But what is it called?
itertools.count()
On Jan 23, 2010, at 4:04 PM, Jan Kaliszewski wrote:
On Jan 23, 2010, at 3:49 PM, Diez B. Roggisch wrote:
Am 23.01.10 15:44, schrieb Roald de Vries:
Dear all,
I sometimes want to use an infinite while loop with access to the
loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i)
I assume a
On Jan 23, 2010, at 3:50 PM, Grant Edwards wrote:
On 2010-01-23, Roald de Vries wrote:
Dear all,
I sometimes want to use an infinite while loop with access to the
loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i
23-01-2010 o 15:49:23 Diez B. Roggisch wrote:
Am 23.01.10 15:44, schrieb Roald de Vries:
Dear all,
I sometimes want to use an infinite while loop with access to the loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i)
I assume a function
On Jan 23, 2:44 pm, Roald de Vries wrote:
> I assume a function like 'naturals' already exists, or a similar
> construction for the same purpose. But what is it called?
itertools.count()
--
Mark
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-01-23, Roald de Vries wrote:
> Dear all,
>
> I sometimes want to use an infinite while loop with access to the loop
> index, like this:
>
> def naturals():
> i = 0
> while True:
> yield i
> y += 1
>
> for i in naturals():
>
Am 23.01.10 15:44, schrieb Roald de Vries:
Dear all,
I sometimes want to use an infinite while loop with access to the loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i)
I assume a function like 'naturals' already exists, or
Dear all,
I sometimes want to use an infinite while loop with access to the loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i)
I assume a function like 'naturals' already exists, or a similar
construction fo
"S. Chris Colbert" wrote:
>
>What a newbie mistake for me to make.
Don't feel too badly about it. Even very experienced programmers get
bitten by this issue. Until someone points it out, it's certainly not
obvious.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
--
http://mail.p
What a newbie mistake for me to make.
I appreciate the replies everyone!
Cheers,
Chris
> On Fri, 27 Nov 2009 17:06:44 +0100, S. Chris Colbert wrote:
> > I would think that second loop should terminate at 9.9, no?
> >
> > I am missing something fundamental?
>
> "What Every Computer Scientist Sh
On Fri, 27 Nov 2009 17:06:44 +0100, S. Chris Colbert wrote:
> I would think that second loop should terminate at 9.9, no?
>
> I am missing something fundamental?
"What Every Computer Scientist Should Know About Floating Point"
http://docs.sun.com/source/806-3568/ncg_goldberg.html
--
Steven
S. Chris Colbert wrote:
> In [15]: t = 0.
>
> In [16]: time = 10.
>
> In [17]: while t < time:
>: print t
>: t += 0.1
>:
>:
> 0.0
> 0.1
> 0.2
> 0.3
On Fri, 2009-11-27 at 17:06 +0100, S. Chris Colbert wrote:
> This seems strange to me, but perhaps I am just missing something:
> I would think that second loop should terminate at 9.9, no?
>
> I am missing something fundamental?
Floating points variables ...
http://en.wikipedia.org/wiki/Floati
"S. Chris Colbert" writes:
>: print t
Try replacing with: print "%0.20f" % t
The thing you're missing is that floating point arithmetic isn't (in
general) exact - but when it's printed it's rounded.
--
http://mail.python.org/mailman/listinfo/python-list
S. Chris Colbert schrieb:
This seems strange to me, but perhaps I am just missing something:
In [12]: t = 0.
In [13]: time = 10.
In [14]: while t < time:
: print t
: t += 1.
:
:
0.0
1.0
This seems strange to me, but perhaps I am just missing something:
In [12]: t = 0.
In [13]: time = 10.
In [14]: while t < time:
: print t
: t += 1.
:
:
0.0
1.0
2.0
During some random surfing I became interested in the below piece of code:
> while :
>
> and while :
>
> and while :
>
> else:
It strikes me that the 'and while' syntax has some power that you may
not have considered. Consider that if an 'an
Fab86 writes:
> On Mar 5, 5:23 pm, Marco Mariani wrote:
>> Fab86 wrote:
>> > Is it possible to get the program to catch the exception, wait 10
>> > seconds, then carry of from where it was rather than starting again?
>>
>> something like this? probably works in PASCAL as well :)
>>
>> > i=0
>> >
On Mar 5, 5:49 pm, Fab86 wrote:
> On Mar 5, 5:23 pm, Marco Mariani wrote:
>
>
>
> > Fab86 wrote:
> > > Is it possible to get the program to catch the exception, wait 10
> > > seconds, then carry of from where it was rather than starting again?
>
> > something like this? probably works in PASCAL a
t; i = i + 1
>
> except SearchError:
>
> (I currently close then reopen document here then restart i to 0)
>
> Any ideas?
You need to narrow the `try` and put it inside another while-loop:
while i<200:
for domain in domains:
srch.qu
On Thu, Mar 5, 2009 at 6:49 PM, Fab86 wrote:
> On Mar 5, 5:23 pm, Marco Mariani wrote:
>> Fab86 wrote:
>> > Is it possible to get the program to catch the exception, wait 10
>> > seconds, then carry of from where it was rather than starting again?
>>
>> something like this? probably works in PASC
201 - 300 of 396 matches
Mail list logo