Re: [Tutor] urgent help required! invalid syntax

2011-02-18 Thread Timo
On 18-02-11 09:42, lim chee siong wrote: > > > Hi, > > I was writing a module for the black-scholes pricing model in python, > but I keep getting this error message: > > Traceback (most recent call last): > File "", line 1, in > File "C:\Python26\lib\blackscholes.py", line 25 > d2=d1-v*sqrt(t) Tha

[Tutor] urgent help required! invalid syntax

2011-02-18 Thread lim chee siong
Hi, I was writing a module for the black-scholes pricing model in python, but I keep getting this error message: Traceback (most recent call last): File "", line 1, in File "C:\Python26\lib\blackscholes.py", line 25d2=d1-v*sqrt(t) This is the code in my blackscholes.py file:#Black

[Tutor] Odd behavior with eval, list comps, and name lookup

2011-02-18 Thread John
I noticed some odd behavior relating to eval(). First, a baseline case for behavior: >>> def test(): ... x = 5 ... return [a for a in range(10) if a == x] ... >>> test() [5] So far so good. Now let's try eval: >>> c = compile('[a for a in range(10) if a == x]', '', 'single') >>> eval(c, globals(

Re: [Tutor] regex questions

2011-02-18 Thread Albert-Jan Roskam
Hi Steven, Thanks a BUNCH for helping me! Yes, you were correct in assuming that my input data are already names. They're names in a column in a csv file. They're the names of GPs, in various formats. Besides the forms I've mentioned already there are examples such as 'Doctor's office Duh, J.

Re: [Tutor] urgent help required! invalid syntax

2011-02-18 Thread Steven D'Aprano
lim chee siong wrote: > > > Hi, > I was writing a module for the black-scholes pricing model in python, but I > keep getting this error message: > Traceback (most recent call last): File "", line 1, in File > "C:\Python26\lib\blackscholes.py", line 25d2=d1-v*sqrt(t) Please COPY A

Re: [Tutor] regex questions

2011-02-18 Thread Steven D'Aprano
Albert-Jan Roskam wrote: So the raw string \b means means "ASCII backspace". Is that another way of saying that it means 'Word boundary'? No. Python string literals use backslash escapes for special characters, similar to what many other computer languages, including C, do. So when you typ

Re: [Tutor] Odd behavior with eval, list comps, and name lookup

2011-02-18 Thread Peter Otten
John wrote: > I noticed some odd behavior relating to eval(). First, a baseline case for > behavior: > def test(): > ... x = 5 > ... return [a for a in range(10) if a == x] > ... test() > [5] > > So far so good. Now let's try eval: > c = compile('[a for a in range(10) if a == x]'

Re: [Tutor] urgent help required! invalid syntax

2011-02-18 Thread James Reynolds
There's a few things I've noticed: 1. I would recommend using an IDE of some sort. I copy and pasted this into eclipse, and it told me straight away that you had a parenthesis problem on this line: d1=(log(s/x)+((r+v**2/2)*t)/(v*sqrt(t)) 2. Your function "dividend" isn't returning a value. 3. Un