Re: [Tutor] range function and floats?

2011-01-07 Thread Steven D'Aprano
Wayne Werner wrote: On Wed, Jan 5, 2011 at 4:59 PM, Steven D'Aprano wrote: Wayne Werner wrote: I never said rounding errors - I said "pesky floating point errors". When Which ARE rounding errors. They're *all* rounding errors, caused by the same fundamental issue -- the impossibility of r

Re: [Tutor] shlex.split if there is an apostrophe in the string?

2011-01-07 Thread Steven D'Aprano
Sean Carolan wrote: [...] YOU don't know about me without you have read a book by the name of The How can I get shlex.split to ignore single apostrophes such as the one above? >>> shlex.split("The Doctor's bow ties are cool, and Amy's uniform is hot.") ['The', 'Doctors bow ties are cool, an

Re: [Tutor] shlex.split if there is an apostrophe in the string?

2011-01-07 Thread Steven D'Aprano
Emile van Sebille wrote: On 1/7/2011 11:22 AM Sean Carolan said... I'm practicing manipulating data with a text file. I'm trying to use shlex.split to break up each line, Is there a reason not to use split directly? for line in fin: words = line.split() shlex.split was specifically writ

Re: [Tutor] vim as a python editor

2011-01-07 Thread Steven D'Aprano
Alan Gauld wrote: "Paul Griffiths" wrote I've learned that: ... - re-configuring the Caps Lock to be an extra Esc saves time Huh? How do you use that? Its a new one on me. Why would two escape keys be useful? What if you want to escape the escape, so that (say) esc-C is the same as just C

Re: [Tutor] Parse MPL files

2011-01-07 Thread Corey Richardson
On 01/07/2011 06:29 PM, PyProg PyProg wrote: > 2011/1/7 Corey Richardson : > > Hi, > > Thanks for your response. > >> A google search yields no results for one. If you know the structure of >> the MPL file, you can write your own parser. Look through the file with >> a hex editor like Bless firs

Re: [Tutor] Parse MPL files

2011-01-07 Thread Corey Richardson
On 01/07/2011 05:16 PM, PyProg PyProg wrote: > Hi all, > > I'm looking for a way to parse MPL files (.MPL or .mpl extension). > These files are contained in the tree of some cameras that support the > AVCHD ... and some cameras filming with a stream mpeg-ts. > > I know a person who seeks to reco

Re: [Tutor] vim as a python editor

