Re: Python without a tty

2011-09-30 Thread RJB
On Sep 29, 3:52 am, Steven D'Aprano wrote: > Alain Ketterlin wrote: > > Steven D'Aprano writes: > > >> I have a Python script which I would like to test without a tty attached > >> to the process. I could run it as a cron job, but is there an easier way? > > >> I am running Linux. > > > Isn't os.

Re: Faster Recursive Fibonacci Numbers

2011-05-18 Thread RJB
On May 17, 9:36 am, rusi wrote: > On May 17, 8:50 pm, RJB wrote: > > > > > > > I noticed some discussion of recursion. the trick is to find a > > formula where the arguments are divided, not decremented. > > I've had a "divide-and-conquer" r

Faster Recursive Fibonacci Numbers

2011-05-17 Thread RJB
elif n<=2: return 1 elif n%2==0: half=n//2 f1=fibo(half) f2=fibo(half-1) return f1*(f1+2*f2) else: nearhalf=(n-1)//2 f1=fibo(nearhalf+1) f2=fibo(nearhal

Re: Vectors

2011-04-20 Thread RJB
h module? > > > NumPy has array (and matrix) types with support for these basic > > operations you mention. See the tutorial athttp://numpy.scipy.org/ > > You might also want to considerhttp://code.google.com/p/pyeuclid/ > > Cheers, > > Drea Pyeuclid docs don

Re: Another related OO Python ?

2011-02-17 Thread RJB
On Feb 16, 6:21 am, Eric Brunel wrote: > In article > <6849fd3f-5116-4b35-b274-dc76ae39f...@a11g2000pro.googlegroups.com>, > > > > > >  RJB wrote: > > On Feb 16, 12:48 am, Eric Brunel > > wrote: > > > In article , > > >  Doug Epling

Re: Another related OO Python ?

2011-02-16 Thread RJB
On Feb 16, 12:48 am, Eric Brunel wrote: > In article , >  Doug Epling wrote: > > > hey, does anyone find the UML useful during Python development of larger > > projects? > > Well, UML being very Java/C++ oriented, I found out that Python idioms > were really difficult to represent in the diagrams

Re: Easy function, please help.

2011-02-09 Thread RJB
On Feb 8, 11:08 pm, Paul Rudin wrote: > It works because 0 tests false and because integer division yields > integers... eventually you'll get something like 1/10 giving 0. > > It's not necessarily a good thing to rely on. For example if you try it > after "from __future__ import division" - or i

Re: what's the precision of fractions.Fraction?

2010-11-19 Thread RJB
Does Fractions remove common factors the way it should? If it does and you want to find the closest fraction with a smaller denominator i think tou'll need some number theory and continued fractions. RJB On Nov 18, 8:26 pm, Steven D'Aprano wrote: > On Thu, 18 Nov 2010 20:08:00

Re: Raw Unicode docstring

2010-11-17 Thread RJB
On Nov 16, 1:56 pm, Boštjan Mejak wrote: > Hello, > > how does one write a raw unicode docstring? If I have backslashes in > the docstring, I must tuck an 'r' in front of it, like this: > r"""This is a raw docstring.""" > > If I have foreign letters in the docstring, I must tuck a 'u' in front > o

Re: Help Documenting Python Syntax

2010-11-10 Thread RJB
On Nov 9, 8:14 am, Grant Edwards wrote: > On 2010-11-09, Terry Reedy wrote: > > > On 11/9/2010 10:26 AM, RJB wrote: > >> I have been trying to redevelop a syntax page for Python at > >>      http://cse.csusb.edu/dick/samples/python.syntax.html > > > P

Help Documenting Python Syntax

2010-11-09 Thread RJB
I have been trying to redevelop a syntax page for Python at http://cse.csusb.edu/dick/samples/python.syntax.html I would appreciate and encouragement or corrections -- because I know there is at least one gross error in there. By the way, this is part of a suite of language definitions... go