On Tuesday, March 24, 2015 at 11:50:40 AM UTC+5:30, Rustom Mody wrote:
> On Tuesday, March 24, 2015 at 10:51:11 AM UTC+5:30, Ian wrote:
> > On Mon, Mar 23, 2015 at 4:53 PM, Terry Reedy wrote:
> > > Iteration with caching, using a mutable default arg to keep the cache
> > > private and the function
On Tuesday, March 24, 2015 at 10:51:11 AM UTC+5:30, Ian wrote:
> On Mon, Mar 23, 2015 at 4:53 PM, Terry Reedy wrote:
> > Iteration with caching, using a mutable default arg to keep the cache
> > private and the function self-contained. This should be faster.
> >
> > def fib(n, _cache=[0,1]):
> >
Hello,
Newly trying out programming, Python for Network Engineers, and loving it.
So I found paramiko for SSH, and now paramiko-expect for ssh expect like
behavior. I am using Python 3.4 and have been through a number of examples
of changing code to work in the 3.x environment. But is anyone u
On 03/23/2015 08:27 PM, Chris Angelico wrote:
On Tue, Mar 24, 2015 at 11:09 AM, Dave Angel wrote:
Repeat to self: comment first, then write test, then write the code.
Reply to self: Maybe next time.
Commenting is like dieting. You can always start tomorrow.
It reminds me of flow charts.
On Mon, Mar 23, 2015 at 4:53 PM, Terry Reedy wrote:
> Iteration with caching, using a mutable default arg to keep the cache
> private and the function self-contained. This should be faster.
>
> def fib(n, _cache=[0,1]):
> '''Return fibonacci(n).
>
> _cache is initialized with base values
On Tuesday, March 24, 2015 at 8:33:24 AM UTC+5:30, Chris Angelico wrote:
> Mathematics doesn't like defining sequences, except by defining
> functions, and so it has to convert the concept of "defining the
> Fibonacci sequence" into "defining a function F(N) which returns the
> Nth Fibonacci number
On Tuesday, March 24, 2015 at 8:33:24 AM UTC+5:30, Chris Angelico wrote:
> On Tue, Mar 24, 2015 at 12:52 PM, Steven D'Aprano wrote:
> > On Tue, 24 Mar 2015 11:59 am, Chris Angelico wrote:
> >
> >
> >> I've never thought of the mathematical definition as being inherently
> >> recursive; but as inher
On Tue, Mar 24, 2015 at 12:52 PM, Steven D'Aprano
wrote:
> On Tue, 24 Mar 2015 11:59 am, Chris Angelico wrote:
>
>
>> I've never thought of the mathematical definition as being inherently
>> recursive; but as inherently sequential. Sure, you can define counting
>> numbers based on sets (0 is the c
On Tuesday, March 24, 2015 at 7:22:25 AM UTC+5:30, Steven D'Aprano wrote:
> On Tue, 24 Mar 2015 11:59 am, Chris Angelico wrote:
>
>
> > I've never thought of the mathematical definition as being inherently
> > recursive; but as inherently sequential. Sure, you can define counting
> > numbers base
On Tue, 24 Mar 2015 11:59 am, Chris Angelico wrote:
> I've never thought of the mathematical definition as being inherently
> recursive; but as inherently sequential. Sure, you can define counting
> numbers based on sets (0 is the cardinality of the empty set, 1 is the
> cardinality of the set co
On 3/23/2015 7:12 PM, Dave Angel wrote:
On 03/23/2015 06:53 PM, Terry Reedy wrote:
Iteration with caching, using a mutable default arg to keep the cache
private and the function self-contained. This should be faster.
def fib(n, _cache=[0,1]):
'''Return fibonacci(n).
_cache is init
Given the standard recursive version of the Fibonacci series:
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
I asked:
> The question is, just how inefficient is is? How many calls to `fib` are
> made in calling fib(n)?
On Tue, Mar 24, 2015 at 11:19 AM, Steven D'Aprano
wrote:
> It is pretty inefficient, but it is a good toy example of recursion. It's
> also a good example of how *not* to write the Fibonacci series in practice,
> what is mathematically straightforward is not always computationally
> efficient.
>
>
On 03/23/2015 08:19 PM, Steven D'Aprano wrote:
On Tue, 24 Mar 2015 03:16 am, Chris Angelico wrote about the standard
recursive version of the Fibonacci series:
On Tue, Mar 24, 2015 at 3:01 AM, Ganesh Pal wrote:
def fib(n):
if n == 0:
return 0
elif n == 1:
return
On 3/23/2015 5:52 AM, Steven D'Aprano wrote:
Are there any other, possibly better, ways to calculate the fractional part
of a number?
float (("%6.3f" % x)[-4:])
Emile
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Mar 24, 2015 at 11:09 AM, Dave Angel wrote:
> Repeat to self: comment first, then write test, then write the code.
>
> Reply to self: Maybe next time.
Commenting is like dieting. You can always start tomorrow.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 24 Mar 2015 03:16 am, Chris Angelico wrote about the standard
recursive version of the Fibonacci series:
> On Tue, Mar 24, 2015 at 3:01 AM, Ganesh Pal wrote:
>> def fib(n):
>> if n == 0:
>> return 0
>> elif n == 1:
>> return 1
>> else:
>> return fib(n-
On Tue, 24 Mar 2015 03:01 am, Ganesh Pal wrote:
> Hello team ,
>
>
> [root@localhost Python]# cat fibonacci-Sequence-3.py
>
> ## Example 2: Using recursion
> def fib(n):
> if n == 0:
> return 0
> elif n == 1:
> return 1
> else:
> return fib(n-1) + fib(n-2)
>
On 03/23/2015 07:49 PM, Chris Angelico wrote:
On Tue, Mar 24, 2015 at 10:12 AM, Dave Angel wrote:
On the other hand, my loop makes some non-obvious assumptions, like that
append is always the right place to put a new value.
Yes, I had to stop and think about that one a bit. And that strongly
On Tue, Mar 24, 2015 at 10:12 AM, Dave Angel wrote:
> On the other hand, my loop makes some non-obvious assumptions, like that
> append is always the right place to put a new value.
Yes, I had to stop and think about that one a bit. And that strongly
suggests (to me, at least!) that it's comment-
On 03/23/2015 06:53 PM, Terry Reedy wrote:
On 3/23/2015 2:44 PM, Dave Angel wrote:
## Example 2: Using recursion with caching
cache = [0, 1]
def fib4(n):
if len(cache) <= n:
value = fib4(n-2) + fib4(n-1)
cache.append(value)
return cache[n]
This one takes less than a
On 3/23/2015 2:44 PM, Dave Angel wrote:
## Example 2: Using recursion with caching
cache = [0, 1]
def fib4(n):
if len(cache) <= n:
value = fib4(n-2) + fib4(n-1)
cache.append(value)
return cache[n]
This one takes less than a millisecond up to n=200 or so.
Iteration
On 03/23/2015 05:31 PM, Carsten Lechte wrote:
On 23/03/15 19:44, Dave Angel wrote:
I'll give you a worse version. Back in the day I had occasion to
write a simple program
in a language which had no add or subtract. It could only increment
and decrement
indices.
Oh yes, the olden days. I have
On 23/03/15 19:44, Dave Angel wrote:
I'll give you a worse version. Back in the day I had occasion to write a
simple program
in a language which had no add or subtract. It could only increment and
decrement
indices.
Oh yes, the olden days. I have not quite lived through the punch card era,
On Mon, Mar 23, 2015 at 12:44 PM, Dave Angel wrote:
> On 03/23/2015 12:16 PM, Chris Angelico wrote:
>> [1] Cue the demonstration of a worse version from someone's student?
>>
>
> I'll give you a worse version. Back in the day I had occasion to write a
> simple program in a language which had no a
On 03/23/2015 12:16 PM, Chris Angelico wrote:
On Tue, Mar 24, 2015 at 3:01 AM, Ganesh Pal wrote:
Hello team ,
[root@localhost Python]# cat fibonacci-Sequence-3.py
## Example 2: Using recursion
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
On Tuesday, March 24, 2015 at 1:00:11 AM UTC+8, Chris Angelico wrote:
> On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel wrote:
> > An entirely separate question is whether you can gain performance by caching
> > intermediate values. For example, if you capture values in a list, you
> > could potentia
This release includes the following improvements:
Support running and debugging pytest unit tests
Allow debugging Flask with auto-reload enabled
Keep matplotlib plots active in Debug Probe also when using MacOSX
backend
Ability to send NUL and EOF to the shells and debug I/O
On 03/23/2015 12:59 PM, Chris Angelico wrote:
On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel wrote:
An entirely separate question is whether you can gain performance by caching
intermediate values. For example, if you capture values in a list, you
could potentially save a lot of time, at least fo
Hi folks.
I want to build a pair of wheels - one for numpy, one for scipy. And
I want to statically link atlas (with blas and lapack) into these
wheels. I don't want to statically link numpy or scipy into the
Python interpreter.
The goal is to decrease the frequency with which new wheels need t
On Tue, Mar 24, 2015 at 3:57 AM, Grant Edwards wrote:
> On 2015-03-23, Tim Chase wrote:
>> On 2015-03-23 21:19, Chandra Prashad mishra wrote:
>>> I want to know hint about web development... can any one get me...
>>
>> Use your text editor and deploy your project to a web server.
>
> The most imp
On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel wrote:
> An entirely separate question is whether you can gain performance by caching
> intermediate values. For example, if you capture values in a list, you
> could potentially save a lot of time, at least for non-trivial values of n.
If you take a s
On 2015-03-23, Tim Chase wrote:
> On 2015-03-23 21:19, Chandra Prashad mishra wrote:
>> I want to know hint about web development... can any one get me...
>
> Use your text editor and deploy your project to a web server.
The most important hint is don't use PHP. PHP is some sort of cruel
practic
On Mon, Mar 23, 2015 at 7:19 AM, Chandra Prashad mishra
wrote:
> I want to know hint about web development... can any one get me...
Hint: use CSS to separate your HTML content from its presentation.
If you're looking for something more specific, you'll have to ask a
more specific question.
--
h
On Tue, Mar 24, 2015 at 3:01 AM, Ganesh Pal wrote:
> Hello team ,
>
>
> [root@localhost Python]# cat fibonacci-Sequence-3.py
>
> ## Example 2: Using recursion
> def fib(n):
> if n == 0:
> return 0
> elif n == 1:
> return 1
> else:
> return fib(n-1) + fib(n-2)
>
On 03/23/2015 12:01 PM, Ganesh Pal wrote:
Hello team ,
[root@localhost Python]# cat fibonacci-Sequence-3.py
## Example 2: Using recursion
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
print fib(5)
# python fi
Hello team ,
[root@localhost Python]# cat fibonacci-Sequence-3.py
## Example 2: Using recursion
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
print fib(5)
# python fibonacci-Sequence-3.py
5
what Iam I missing in the
On 2015-03-23 21:19, Chandra Prashad mishra wrote:
> I want to know hint about web development... can any one get me...
Use your text editor and deploy your project to a web server.
-tkc
(you'd need to provide a few more details about what you want to get
anything more detailed in response)
I want to know hint about web development... can any one get me...
--
https://mail.python.org/mailman/listinfo/python-list
On 23/03/2015 12:52, Steven D'Aprano wrote:
I have a numeric value, possibly a float, Decimal or (improper) Fraction,
and I want the fractional part. E.g. fract(2.5) should give 0.5.
Here are two ways to do it:
py> x = 2.5
py> x % 1
0.5
py> x - int(x)
0.5
x % 1 is significantly faster, but has
On Mon, Mar 23, 2015 at 7:52 AM, Steven D'Aprano
wrote:
> x % 1 is significantly faster, but has the disadvantage of giving the
> complement of the fraction if x is negative
I suppose
abs(x) % 1
would be just as slow as
x - int(x)
? (haven't checked)
Skip
--
https://mail.python.org/mailman/
I have a numeric value, possibly a float, Decimal or (improper) Fraction,
and I want the fractional part. E.g. fract(2.5) should give 0.5.
Here are two ways to do it:
py> x = 2.5
py> x % 1
0.5
py> x - int(x)
0.5
x % 1 is significantly faster, but has the disadvantage of giving the
complement of
On Mar 23, 2015, at 06:36, Steven D'Aprano wrote:
> http://www.keacher.com/1216/how-i-introduced-a-27-year-old-computer-to-the-
> web/
I saw it too, on Hacker News ;-) Awesome. I love(d) my Classic Mac but I
couldn't stand the slow network connection, I think.
Also, creative use of Flask and B
Now you can make modifications in Word file with AnyBizSoft pdf to excel for
Mac, you insert may also resize or delete images. After editing PDF text, if
you prefer to replace the modified pages towards the original PDF. You're
able to create PDF from Concept on Mac, and after that draganddrop the
--
On Sun, Mar 22, 2015 6:41 PM CET Emile van Sebille wrote:
>On 3/20/2015 10:55 AM, Grant Edwards wrote:
>
>> I need to automate operation of a Windows application.
>
>I've been productively using python to create macro scheduler [1] scripts to
>automate windows prog
45 matches
Mail list logo