2011-01-07 Thread ALAN GAULD
> > useful? > > I believe this is so you don't have to reach as far to hit ESC; caps > lock is located right next to the A key. Ah, that might make sense. I used to have a utility on my old Sun workstation to remap Caps lock to Ctrl because Ctrl was originally (on the first Sun's) where Ca[p

[Tutor] Parse MPL files

2011-01-07 Thread PyProg PyProg
Hi all, I'm looking for a way to parse MPL files (.MPL or .mpl extension). These files are contained in the tree of some cameras that support the AVCHD ... and some cameras filming with a stream mpeg-ts. I know a person who seeks to recover the data contained in these files. MPL (or .mpl). The da

Re: [Tutor] Tutor Digest, Vol 83, Issue 22

2011-01-07 Thread Paul Griffiths
Date: Fri, 7 Jan 2011 21:25:08 - > From: "Alan Gauld" > To: tutor@python.org > Subject: Re: [Tutor] vim as a python editor > Message-ID: > Content-Type: text/plain; format=flowed; charset="iso-8859-1"; >reply-type=original > > "Paul Griffiths" wrote > > > I've learned that: > > ...

Re: [Tutor] vim as a python editor

2011-01-07 Thread ashish makani
@Alan, maybe hitting the actual "Esc" key requires too much "reach" Mapping CapsLock to escape maybe lets u type faster, perhaps I am just guessing though..maybe Paul can explain On vim, just saw this on hnews today morning...might be of interest http://news.ycombinator.com/item?id=2080342

Re: [Tutor] vim as a python editor

2011-01-07 Thread Alan Gauld
"Paul Griffiths" wrote I've learned that: ... - re-configuring the Caps Lock to be an extra Esc saves time Huh? How do you use that? Its a new one on me. Why would two escape keys be useful? - I must learn how to 'fold' functions Read the vim help. Also read about ctags - they work wi

Re: [Tutor] Odd result from function call

2011-01-07 Thread Alan Gauld
"Ben Ganzfried" wrote x = input("First x is: ") y = input("First y is: ") input() reads strings compare(x,y) the character '1' is less than the character '5' so far as Python is concerned When I do simply compare(10, 5) from the shell, You are using integers. What happens if you u

Re: [Tutor] Odd result from function call

2011-01-07 Thread Alex Hall
Cast to an int: x=int(x) See if that helps. On 1/7/11, Ben Ganzfried wrote: > When I call one of my functions from the shell (ie compare(10, 5)) it > produces the correct output. However, when I run the program after calling > the method later in the script, the result is bizarre. I'm curious w

Re: [Tutor] Odd result from function call

2011-01-07 Thread Vince Spicer
On Fri, Jan 7, 2011 at 11:38 AM, Ben Ganzfried wrote: > When I call one of my functions from the shell (ie compare(10, 5)) it > produces the correct output. However, when I run the program after calling > the method later in the script, the result is bizarre. I'm curious why the > wrong result i

[Tutor] Odd result from function call

2011-01-07 Thread Ben Ganzfried
When I call one of my functions from the shell (ie compare(10, 5)) it produces the correct output. However, when I run the program after calling the method later in the script, the result is bizarre. I'm curious why the wrong result is printed. Here is an example: def compare(x,y): if x < y

Re: [Tutor] vim as a python editor

2011-01-07 Thread Paul Griffiths
On 5 January 2011 11:54, Sean Carolan wrote: > > How have those of you who use vim configured it? I have looked > > on the web but got a bit confused by the advice and options. > > My setup includes: > > autoindent turned on at 4 spaces > ftplugin for "folding" functions like eclipse (this is my

Re: [Tutor] shlex.split if there is an apostrophe in the string?

2011-01-07 Thread Emile van Sebille
On 1/7/2011 11:22 AM Sean Carolan said... I'm practicing manipulating data with a text file. I'm trying to use shlex.split to break up each line, Is there a reason not to use split directly? for line in fin: words = line.split() Emile which works great until it gets to the first apostro

Re: [Tutor] shlex.split if there is an apostrophe in the string?

2011-01-07 Thread Jason Staudenmayer
> -Original Message- > From: tutor-bounces+jasons=adventureaquarium@python.org > [mailto:tutor-bounces+jasons=adventureaquarium@python.org] > On Behalf Of Sean Carolan > Sent: Friday, January 07, 2011 2:22 PM > To: Tutor@python.org > Subject: [Tutor] shlex.split if there is an ap

[Tutor] shlex.split if there is an apostrophe in the string?

2011-01-07 Thread Sean Carolan
I'm practicing manipulating data with a text file. I'm trying to use shlex.split to break up each line, which works great until it gets to the first apostrophe: fin = open('huckfinn.txt') startstring = 'START OF THIS PROJECT' for line in fin: print line words = shlex.split(line) This is

Re: [Tutor] matplotlib.pylab.plotfile formatting help

2011-01-07 Thread Sean Carolan
> I can also advice you to try the matplotlib mailing list: people will there > will be much more knowledgeable wrt to matplotlib and pylab than on this > mailing list: > http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users Thanks for all the info; I managed to create a grap

Re: [Tutor] variabel from raw input into re.search?

2011-01-07 Thread Alan Gauld
"Tommy Kaas" wrote I try to write a program, where the user can write a word or a name and I will tell how many times the subject was mentioned in a text, I'm hosting. I guess it's possible but not this way it seems? The re is only searching for the word "name" and not the variable name

Re: [Tutor] variabel from raw input into re.search?

2011-01-07 Thread Tommy Kaas
You have 3 options, string concatenation, and two styles of formatting: >>> name = 'Sir Arthur' >>> '.*' + name + '.*' '.*Sir Arthur.*' >>> '.*%s.*' % (name, ) '.*Sir Arthur.*' >>> '.*{0}.*'.format(name) '.*Sir Arthur.*' >>> '.*{name}.*'.format(name=name) '.*Sir Arthur.*' The last t

Re: [Tutor] variabel from raw input into re.search?

2011-01-07 Thread Bill Felton
On Jan 7, 2011, at 7:47 AM, Tommy Kaas wrote: > I try to write a program, where the user can write a word or a name and I > will tell how many times the subject was mentioned in a text, I’m hosting. > I guess it’s possible but not this way it seems? > The re is only searching for the word “name”

Re: [Tutor] variabel from raw input into re.search?

2011-01-07 Thread Wayne Werner
On Fri, Jan 7, 2011 at 6:47 AM, Tommy Kaas wrote: > I try to write a program, where the user can write a word or a name and I > will tell how many times the subject was mentioned in a text, I’m hosting. > > I guess it’s possible but not this way it seems? > > The re is only searching for the word

Re: [Tutor] variabel from raw input into re.search?

2011-01-07 Thread Evert Rol
Hi Tommy, > I try to write a program, where the user can write a word or a name and I > will tell how many times the subject was mentioned in a text, I’m hosting. > I guess it’s possible but not this way it seems? > The re is only searching for the word “name” and not the variable name > I’m us

[Tutor] variabel from raw input into re.search?

2011-01-07 Thread Tommy Kaas
I try to write a program, where the user can write a word or a name and I will tell how many times the subject was mentioned in a text, I'm hosting. I guess it's possible but not this way it seems? The re is only searching for the word "name" and not the variable name I'm using Python 2.6.6. TI