>>> a = parsing.unserialize("C:/users/saftarn/desktop/twok.txt")
Traceback (most recent call last):
File "", line 1, in
File "C:\Python25\Progs\NetflixRecSys\parsing.py", line 91, in
unserialize
return pickle.load(open(filename, 'r'))
File "C:\Python25\lib\pickle.py", line 1370, in load
On Sep 16, 10:53 pm, "Aaron \"Castironpi\" Brady"
<[EMAIL PROTECTED]> wrote:
> On Sep 16, 3:16 pm, cnb <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Sep 16, 7:49 pm, "Aaron \"Castironpi\" Brady"
> > > > Now I have my pe
On Sep 16, 7:49 pm, "Aaron \"Castironpi\" Brady"
<[EMAIL PROTECTED]> wrote:
> On Sep 16, 10:13 am, cnb <[EMAIL PROTECTED]> wrote:
>
>
>
> > >>> sys.path
>
> > ['C:\\Python25\\Progs\\NatLangProc', 'C:\\Python25\\
On Sep 16, 5:25 pm, Python <[EMAIL PROTECTED]> wrote:
> On 16 sep 2008, at 17:13, cnb wrote:
>
>
>
> >>>> sys.path
> > ['C:\\Python25\\Progs\\NatLangProc', 'C:\\Python25\\Lib\\idlelib',
> > 'C:\
> > \Windows\\system32\\p
>>> sys.path
['C:\\Python25\\Progs\\NatLangProc', 'C:\\Python25\\Lib\\idlelib', 'C:\
\Windows\\system32\\python25.zip', 'C:\\Python25\\lib\\site-packages\
\orange', 'C:\\Python25\\lib\\site-packages\\orange\\OrangeWidgets',
'C:\\Python25\\lib\\site-packages\\orange\\OrangeCanvas', 'C:\
\Python25\\D
this recursive definition of sum thrumped me, is this some sort of
gotcha or am I just braindead today?
and yes i know this is easy a a for x in xs acc += x or just using the
builtin.
def suma(xs, acc=0):
if len(xs) == 0:
acc
else:
suma(xs[1:], acc+x
This must be because of implementation right? Shouldn't reduce be
faster since it iterates once over the list?
doesnt sum first construct the list then sum it?
---
>>> RESTART
>>>
reduce with named function: 37
I am trying to translate this elegant Erlang-code for finding all the
permutations of a list.
I think it is the same function as is but it doesn't work in Python.
-- is upd in Python. It works as it should.
perms([]) -> [[]];
perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].
def perms(lista):
if i do
try:
something
except TypeError, IndexError:
pass
only the first error will get caught. I dont want to use Exception and
catch all errors, but just 2. how can i do that?
--
http://mail.python.org/mailman/listinfo/python-list
If I buy a multicore computer and I have really intensive program. How
would that be distributed across the cores?
Will algorithms always have to be programmed and told specifically to
run on several cores so if not told it will only utilize one core?
So is the free lunch really over or is this j
, 'argmax', 'argmin', 'argsort', 'astype', 'base', 'byteswap',
'choose', 'clip', 'compress', 'conj', 'conjugate', 'copy', 'ctypes',
'cumprod', 'cumsum', 'data', 'diagonal', 'dtype', 'dump', 'dumps',
'fill', 'flags', 'flat', 'flatten', 'getA', 'getA1', 'getH', 'getI',
'getT', 'getfield', 'imag', 'it
over 17000 files...
netflixprize.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 2, 7:06 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Tue, 02 Sep 2008 09:48:32 -0700, cnb wrote:
> > I have a bunch of files consisting of moviereviews.
>
> > For each file I construct a list of reviews and then for each new file I
>
I have a bunch of files consisting of moviereviews.
For each file I construct a list of reviews and then for each new file
I merge the reviews so that in the end have a list of reviewers and
for each reviewer all their reviews.
What is the fastest way to do this?
1. Create one file with reviews,
how does doing something twice not change complexity? yes it maybe
belongs to the same complexity-class but is still twice as slow no?
--
http://mail.python.org/mailman/listinfo/python-list
For a big nbr of it might matter?
Is av_grade O(n*2) and the first O(n) when it comes to adding or is
"sum x for x in y" just traversing the list ones, accumulating the
values, it doesnt first build the list and then travese it for sum?
def averageGrade(self):
tot = 0
for review i
In median grade, can I sort on Review-grade somehow?
something like:
sr = self.reviews.sort(key=self.reviews.instance.grade)
class Review(object):
def __init__(self, movieId, grade, date):
self.movieId = movieId
self.grade = grade
self.date = date
class Customer(object
you could prob abstract away a lot of that code, very similar-looking.
then it would be easier to find bugs.
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 29, 7:40 pm, Daniel <[EMAIL PROTECTED]> wrote:
> On Aug 29, 11:23 am, cnb <[EMAIL PROTECTED]> wrote:
>
> > If I get zero division error it is obv a poor solution to do try and
> > except since it can be solved with an if-clause.
>
> > However if a p
class Customer(object):
def __init__(self, idnumber, review):
self.idnumber = idnumber
self.reviews = [review]
def addReview(self, review):
self.reviews.append(review)
def averageGrade(self):
tot = 0
for review in self.reviews:
tot +
If I get zero division error it is obv a poor solution to do try and
except since it can be solved with an if-clause.
However if a program runs out of memory I should just let it crash
right? Because if not then I'd have to write exceptions everywhere to
prevent that right?
So when would I actual
I have been testing different tools for cvs, math etc and I am
constantly amazed how many great tools and libraries there are for
Python.
SAGE, Mercurial as 2 outstanding tools and there a re excellent
libraries fro anything you want, natural language processing, any kind
of parsing, math, simulati
On Aug 26, 9:43 am, Martin Marcher <[EMAIL PROTECTED]> wrote:
> On 2008-08-26 00:32:20, cnb wrote:
>
> > Are dictionaries the same as hashtables?
>
> Yes, but there is nothing in there that does sane collision handling
> like making a list instead of simply overwriting.
Are dictionaries the same as hashtables?
--
http://mail.python.org/mailman/listinfo/python-list
ok post exactly what you do when this hapens:
ault: :cannot marshal objects">
it complains you are trying to marshal a generator object rather than
the file you are yielding.
also, something I am not sure about:
>>> def f(x):
try: open("C:/ruby/progs/blandat/infixtoprefix.rb") or open
On Aug 26, 2:50 am, cnb <[EMAIL PROTECTED]> wrote:
> def somefunc():
> for action, files in results:
> full_filename = os.path.join(path_to_watch, files)
> theact = ACTIONS.get(action, "Unknown")
> yield str(ful
def somefunc():
for action, files in results:
full_filename = os.path.join(path_to_watch, files)
theact = ACTIONS.get(action, "Unknown")
yield str(full_filename) + " " + str(theact)
?
Here is an example if that doesn't work, using yield, to
Is it not possible to have mutability without this? I know I can use
sorted and list(reversed) instead of .sort and .reverse but if I want
to copy a list and then change that list without changing the first
one?
And there isn't a .copy function so I have to "new = [] for element in
list: new.append
how do I run the interpreter In emacs? pythonmode works but I cant
start the interpreter. do I need to add it to my load-path?
what should I add exactly then?
python.exe or pythonw.exe?
--
http://mail.python.org/mailman/listinfo/python-list
29 matches
Mail list logo