[Tutor] loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Poor Yorick
In the following snippet, the loop in the global namespace takes twice as long as the loop in the function namespace. Why? limit = 5000 def f1(): counter = 0 while counter < limit: counter += 1 time1 = time.time() f1() print(time.time() - time

Re: [Tutor] opening a pipe?

2008-02-12 Thread Poor Yorick
> From: James Hartley <> > Subject: [Tutor] opening a pipe? > Sent: 2008-02-12 09:24 > > A Perl script can easily serve as a filter within a pipe as seen in > the following: > > use strict; > use warnings; > > open(IN, 'cat hello.txt |') or die 'unable to open file'; > while () { >

Re: [Tutor] reading random line from a file

2007-07-18 Thread Poor Yorick
> ---Original Message--- > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] reading random line from a file > Sent: 2007-07-18 10:19 > [SNIP] > > It probably doesn't matter, but this will pick longer lines more often > than short ones. > This method only keeps one

Re: [Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Poor Yorick
>return self.atts[name] >if self.parent: >return self.parent.lookup(name) >raise KeyError ># > > > Many thanks Danny. This example was an moment of epiphany for me, one that will pr

Re: [Tutor] Binary 2 text & text 2 binary

2005-09-24 Thread Poor Yorick
"0110", 'C' : "0111"} > strinput = 'ABBC' > result = [mydic[x] for x in strinput_process] > print result > You might also want to look at "Number to String in Arbirtrary Base" recipe: http://a

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-22 Thread Poor Yorick
people like what they download, they will come back and look for other things. In effect, your previous programs can advertise your newer programs. Exposure is valuable. -- Poor Yorick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] FW: Re: USB Capture Image WebCAM

2005-09-22 Thread Poor Yorick
You just admitted on a public forum to committing a crime. Not wise, friend. -- Poor Yorick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Editors (particualrly Vim)

2005-09-22 Thread Poor Yorick
f for proficiency is high. -- Poor Yorick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Python, vim, indentation, and wrapped lines

2005-09-21 Thread Poor Yorick
g indented html/xml documents. Anyone know how to do this in vim? -- Poor Yorick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How do you organize code snippets?

2005-09-18 Thread Poor Yorick
er, like Treepad. If you decide to get more complicated, you can use LEO as a templating tool to generate your resulting .py files from your snippets. -- Poor Yorick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Why won't it enter the quiz? (off topic)

2005-09-17 Thread Poor Yorick
browse http://www.benedict.com/ instead posting off-topic commentaries about people who turn to the list with questions. Bye, Poor Yorick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How do fix this error?

2005-09-16 Thread Poor Yorick
Nathan Pinno wrote: > guess = float(raw_input(a," + ",b," = ")) > TypeError: [raw_]input expected at most 1 arguments, got 4 > > guess = float(raw_input(a," + ",b," = ")) > return answer, guess > hint: how many ar

Re: [Tutor] Why won't it enter the quiz? (off topic)

2005-09-16 Thread Poor Yorick
on this list. Blow it out your hairdo... Bye, Poor Yorick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Reversing

2005-07-20 Thread Poor Yorick
Kevin Bixler wrote: > I was asked to make a program that reverses the text that a user would > input. I have tried what I thought would work which is > phrase.reverse(). phrase = the raw_input. Help! > Thank you, > Kevin Bixler Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel