On Jul 3, 10:20 pm, "Méta-MCI \(MVP\)"
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> Which OS?  On Vista, you MUST reconfig the "aperçu images et
> télécopies" (in french ; sorry, I don't know the english translation).
>
> @-salutations
>
> Michel Claveau
VISTA.
i will try google translate :)
--
h
On Jul 3, 10:20 pm, "Méta-MCI \(MVP\)"
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> Which OS?  On Vista, you MUST reconfig the "aperçu images et
> télécopies" (in french ; sorry, I don't know the english translation).
>
> @-salutations
>
> Michel Claveau
thumbnail images and faxes? and how do i
>>> h = "aja baja"
>>> h += 'e'
>>> h
'aja bajae'
>>>
--
http://mail.python.org/mailman/listinfo/python-list
so if strings were mutable and i did
a = b = "foo"
and then did
a += "bar"
then a and b would be foobar?
--
http://mail.python.org/mailman/listinfo/python-list
I was looking into currying and
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
Personal firewall software may warn about
so why would you ever want mutability?
seems very counterintuitive and unreliable.
--
http://mail.python.org/mailman/listinfo/python-list
i know, idid try it again and it works as expected. but how the h***
did it not work that one time?
--
http://mail.python.org/mailman/listinfo/python-list
Im looking into PvsNP:
http://www.claymath.org/millennium/P_vs_NP/
so I thought I'd write the program just to get a feel for it.
But I run into a problem. Why does it all the sudden return None? I
mean I know why the program aborts but I dont understand why the None
is generated all the sudden. H
ty I came to the same conckusion in bed :)
now it works.
however since there are 400 students and some are incompatible I
shouldnt be able to generate a 200room list right?
but it works sometimes the other times i get an error. might be
because of recursion depth i never let the error finish.
I don't fully understand why I have to do this.
On Jul 10, 4:17 am, Robert Kern <[EMAIL PROTECTED]> wrote:
> ssecorp wrote:
> > Im looking into PvsNP:
> >http://www.claymath.org/millennium/P_vs_NP/
> > so I thought I'd write the program just to get a feel f
I am never redefining the or reassigning the list when using validate
but since it spits the modified list back out that somehow means that
the modified list is part of the environment and not the old one.
i thought what happend inside a function stays inside a function
meaning what comes out is in
ty very good answer. i know i shouldn't use lambda like that, i never
do i was just playing around there and then this happened which i
thought was weird.
On Jul 10, 8:09 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
> David C. Ullrich wrote:
> > In article
> > <[EM
>>> def mod(x,y):
return x.append(y)
>>> mod([1,2],3)
>>> k=[1,2,3]
>>> k
[1, 2, 3]
>>> l = mod(k,4)
>>> l
>>> k
[1, 2, 3, 4]
>>> l
>>> k==l
False
>>> mod(k,5)
>>> k
[1, 2, 3, 4, 5]
>>> mod(l,4)
Traceback (most recent call last):
File "", line 1, in
mod(l,4)
File "", line 2, in m
def fib(n):
def fibt(a, b, n):
if n <= 1:
return b
else:
return fibt(b, a + b, n - 1)
if n == 0:
return 0
else:
return fibt(0, 1, n);
and can memoization speed up this even more? tesintg with memoization
doesnt really say anythin
I first learned about OO from Java.
I much prefer to program in Python though.
However I am consufed about 2 things.
1. Why do I have to pass self into every method in a class? Since I am
always doing why cant this be automated or abstracted away?
Are the instances where I won't pass self?
I ima
On Jul 12, 8:44 pm, castironpi <[EMAIL PROTECTED]> wrote:
> On Jul 12, 1:01 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
>
>
>
> > ssecorp <[EMAIL PROTECTED]> wrote:
> > > 1. Why do I have to pass self into every method in a class? Since I am
>
Is this correct use of exceptions? to raise an indexerror and add my
own string insetad of just letting it raise a IndexError by itself and
"blaming" it on list.pop?
class Stack(object):
def __init__(self, *items):
self.stack = list(items)
def push(self, item):
self.stack.
On Jul 13, 2:32 am, Roy Smith <[EMAIL PROTECTED]> wrote:
> In article
> <[EMAIL PROTECTED]>,
>
>
>
> ssecorp <[EMAIL PROTECTED]> wrote:
> > Is this correct use of exceptions? to raise an indexerror and add my
> > own string insetad of just letting
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691
so I try it and when I run:
@Decorators.tail_recursion
def fibtr(n):
def fibt(a, b, n):
if n <= 1:
return b
else:
return fibt(b, a + b, n - 1)
if n == 0:
return 0
else:
I my function not proper tail-recursion?
because this doesn't blow the stack:
#!/usr/bin/env python2.4
# This program shows off a python decorator(
# which implements tail call optimization. It
# does this by throwing an exception if it is
# it's own grandparent, and catching such
# exceptions
thanks i already have perfect iterative versions of fibonacci.
def fib(n):
a, b = 1, 0
while n:
a, b, n = b, a+b, n-1
return b
I know the example is not the way to write pythonic code, I was just
learning about decorators and then I saw this example and tried it
out.
but than
I have seen somewhere that you can write something like:
x*x if x>10
but exactly that doesn't work and I can't get any variation to work.
it is possible to nest with an else too.
how do you write it?
and also, is it idiomatic? doesn't seem to add functionality, just
another way of doing the
I might be misunderstanding OP but:
a+b+c+d+e is simple way of concatenating 5 lists...
as a function that takes any amount of lists and concatenates them:
def concat(*args):
c = []
for elem in args:
c += elem
return c
don't know if extend is faster or slo
def str_sort(string):
s = ""
for a in sorted(string):
s+=a
return s
if i instead do:
def str_sort(string):
s = ""
so = sorted(string)
for a in so:
s+=a
return s
will that be faster or the interpreter can fi
I am not clear about the results here.
from timeit import Timer
import Decorators
def fib(n):
a, b = 1, 0
while n:
a, b, n = b, a+b, n-1
return b
@Decorators.memoize
def fibmem(nbr):
if nbr > 1:
return fibmem(nbr-1) + fibmem(nbr-2)
if nbr == 1:
return
in read2 it never quits when I write quit, why?
def read():
expr = raw_input("Lisp> ")
if expr != "quit":
print parse(expr)
read()
else:
print "Good session!"
def read2():
expr = ""
while expr != "quit":
expr = raw_input("Lisp> ")
print
oops, embarrassing, I created the while loop not to use recursion then
I still did...
--
http://mail.python.org/mailman/listinfo/python-list
I think you are confusing 2 people in this thread but that doesn't
really matter.
What surprised me was that I didn't think fib would benefit from
memoization because it didn't repeat the same calculations. fibmem
without memoization is the classic naive implementation that grows
exponentially and
I have in Lib/site-packages a module named pdfminer. when I do import
pdfminer it complains:
>>> import pdfminer
Traceback (most recent call last):
File "", line 1, in
import pdfminer
ImportError: No module named pdfminer
I created a file pdfminer.py and put it in site-packages and that
If I have an expression like "bob marley" and I want to match
everything with one letter wrong, how would I do?
so "bob narely" and "vob marley" should match etc.
--
http://mail.python.org/mailman/listinfo/python-list
Is there a syntax for looping through 2 iterables at the same time?
for x in y:
for a in b:
is not what I want.
I want:
for x in y and for a in b:
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 11, 6:40 am, Mensanator <[EMAIL PROTECTED]> wrote:
> On Aug 10, 11:18 pm, ssecorp <[EMAIL PROTECTED]> wrote:
>
> > Is there a syntax for looping through 2 iterables at the same time?
>
> > for x in y:
> > for a in b:
>
> > is not what I w
Sometimes when running very intensive computations the Python-
interpreter kind of overheats and stops responding.
I have gotten the impression that the dos-version is less likely to
crash. Can that be true and if so, why?
Is there anyway to get around this? Pretty annoying that it stops
respondi
>>> super(object, type)
, >
>>> super(type, object)
, >
>>>
how can both work?
they can't both be the superclass of each other right? or is it some
sort of mutually recursive definition?
>>> help(object)
Help on class object in module __builtin__:
class object
| The most base type
>>> hel
I want a parse a file of the format:
movieId
customerid, grade, date
customerid, grade, date
customerid, grade, date
etc.
so I could do with open file as reviews and then for line in reviews.
but first I want to take out the movie id so I use an iterator.
then i want to iterate through all the r
In Haskell I can do [1..10] for range(1,11) and ['a'..'z'] for a list
of the alphabet.
Is there a way in Python to generate chars?
--
http://mail.python.org/mailman/listinfo/python-list
GvR wants to eliminate all the functional stuff (lambda map reduce
filter) which kind of makes sense for Python, listcomprehensions are
more efficient(at least as implemented inpython) from what i have
gathered and they can express everything map/reduce/filter with
crippled lambdas can.
but what a
dict.update({"a":1}) SETS the dict item "a" 's value to 1.
i want to increase it by 1. isnt that possible in an easy way? I
should use a tuple for this?
--
http://mail.python.org/mailman/listinfo/python-list
if i want to make a string downcase, is upper().swapcase() the onyl
choice? there is no downer() ?
--
http://mail.python.org/mailman/listinfo/python-list
Is there a way to view all the modules I have available for import
from within Python?
Like writing in the interpreter:
import.modules
Also, is there anything like Cpan for Python?
--
http://mail.python.org/mailman/listinfo/python-list
A method on a class:
def printSelf(self):
def printReviews():
for review in self.reviews:
review.printSelf()
print "Idnbr: ", self.idnumber, "Reviews: ", printReviews()
I don't have to pass an argument to printReviews because everything
defined inside p
Why/how is it possible to add variables like this? I don't understand
this mechanism:
http://docs.python.org/tut/node11.html#SECTION001133
class Employee:
pass
john = Employee() # Create an empty employee record
# Fill the fields of the record
john.name = 'John Doe'
john.dept
class Animal(object):
def __init__(self, name, weight):
self.name = name
self.weight = weight
def speak(self):
print "speak"
class Vegetable(object):
def __init__(self, name, volume):
self.name = name
self.volume = volume
def split(self):
also, how does super() work more exactly? I can't get it quite to
work.
class Movie(object):
def __init__(self, movieId, grades, date):
self.movieId = movieId
self.grades = grades
self.date = date
def newGrade(self, grade):
self.grades.append(grade)
d
It works when I inherit from 2 classes but not when I inherit from 2
subclasses.
-
from __future__ import division
class Movie(object):
def __init__(self, movieId, grades, date):
self.movieId = movieId
self.grades = grades
I did nce(I think).
class X
X.__dict__() and ngot a dict of its variables.
Now i get errors doing this. what am i doing wrong?
--
http://mail.python.org/mailman/listinfo/python-list
or why does this take so god damn long time?
and if I run into an IndexError it break out of the inner loop right?
so having range up to 1000 or 1000 wouldn't matter if biggest
working x is 800?
def getPixels(fileName):
im = PIL.Image.open(fileName)
colors = []
for y in range(1, 10
47 matches
Mail list logo