I am trying to solve project euler problem 18 with brute force(I will
move on to a better solution after I have done that for problem 67).
http://projecteuler.net/index.php?section=problems&id=18
However I can't get the recursive function right.
I always have to use return right? Unless I am prin
If an OS was to be written in Python and the hardware optimized for
it, what changes would be made to the hardware to accomodate Python
strenghs and weaknesses?
Some tagged architecture like in Lisp machines?
http://en.wikipedia.org/wiki/Tagged_architecture
What else?
--
http://mail.python.org/ma
On Oct 6, 8:13 am, Aidan <[EMAIL PROTECTED]> wrote:
> process wrote:
> > I am trying to solve project euler problem 18 with brute force(I will
> > move on to a better solution after I have done that for problem 67).
> >http://projecteuler.net/index.php?section=problems&
trying to install PyKF-0.1 (Kalman Filters)
http://pykf.sourceforge.net/
I have Numpy, Scipy, Matplotlib installed an have successfully
installed other packages using them.
$ setup.py
Traceback (most recent call last):
File "./setup.py", line 2, in
from scipy_distutils.core import setup
IndexError:
> > break
> > colors.append(row)
> > return numpy.array(colors)
>
> and it appears that you haven't bothered to read the manual section on
> Image.getpixel:
> """
> Note that this method is rather slow;
is this faster btw? I guess big doesn't help, it's only retrieved once
anyway? But is rows retrieved in every loop? the python interpreter
aint too smart?
def getPixels(fileName):
im = PIL.Image.open(fileName)
colors = []
r, c = im.size
big = range(0, c)
rows = range(0, r)
qsort can handle bigger lists it seems, making less recursive calls
before finishing(quicksort blows the stack when sorting
range(100,-1000,-1).
qsort does more work though right? is there a way to speed up that?
is the built-in sort not defined recursively?
def quicksort(lista):
if len(lista
On Sep 10, 12:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> process wrote:
> > qsort can handle bigger lists it seems, making less recursive calls
> > before finishing(quicksort blows the stack when sorting
> > range(100,-1000,-1).
> > qsort does more work thou
Python uses arrays for lists right?
def quicksort(lista):
if lista == []:
lista
else:
return quicksort([x for x in lista[1:] if x < lista[0]]) +
[lista[0]] + \
quicksort([x for x in lista[1:] if x >= lista[0]])
or
def quicksort(lista):
if len(lista) ==
ok but if len is O(1) then it doesnt matter? compared to
if not lista:
return []
i mean.
--
http://mail.python.org/mailman/listinfo/python-list
In erlang you can cons like this: [1|2]. i tried this in python and it
didnt raise an error but i dont know what the result do
>>> [1|2]
[3]
>>> [2|2]
[2]
>>> a = [2|2]
>>> a
[2]
>>> [2|3]
[3]
>>> [2|1]
[3]
>>>
--
http://mail.python.org/mailman/listinfo/python-list
Why doesn't Python optimize tailcalls? Are there plans for it?
I know GvR dislikes some of the functional additions like reduce and
Python is supposedly about "one preferrable way of doing things" but
not being able to use recursion properly is just a big pain in the
a**.
--
http://mail.python.or
Anyone using Pyflix for the Netflix prize.
How can it call super to itself in its init-method?
-
#!/usr/bin/env python
'''Sample baseline averaging algorithms.'''
import numpy as N
from pyflix.algorithms import Algorithm
class MovieAverage(Algorithm):
'''Baseline
' '.join([`x * x` for x in range(1, 6)])
exactly what does this symbol do and what does it stand for?
--
http://mail.python.org/mailman/listinfo/python-list
I have heard some criticism about Python, that it is not fully object-
oriented.
What is not an object in Python?
Why isn't len implemented as a str.len and list.len method instead of
a len(list) function?
--
http://mail.python.org/mailman/listinfo/python-list
i just downloaded 2.6 and when running the gui nothing happens.
anyone else with the same problem?
--
http://mail.python.org/mailman/listinfo/python-list
Let's say I have a class X which has 10 methods.
I want class Y to inherit 5 of them.
Can I do that? Can I do something along the lines of super(Y, exclude
method 3 4 7 9 10) ?
--
http://mail.python.org/mailman/listinfo/python-list
http://projecteuler.net/index.php?section=problems&id=18
def recur(tree, pos):
if not tree:
return []
else:
return [[tree[0][pos]] + recur(tree[1:], pos)] + \
[[tree[0][pos]] + recur(tree[1:], pos+1)]
i have a list with [[1],[2,3],[4,5,6],[7,8,9,10]]
it
18 matches
Mail list logo