Search Results

Showing results 1 to 40 of 961
Search took 0.05 seconds.
Search: Posts Made By: Gribouillis ; Forum: Python and child forums
Forum: Python 12 Hours Ago
Replies: 1
Views: 77
Posted By Gribouillis
randrange(3) returns a random number in the set 0, 1, 2. You should replace that line with

return randrange(len(DOORS))

Other changes which seem obvious is to replace all the set([0,1,2]) by...
Forum: Python 2 Days Ago
Replies: 4
Solved: Recursion help!
Views: 193
Posted By Gribouillis
You could use

def find_dupe(L):
if len(L) == 0:
return False
elif L[0] in L[1:]:
return True
else:
return find_dupe(L[1:])
Forum: Python 2 Days Ago
Replies: 4
Views: 1,194
Posted By Gribouillis
As pointed out by woooee, there is a google code project pymouse (http://code.google.com/p/pymouse/) which purpose is to provide platform-agnostic methods to handle the mouse.
Forum: Python 3 Days Ago
Replies: 8
Views: 206
Posted By Gribouillis
The probability that normalvariate returns a negative number can be computed with the scipy module like this

from scipy.special import erf as erf
from math import sqrt
sqrt2 = sqrt(2.0)

def...
Forum: Python 3 Days Ago
Replies: 8
Views: 206
Posted By Gribouillis
Also, the normal distribution can return negative numbers, there is nothing wrong with that.
Forum: Python 6 Days Ago
Replies: 4
Views: 214
Posted By Gribouillis
Many linux systems have a package named "python-numpy". You only need to install it with your software manager. Don't ask such questions without specifying your linux distribution :)
Forum: Python 6 Days Ago
Replies: 2
Views: 261
Posted By Gribouillis
Looking at the pictures here (http://www.math.okstate.edu/mathdept/dynamics/dragon.html), the algorithm seems pretty straightforward, starting with a vector of 2 points A and B

def draw_dragon(A,...
Forum: Python 7 Days Ago
Replies: 4
Views: 186
Posted By Gribouillis
You can get the python include directory like this

>>> from distutils.sysconfig import get_python_inc
>>> print(get_python_inc())
/usr/include/python2.6

Now, if you don't have Python.h, you...
Forum: Python 7 Days Ago
Replies: 26
Views: 738
Posted By Gribouillis
This will work if
1) You store the class instance in some global place
2) You don't have several users who call "Get data from document" randomly.
Forum: Python 7 Days Ago
Replies: 26
Views: 738
Posted By Gribouillis
Well, how do you identify users ? may be an IP when they connect ? A good design would be something like


class User(Object):
all_users = dict()

def __init__(self, identity):
...
Forum: Python 7 Days Ago
Replies: 3
Views: 190
Posted By Gribouillis
A simpler solution is to hit the button Toggle Plain Text before copying the code.
Forum: Python 8 Days Ago
Replies: 26
Views: 738
Posted By Gribouillis
I think it means that you should have a current language per user, and that text submission should come with a user ID, so that to each ID corresponds a language chosen by that user. It's the only...
Forum: Python 8 Days Ago
Replies: 10
Views: 330
Posted By Gribouillis
Congratulations ! Can you mark the thread as solved ?
Forum: Python 8 Days Ago
Replies: 10
Views: 330
Posted By Gribouillis
Perhaps your problem comes from the fact that you are trying to access an attribute. You should try to define an accessor method

class RFAMessageWrapper {
...
??? getService(){
...
Forum: Python 8 Days Ago
Replies: 10
Views: 330
Posted By Gribouillis
You didn't understand my design above. It's not a singleton, the variable is only used temporarily when wrapping an object (by the way, I should have used RFAMessageWrapper instead of RFAMessage).
...
Forum: Python 9 Days Ago
Replies: 26
Views: 738
Posted By Gribouillis
You are writing code with random indentation. This ruins all your efforts in python. So take a standard rule like always using 4 space characters for indentation. You can set an option in your editor...
Forum: Python 9 Days Ago
Replies: 10
Views: 330
Posted By Gribouillis
I don't know the solution, but I once designed a hack which you should try: You declare a static variable somewhere and an accessor function without arguments for this variable like this
...
Forum: Python 9 Days Ago
Replies: 10
Views: 330
Posted By Gribouillis
Im not sure, but I think you should wrap msg2 into a new python object yourself with SWIG_NewPointerObj. You can put only python objects in a call to a python function. Try to google for use examples...
Forum: Python 10 Days Ago
Replies: 26
Views: 738
Posted By Gribouillis
Did you try to put the global statement as the first statement in your method ?
Forum: Python 10 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
I added a MainDiscussion page which we should use instead of this thread. There will probably be many posts that other users of the python forum are not interested to read. For those interested, this...
Forum: Python 10 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
Don't forget to use hg help or hg help pull etc.
Forum: Python 10 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
Well, you can edit files in your copy of the repository. When you create a new file, you must run

hg add myfile.py

so that the new file is managed by mercurial. If you type

hg status

you...
Forum: Python 10 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
To me, wxpython looks like a good idea, but I never used wxglade. Can you make one or two candidate widgets wich could be used for the project ? I'm making a tmp directory in the project where we can...
Forum: Python 11 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
I added both of you as project's owners.
Forum: Python 11 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
Ok, the repo is created, you can download the repo with the following command which creates a cronstalk directory. It's in lower case because google code forced me to do so. The repository is...
Forum: Python 11 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
CronStalk, Google Code, Mercurial, Mit, >=2.5 are ok for me. Should I create the repo, ?
Forum: Python 11 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
I don't think we have to support every existing platform. Don't forget that we are going to launch processes, and there may be differences in the way different platforms handle processes. Since we...
Forum: Python 11 Days Ago
Replies: 17
Views: 504
Posted By Gribouillis
Ok, replace the browse function by this one

def browse_swagbucks(variable):
"""browse_swagbucks(variable) -> a subprocess.Popen object
Start firefox with a query to swagbucks.com in a...
Forum: Python 12 Days Ago
Replies: 2
Views: 179
Posted By Gribouillis
There is a little module called Lumpy (http://www.greenteapress.com/thinkpython/swampy/lumpy.html) which can draw diagrams in live python programs. It's mainly intended for students, and it's not...
Forum: Python 12 Days Ago
Replies: 32
Views: 986
Posted By Gribouillis
I have an idea of a small and useful project: it's a robot which executes other programs (first target is python programs) using a time rule, for example it can execute a program periodically. Tasks...
Forum: Python 13 Days Ago
Replies: 17
Views: 504
Posted By Gribouillis
It seems that your program cannot find firefox.exe. Try to locate this file manually in your file system (probably in C:\Program Files .... Then put the whole path

FIREFOX = r"C:\Program Files...
Forum: Python 13 Days Ago
Replies: 0
Views: 339
Posted By Gribouillis
This snippet defines a function chmod which uses symbolic strings to represent the mode (eg u+rwx) like the shell command 'chmod'.
Forum: Python 13 Days Ago
Replies: 17
Views: 504
Posted By Gribouillis
You can write

def make_variable(word_list):
return "+".join(random.sample(word_list, 4))

I just learned about random.sample in the python documentation.
Forum: Python 14 Days Ago
Replies: 17
Views: 504
Posted By Gribouillis
Yes, you are right, I missed that. It was woooee's idea to shuffle the list once
and take subsequent groups of 4 words. I don't think it's a very good method, because a word can't be repeated until...
Forum: Python 14 Days Ago
Replies: 3
Views: 178
Posted By Gribouillis
The best solution is that you do the test with 2.6. Some library modules have different names, for example html.parser in python3 is HTMLParser in 2.6, but most of your programs should run.
Forum: Python 14 Days Ago
Replies: 17
Views: 504
Posted By Gribouillis
Here is a working version. See how function parameters and return values are used to answer your questions.

import time
import random
import subprocess as sp

FIREFOX = 'firefox.exe'
PROFILE...
Forum: Python 15 Days Ago
Replies: 2
Views: 157
Posted By Gribouillis
Also googling L-system+python yields many links which should be checked.
Forum: Python 15 Days Ago
Replies: 17
Views: 504
Posted By Gribouillis
Woooee is right. The correct structure to implement

do this
do that
loop again after a random time

is

while True:
do_this()
Forum: Python 15 Days Ago
Replies: 10
Views: 330
Posted By Gribouillis
You should not write except: clauses without targeting a specific exeption. For example if you're reading user input and you're expecting a number and the user types "hello", then float("hello") will...
Forum: Python 15 Days Ago
Replies: 7
Views: 210
Posted By Gribouillis
Perhaps you could follow this kind of design (if I understand correctly the meanings of the arguments to blastall)

#!/usr/bin/env python
# myscript.py
import subprocess as sp
from os path...
Showing results 1 to 40 of 961

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC