Re: running a random function

2007-06-07 Thread Brian van den Broek
David Bear said unto the world upon 06/07/2007 11:56 AM: > I would like to write some code that would randomly select a function from a > list of functions and call it. I was looking in the globals names space and > randomly selecting items that were of type function.. but I didn't see a > way of a

Re: example: 40286 -> 68204

2007-06-03 Thread Brian van den Broek
Shihpin said unto the world upon 06/03/2007 08:23 PM: > Hi all, > > Is there a fuction that reverse the digits of a number? > > Many thanks, > > Shihpin Lin > This does it: def reversed_int(i): > ... return int(''.join(reversed(str(i > ... reversed_int(12345) > 54321

Re: c[:]()

2007-05-30 Thread Brian van den Broek
Warren Stringer said unto the world upon 05/30/2007 05:31 PM: > Hmmm, this is for neither programmer nor computer; this is for a user. If I > wanted to write code for the benefit for the computer, I'd still be flipping > switches on a PDP-8. ;-) > > This is inconsistent: > > why does c[:][0]() w

Re: webbrowser module bug?

2007-05-25 Thread Brian van den Broek
Ron Adam said unto the world upon 05/25/2007 12:28 PM: > [EMAIL PROTECTED] wrote: >> On May 24, 5:03 pm, Ron Adam <[EMAIL PROTECTED]> wrote: >>> Is anyone else having problems with the webbrowser module? >>> >>> Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) >>> [GCC 4.1.2 (Ubuntu 4.1.2-0u

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread Brian van den Broek
Peter Otten said unto the world upon 05/23/2007 01:32 PM: > Brian van den Broek wrote: >> Help on built-in function apply in module __builtin__: >> >> But: >> >> >>> [x for x in dir('__builtin__') if 'apply' in x] >> [

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread Brian van den Broek
Wildemar Wildenburger said unto the world upon 05/23/2007 08:43 AM: > Bruno Desthuilliers wrote: >> here's an example using a property: >> >> class cpu_ports(object): >> def __init__(self, value=0): >> self._d = value >> @apply >> def value(): >> def fset(self, value): >

Re: Can I reference 1 instance of an object by more names ?

2007-05-22 Thread Brian van den Broek
Stef Mientki said unto the world upon 05/22/2007 07:44 PM: > hello, > > I'm trying to build a simple functional simulator for JAL (a Pascal-like > language for PICs). > My first action is to translate the JAL code into Python code. > The reason for this approach is that it simplifies the simulato

Re: Inheritance

2007-05-22 Thread Brian van den Broek
HMS Surprise said unto the world upon 05/22/2007 02:40 PM: > I am trying to understand the 'if' statement and the exec statement in > the code below. I would like to add several common routines to this > class and then inherit it into a class in another file. This other > class would need to access

Re: TIFF to PDF

2007-05-21 Thread Brian van den Broek
Gabriel Genellina said unto the world upon 05/21/2007 10:12 AM: > En Mon, 21 May 2007 10:53:08 -0300, Brian van den Broek > <[EMAIL PROTECTED]> escribió: > >> Gabriel Genellina said unto the world upon 05/21/2007 07:01 AM: >>> En Mon, 21 May 2007 07:42:21 -030

Re: TIFF to PDF

2007-05-21 Thread Brian van den Broek
Gabriel Genellina said unto the world upon 05/21/2007 07:01 AM: > En Mon, 21 May 2007 07:42:21 -0300, revuesbio <[EMAIL PROTECTED]> > escribió: > >> os.system('"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf >> C:\test.TIF') > > \ is used as a escape character in strings. > Use eith

Re: PChess 0.9

2007-05-07 Thread Brian van den Broek
majeed rana said unto the world upon 05/07/2007 01:13 AM: > I want pchess 0.9 > I want a mansion and a yacht. Unlike you, google can't help me. Brian vdB -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples, index method, Python's design

2007-04-13 Thread Brian van den Broek
Antoon Pardon said unto the world upon 04/13/2007 02:46 AM: > On 2007-04-12, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> So much fuss over such a little thing... yes it would be nice if tuples >> grew an index method, but it isn't hard to work around the lack. > > Yes it is a little thing. Bu

Re: doctests for interactive functions

2007-02-09 Thread Brian van den Broek
Neil Cerutti said unto the world upon 02/09/2007 08:52 AM: > On 2007-02-08, Brian van den Broek <[EMAIL PROTECTED]> wrote: >> Can I run the rough structure of my code past you to see if it >> is in the vicinity of what you mean? (I have removed some >> details for s

Re: Python Newbie

2007-02-08 Thread Brian van den Broek
spazziam said unto the world upon 02/08/2007 04:18 PM: > SyntaxError: invalid syntax > File "C:\Python23\vdrop2\final py\vdrop2.py", line 123 > def INIT_HIGHS(): > ^ > SyntaxError: invalid syntax > > Why would this come up? > Hi, Most likely, a previous line contains an unfinished s

Re: doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Neil Cerutti said unto the world upon 02/08/2007 02:25 PM: > On 2007-02-08, Brian van den Broek <[EMAIL PROTECTED]> wrote: >> All classes take an optional argument input_function that >> determines how the class instance gets its input. If this is >> not provided, it def

Re: doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Ben Finney said unto the world upon 02/08/2007 03:03 PM: > Brian van den Broek <[EMAIL PROTECTED]> writes: > >> Since the classes are for getting input interactively, a >> straightforward use of doctest is not going to work. (The tests >> won't run automaticall

doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Hi all, I have a module of classes for getting input from the user that satisfies various constraints. For instance, one class is created with a menu of option, presents them to the user, and rejects any input other than a menu option; another ensures that the user's input is interpretable as

Re: OT: Sarcasm and irony

2006-10-10 Thread Brian van den Broek
bryan rasmussen said unto the world upon 10/10/06 08:25 AM: > As was noted in my original statement the weak form of irony such as > understood by Danes and I suppose by Americans as well, since that is > what Steve was originally complaining about, is descended from the > concept of Dramatic Ir

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Brian van den Broek
Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: > The heading comment to pprint reads: > > # This is a simple little module I wrote to make life easier. I > didn't > # see anything quite like it in the library, though I may have > overlooked > # something. I wrote this when I w

Re: Python 411.

2006-06-13 Thread Brian van den Broek
Mike T said unto the world upon 13/06/06 10:46 AM: > What exactly is 411 in this context? A reference to higher education > perhaps? Or perhaps part of the American constitution? What exactly? > Also for that matter what is 101? > > Cheers, > Mike > Hi Mike, 411 is the number one dials in Nor

Re: OOP / language design question

2006-04-26 Thread Brian van den Broek
Bruno Desthuilliers said unto the world upon 25/04/06 06:52 PM: > Duncan Booth a écrit : > >>bruno at modulix wrote: >> >> >> >>>class Base(object): >>> def __init__(self, arg1): >>> self.attr1 = arg1 >>> self.dothis() >>> >>> def dothis(self): >>> return self.attr1 >>> >>>class Derived(Base

RESOLVED Re: PYTHONPATH

2006-04-24 Thread Brian van den Broek
> either in /etc/profile (will be system-wide default) or ~/.bash_profile > (will be user-specific). and Edward Elliott said unto the world upon 23/04/06 07:56 PM: > Brian van den Broek wrote: >>So, it seems that I currently have to invoke '. .bash_profile' >>ma

Re: PYTHONPATH

2006-04-24 Thread Brian van den Broek
Edward Elliott said unto the world upon 23/04/06 07:56 PM: > Brian van den Broek wrote: >>Only somewhat, as if I open a brand new shell: >> >>[EMAIL PROTECTED]:~$ python >> >>> from sys import path >> >>> path[0:3] >>['', 

Re: PYTHONPATH

2006-04-23 Thread Brian van den Broek
Edward Elliott said unto the world upon 23/04/06 04:28 PM: > Brian van den Broek wrote: > >>The suggestions above appear not to work for me: >> >>[EMAIL PROTECTED]:~$ cat /etc/profile | grep 'export PYTHONPATH' >>export PYTHONPATH="~/PythonFiles&quo

Re: PYTHONPATH

2006-04-23 Thread Brian van den Broek
bruno at modulix said unto the world upon 20/04/06 08:38 AM: >>Can anyone help me to make my path persistant? > > > Just like any other environnement variable on your system. With most > distros, it will be something like adding the line: > > export PYTHONPATH="/a/possible/path;/another/one;/

Re: Basic coin flipper program - logical error help

2006-02-22 Thread Brian van den Broek
DannyB said unto the world upon 21/02/06 06:14 PM: > I'm just learning Python. I've created a simple coin flipper program - > here is the code: > > [source] > #Coin flipper > import random > > heads = 0 > tails = 0 > counter = 0 > > coin = random.randrange(2) > > while (counter < 100): > i

Re: question about scope

2006-02-17 Thread Brian van den Broek
John Salerno said unto the world upon 16/02/06 09:18 AM: > "Name references search at most four scopes: local, then enclosing > functions (if any), then global, then built-in." > > I understand what global and built-in are, and I thought I understood > the concept of local too, but when I got

Re: New Python.org website ?

2006-01-19 Thread Brian van den Broek
Steve Holden said unto the world upon 11/01/06 04:44 AM: > http://beta.python.org A few minor points about the design: The "Using Python for . . ." for section on the right is expectation violating in several ways: 1) Each two lines have 3 separate links, but all go to the same place. Much bet

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Brian van den Broek
Brian van den Broek said unto the world upon 12/01/06 03:42 AM: > [EMAIL PROTECTED] said unto the world upon 12/01/06 03:15 AM: > >>I can think of several messy ways of making a dict that sets a flag if >>it's been altered, but I have a hunch that experienced python >&

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 12/01/06 03:15 AM: > I can think of several messy ways of making a dict that sets a flag if > it's been altered, but I have a hunch that experienced python > programmers would probably have an easier (well maybe more Pythonic) > way of doing this. > > It'

Re: What is the slickest way to transpose a square list of lists (tuple of tuples)?

2006-01-08 Thread Brian van den Broek
Gerard Brunick said unto the world upon 08/01/06 01:27 PM: > My way is ugly. These has to be a better way. > > Thanks, > Gerard If you'd posted your way, I might well have seen if I could do it in a nicer fashion. But, since for all I know, my best efforts would result in the approach you alre

Re: What's wrong with this code snippet?

2006-01-04 Thread Brian van den Broek
Karlo Lozovina said unto the world upon 04/01/06 04:19 PM: > Here is it: > > --- > class Human: > def __init__(self, eye_one, eye_two): > self.eye_one = eye_one > self.eye_two = eye_two > > class Population: > def __init__(self): > self.house = [] >

Re: OT: Degrees as barriers to entry [was Re: - E04 - Leadership! Google, Guido van Rossum, PSF]

2006-01-03 Thread Brian van den Broek
Steven D'Aprano said unto the world upon 03/01/06 07:33 PM: > On Tue, 03 Jan 2006 08:27:39 -0800, Alex Martelli wrote: > > >>Or some even more stringent qualification, such as the state's Bar exam >>for lawyers -- you may not be able to sit for that exam w/o the >>appropriate degree, but the degr

Re: Bug ??

2006-01-02 Thread Brian van den Broek
Eddy Ilg said unto the world upon 02/01/06 05:43 PM: > Hi, > > I have a class and I am trying to set the instance varirable 'variables' > (also tried different names). The variable gets initialized by > default-value parameter of the constructor. When I change the variable and > call the construct

Re: Global Variables in OOP and Python

2005-12-30 Thread Brian van den Broek
Gary Herron said unto the world upon 30/12/05 08:03 PM: > newbie wrote: > > >>Hello, >> >>I have questions about global variables in OOP (in general) and Python >>(in specific). I understand (I think) that global variables are >>generally not a good idea. However, if there are variables that nee

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
Brian van den Broek said unto the world upon 29/12/05 12:03 PM: > jeremito said unto the world upon 29/12/05 11:39 AM: > >>I am learning how to extend Pythong with C++. I have will be writing >>some code in C++ and want/need Python to interact with it. I am not >>havi

Re: Extending Python with C++

2005-12-29 Thread Brian van den Broek
jeremito said unto the world upon 29/12/05 11:39 AM: > I am learning how to extend Pythong with C++. I have will be writing > some code in C++ and want/need Python to interact with it. I am not > having success following the online documentation from > http://docs.python.org/ext/ext.html. I have

Re: Modifying values in a list

2005-12-29 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 29/12/05 10:43 AM: > The following code: > > numbers = [1, 2, 3] > for value in numbers: > value *= 2 > print numbers > > results in the following output: > [1, 2, 3] > > The intent of the code was to produce this output: > [2, 4, 6] > > What is

Re: Guido at Google

2005-12-22 Thread Brian van den Broek
Graham Fawcett said unto the world upon 2005-12-22 08:18: > Steve Holden wrote: > >>>Nicola Musatti wrote: >>>Of course, I'm going on vacation next week and there was talk >>>about a one-way ticket to Mexico. The real question is will they let me >>>*back* in? :-) >>> >> >>I would be careful comi

Re: Please i need a hand with writing a simple task.

2005-12-19 Thread Brian van den Broek
Marian said unto the world upon 2005-12-19 10:58: > Can you pleae help me with this task. I have really hard time with > my textbook desolving this problem. The Task: Write a program that > will create a text file, print the contents of the text file as you > create the file. Read the contents of

Re: debian and python--any potential pitfalls?

2005-12-19 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-12-19 00:36: > Brian van den Broek wrote: >>I've tried solo and failed a few times to install various Linux >>distros on Intel x86 laptops. (The software modem was always the >>sticking point.) A recent acquaintance h

Re: how to remove duplicated elements in a list?

2005-12-19 Thread Brian van den Broek
Alex Martelli said unto the world upon 2005-12-19 10:48: > Brian van den Broek <[EMAIL PROTECTED]> wrote: >... > >>>>>orig_list = [3,1,2,3,1,2,3,1,2,1,2,1,3] >>>>>new_list = list(set(orig_list)) >>>>>new_list.sort(cmp=

Re: how to remove duplicated elements in a list?

2005-12-19 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-12-19 02:27: > Steve Holden wrote: > >>Kevin Yuan wrote: >> >>>How to remove duplicated elements in a list? eg. >>>[1,2,3,1,2,3,1,2,1,2,1,3] -> [1,2,3]? >>>Thanks!! >>> >> >> >>> list(set([1,2,3,1,2,3,1,2,1,2,1,3])) >>[1, 2, 3] >> > > Would this ha

debian and python--any potential pitfalls?

2005-12-18 Thread Brian van den Broek
Hi all, I know that this is something for which I could (keep) STFW, but I'm mostly ignorant of the subject area and under a bit of a deadline. So I hope people won't mind if I truncate my search and ask here. I've tried solo and failed a few times to install various Linux distros on Intel x86

Re: Why and how "there is only one way to do something"?

2005-12-15 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-12-15 07:50: > obvious). It is just like there are language on this planet that reads > from right to left horizontally, as well as top to bottom, then right > to left. And you are trying to tell them that English way is the "right > way" or the obvi

Re: Any good Python forums?

2005-12-15 Thread Brian van den Broek
SeNTry said unto the world upon 2005-12-15 10:25: > Hello, > > Are there any good active python forums online? Especially any forum that > has an uber-noob section! > It is not a forum, but if you are looking for a newbie-tailored venue, the python tutor list

Re: Still Loving Python

2005-12-14 Thread Brian van den Broek
Peter Decker said unto the world upon 2005-12-14 07:03: > On 12/13/05, Mike Meyer <[EMAIL PROTECTED]> wrote: > > >>>Why this need to have everyone do things the way you do? >> >>Whatever makes you think I have this need? I said I hated them. I'm >>pretty sure I didn't say everyone should have to

Re: newbie-one more example of difficulty in van Rossum's tutorial

2005-12-13 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-12-13 15:44: > This is from 9.6 (Private variables). I quote > > - "Notice that code passed to exec, eval() or evalfile() does not > consider the classname of the invoking class to be the current class; > this is similar to the effect of the global s

Re: newbie-name mangling?

2005-12-13 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-12-13 15:05: > I'm reading van Rossum's tutorial. Mostly it is well written and > examples are given. However sometimes I get lost in a text, when it > doesn't give any examples and no clues. There are several examples of > this in chapter 9 about cla

Re: puzzled about class attribute resolution and mangling

2005-12-11 Thread Brian van den Broek
James Stroud said unto the world upon 2005-12-09 20:39: > Brian van den Broek wrote: > >>Hi all, >> >>I've the following code snippet that puzzles me: >> >>class Base(object): >>__v, u = "Base v", "Base u" >>def

puzzled about class attribute resolution and mangling

2005-12-09 Thread Brian van den Broek
Hi all, I've the following code snippet that puzzles me: class Base(object): __v, u = "Base v", "Base u" def __init__(self): print self.__v, self.u class Derived(Base): __v, u = "Derived v", "Derived u" def __init__(self): print self.__v, self.u sup

Re: compare list

2005-11-15 Thread Brian van den Broek
Ben Bush said unto the world upon 2005-11-15 01:24: > > Unfortunately, the indents got screwed up along the way. But the part > >>of my code you asked about was: >> >>for item in list1: >>if item in list2: >>if item + 1 in list1 and item + 1 in list2: >>return True >>

Re: compare list

2005-11-15 Thread Brian van den Broek
Shi Mu said unto the world upon 2005-11-15 01:30: >>Hey Ben, >> >>first, as expected, the other two answers you received are better. :-) >> >>Sets are much better optimized for things like membership testing than >>are lists. I'm not competent to explain why; indeed, I keep >>overlooking them mysel

Re: compare list

2005-11-14 Thread Brian van den Broek
Ben Bush said unto the world upon 2005-11-14 23:20: > > On 11/14/05, Brian van den Broek <[EMAIL PROTECTED]> wrote: > >>Ben Bush said unto the world upon 2005-11-14 05:51: >> >>>I have four lists: >>>lisA=[1,2,3,4,5,6,9] >>>lisB=[1,6

Re: compare list

2005-11-14 Thread Brian van den Broek
Ben Bush said unto the world upon 2005-11-14 05:51: > I have four lists: > lisA=[1,2,3,4,5,6,9] > lisB=[1,6,5] > lisC=[5,6,3] > lisD=[11,14,12,15] > how can I write a function to compare lisB, lisC and lisD with lisA, if they > share two continuous elements (the order does not matter), then return

Re: tutorial example?????

2005-11-13 Thread Brian van den Broek
john boy said unto the world upon 2005-11-12 19:43: > OK...I have the following program > > i = 1 > while i <= 6: > print 2 * i,' ', > i = i + 1 > print > > this is supposed to give you a "new" blank line after the program runs > instead it just gives: > 2 4 6 8 10 12 > >

Re: how to think like a computer scientist

2005-11-13 Thread Brian van den Broek
john boy said unto the world upon 2005-11-11 22:25: > Question for the following program: sec 5.5 > > def factorial (n): >if n == 0: > return 1 >else: > recurse = factorial (n-1) > result = n * recurse > return result > > How come whenever I state the function wi

Re: __Classes and type tests

2005-10-09 Thread Brian van den Broek
Fredrik Lundh said unto the world upon 2005-10-09 17:49: > Brian van den Broek wrote: > > >>But the academic issue "How/Can it be done?" still itches. > > > class __TwoUnderBase(object): > def __init__(self): > if se

__Classes and type tests

2005-10-09 Thread Brian van den Broek
Hi all, The code below exhibits an attempt to refer to the type of a __Class from within a method of that class. I've been unable to figure out how to make it work as I want, and would appreciate any insight. The problem emerged out of a bad design that the good folks on the tutor list helped

Re: Difference between " and '

2005-07-22 Thread Brian van den Broek
Andrew Dalke said unto the world upon 2005-07-22 13:30: > François Pinard wrote: > >>There is no strong reason to use one and avoid the other. Yet, while >>representing strings, Python itself has a _preference_ for single >>quotes. > > > I use "double quoted strings" in almost all cases becaus

Re: interactive python session spool/save-log command?

2005-07-20 Thread Brian van den Broek
Robert Kern said unto the world upon 2005-07-20 21:15: > S. M. Tuttle wrote: > >>I'm going to be teaching an introductory course on Python >>in the Fall, so I am hurriedly trying to both learn >>Python and prepare the course during the next few weeks. >> >>I'm curious if there is a command that al

Re: problems with python 2.4 help

2005-07-15 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 15/07/2005 14:50: > I've noticed that the listings in help don't take you to correct topic. > > anyone else have this problem? Is there a fix? > I'm not sure from your question what exact problem you are experiencing. Do you mean: IDLE 1.1.1 >>> hel

Re: 2.4 Recent File list not working

2005-07-13 Thread Brian van den Broek
Larry Bates said unto the world upon 13/07/2005 15:54: > I recently upgraded from 2.2 to 2.4 (ActiveState for Windows). > I was accustomed to having the most recent 10 files that I had > edited show up under File menu under Recent. After upgrading > these don't seem to be saved after exiting. I t

Re: Replacing last comma in 'C1, C2, C3' with 'and' so that it reads 'C1, C2 and C3'

2005-07-12 Thread Brian van den Broek
Ric Da Force said unto the world upon 12/07/2005 02:43: > Hi, > > I have a string such as 'C1, C2, C3'. Without assuming that each bit of > text is of fixed size, what is the easiest way to change this list so that > it reads: > 'C1, C2 and C3' regardless of the length of the string. > > Rega

Re: An absolute Newbie question

2005-07-10 Thread Brian van den Broek
wpog said unto the world upon 10/07/2005 12:41: > Hello, > > I have a question about using "IDLE", and that is whenever I start write my > own program in the "Python Shell" it will automatically execute whatever > command I have written, for example: >>> print 'Hello World" > > So, how to I ge

Re: Do a "Python beginners e-mail list" exist?

2005-07-07 Thread Brian van den Broek
Alessandro Brollo said unto the world upon 07/07/2005 03:24: > Far from a professional programmer, I'm simply a > newbie Python user. Two basic questions: > > 1. I don't want to post banal questions about Python > to main Python list. Does a "banal Python questions > list" or a "Python beginners l

Re: precision problems in base conversion of rational numbers

2005-07-05 Thread Brian van den Broek
Terry Hancock said unto the world upon 05/07/2005 11:49: > On Monday 04 July 2005 06:11 am, Brian van den Broek wrote: > >>As a self-directed learning exercise I've been working on a script to >>convert numbers to arbitrary bases. It aims to take any of whole >>nu

precision problems in base conversion of rational numbers

2005-07-04 Thread Brian van den Broek
Hi all, I guess it is more of a maths question than a programming one, but it involves use of the decimal module, so here goes: As a self-directed learning exercise I've been working on a script to convert numbers to arbitrary bases. It aims to take any of whole numbers (python ints, longs, or

Re: Bad Math

2005-07-02 Thread Brian van den Broek
Patrick Rutkowski said unto the world upon 02/07/2005 09:25: > On 7/2/05, Brian van den Broek <[EMAIL PROTECTED]> wrote: > >>Patrick Rutkowski said unto the world upon 02/07/2005 00:12: >> >>>That's... annoying, to say the least. And my number 4/5 was a ra

Re: Another newbie question from Nathan.

2005-07-01 Thread Brian van den Broek
Nathan Pinno said unto the world upon 02/07/2005 02:25: > > Hi all. > > How do I make the computer generate 4 random numbers for the guess? I want > to know because I'm writing a computer program in Python like the game > MasterMind. > > Thanks. > > -- > Nathan Pinno > http://www.n

Re: Bad Math

2005-07-01 Thread Brian van den Broek
Patrick Rutkowski said unto the world upon 01/07/2005 23:56: > I started reading a python book today, one example was: > > 4 / (2.0 + 3) > > 0.8 > > My input/output was: > > 4 (2.0 + 3) > > 0.80004 > > Something smells fishy here... whats up? > > --python 2.4.1

Re: Programmers Contest: Fit pictures on a page

2005-07-01 Thread Brian van den Broek
Robert Kern said unto the world upon 01/07/2005 17:24: > Brian van den Broek wrote: > > >>Well, I found it ironic, but only when you add that the genetic >>algorithm approach came up in the context of a "best fit" problem. >>Survival of the fittest indeed

Re: Programmers Contest: Fit pictures on a page

2005-07-01 Thread Brian van den Broek
Peter Hansen said unto the world upon 01/07/2005 11:47: > Dan Sommers wrote: > >>Peter Hansen <[EMAIL PROTECTED]> wrote: >> >>>This problem is well suited to the abilities of genetic algorithms, >>>and this would probably be an excellent way to learn more about them, >>>even if you don't get the b

Re: I have a question.

2005-06-30 Thread Brian van den Broek
Nathan Pinno said unto the world upon 30/06/2005 11:22: > > Hi all, > > Does Python have a random function? If so, can you show me an example > using it? > > Thanks, > Nathan Pinno > http://www.npinnowebsite.ca/ >>> import random >>> print "It took %s seconds to find the module name

Re: Newbie: Explain My Problem

2005-06-29 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 29/06/2005 03:11: > Code: > > #The Guess My Number Game > > import random > num = "" > guess = "" > counter = 7 > num = random.randrange(1, 100) > print "I'm thinking of a whole number from 1 to 100." > print "You have ", counter, " chances left to guess

Re: How to compress a folder and all of its sub directories and filesinto a zip file?

2005-06-28 Thread Brian van den Broek
Fredrik Lundh said unto the world upon 28/06/2005 08:04: > Brian van den Broek wrote: > > >>So, it would appear that compression requires a 3rd party module, not >>included in Python (and not present on my Windows box). > > > where did you get your Windows Pytho

Re: How to compress a folder and all of its sub directories and files into a zip file?

2005-06-28 Thread Brian van den Broek
could ildg said unto the world upon 28/06/2005 03:29: > but the file is just stored, > and not compressed. > > On 6/28/05, could ildg <[EMAIL PROTECTED]> wrote: > >>Thank you, >>it works~~ >> >>On 6/29/05, Peter Szinek <[EMAIL PROTECTED]> wrote: >> >>>Hi, >>> >>>What about this: >>> >>>import os,

Re: Which kid's beginners programming - Python or Forth?

2005-06-27 Thread Brian van den Broek
BORT said unto the world upon 27/06/2005 23:16: > Please forgive me if this is TOO newbie-ish. > > I am toying with the idea of teaching my ten year old a little about > programming. I started my search with something like "best FREE > programming language for kids." After MUCH clicking and high

Re: [offtopic] Re: Set of Dictionary

2005-06-26 Thread Brian van den Broek
James Dennett said unto the world upon 26/06/2005 03:51: > Steven D'Aprano wrote: > > >>On Thu, 16 Jun 2005 21:21:50 +0300, Konstantin Veretennicov wrote: >> >> >> >>>On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> wrote: >>> >>> I need sets as sets in mathematics: >>> >>>That's tough. First o

Re: Excellent Site for Developers

2005-06-25 Thread Brian van den Broek
Brian said unto the world upon 25/06/2005 10:50: > Do Re Mi chel La Si Do wrote: > >>rather... super troll > > > 100% Agreed. > > Can anyone say, "This looks like spam... Feels like spam... and is about > as useful here in the Python forums as spam -- therfore my conclusion is > that his

Re: How does one write a function that increments a number?

2005-06-24 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 25/06/2005 01:41: > Wait... so this means it is impossible to write a function that > increments an integer without turning the integer into a list? > Well, one of these options will probably suit: >>> def increment_counter(data): ... data += 1 ...

Re: Create our own python source repository

2005-06-21 Thread Brian van den Broek
Michele Simionato said unto the world upon 21/06/2005 07:58: > qwwee: > >>for a certain argument I'd prefer an application fully >>explained (also if not covering all the features) to a more general >>tutorial with only brief and unrelated code snippets. >>Unfortunately, that's not the way things

Re: A tool for Python - request for some advice

2005-06-21 Thread Brian van den Broek
TPJ said unto the world upon 21/06/2005 02:00: > First I have to admit that my English isn't good enough. I'm still > studying and sometimes I just can't express what I want to express. I've graded essays in Philosophy at my university that were written by native speakers of English yet were sub

Re: Python documentation problem

2005-06-18 Thread Brian van den Broek
Xah Lee said unto the world upon 18/06/2005 04:11: > i wanted to find out if Python supports eval. e.g. > > somecode='3+4' > print eval(somecode) # prints 7 > > in the 14 hundred pages of python doc, where am i supposed to find this > info? > > Xah > [EMAIL PROTECTED] > ∑ http://xahlee.org/ >

Re: Python documentation problem

2005-06-18 Thread Brian van den Broek
Xah Lee said unto the world upon 18/06/2005 03:49: > Python documentation, > http://python.org/doc/2.4.1/lib/typesfunctions.html > > - > 2.3.10.3 Functions > > Function objects are created by function definitions. The only > operation on a function object is to call it: func(argu

Re: OO approach to decision sequence?

2005-06-18 Thread Brian van den Broek
Chinook said unto the world upon 18/06/2005 02:17: > OO approach to decision sequence? > - > > In a recent thread (Cause for using objects?), Chris Smith replied with (in > part): > > >> If your table of photo data has several types of photos, and you find >>

Re: prime number

2005-05-30 Thread Brian van den Broek
lostinpython said unto the world upon 2005-05-30 02:50: > It is a homework assignment from a book but not for a class. I'm > trying to teach my self some basic programming before I have to take it > in college. If I show enough understanding of the subject, my advisor > will let me forgo Intro. t

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Brian van den Broek
Duncan Booth said unto the world upon 2005-05-27 04:24: > There are arguments that, especially for beginners, case sensitivity > introduces an extra level of complexity, but the cost of losing this > complexity would be to make Python a poor relation amongst programming > languages. Well, t

Re: Launch file in Notepad

2005-05-12 Thread Brian van den Broek
Fredrik Lundh said unto the world upon 2005-05-12 13:52: > Brian van den Broek wrote: > > >>>I'm trying to lauch Notepad from Python to open a textfile: >>> >>>import os >>>b1="c:\test.txt" >>>os.system('notepad.exe '

Re: Launch file in Notepad

2005-05-12 Thread Brian van den Broek
George said unto the world upon 2005-05-12 09:41: > Newbie question: > > I'm trying to lauch Notepad from Python to open a textfile: > > import os > b1="c:\test.txt" > os.system('notepad.exe ' + b1) > > However, the t of test is escaped by the \, resulting in Notepad trying > to open "c: est.tx

Re: Overiding error message when using a python program

2005-04-22 Thread Brian van den Broek
Sion Arrowsmith said unto the world upon 2005-04-22 13:00: Brian van den Broek <[EMAIL PROTECTED]> wrote: you've not included the part of your code which acts on the user's input. I think you'll find the answer to the question of where the code that acts on the user

Re: time.strftime in 2.4.1 claims data out of range when not

2005-04-22 Thread Brian van den Broek
Sheila King said unto the world upon 2005-04-22 02:45: I have a web app that has been running just fine for several months under Python 2.2.2. We are preparing to upgrade the server to run Python 2.4.1. However, part of my web app is throwing an error on this code (that has previously worked wit

Re: Dictionary question.

2005-04-21 Thread Brian van den Broek
hawkesed said unto the world upon 2005-04-21 20:28: Actually, I think I got it now. Here is what I did: for num in alist: ... if adict.has_key(num): ... x = adict.get(num) ... x = x + 1 ... adict.update({num:x}) ... else: ... adict.updat

Re: New line

2005-04-21 Thread Brian van den Broek
ionic said unto the world upon 2005-04-21 16:34: Ok sorry guys, using the python gui, if i hit the 'enter' key python just executes what ever ive typed. It doesnt take me to the next line. How do i type several lines without executing after each line? Cheers A bit more precision in your question

Re: Private class?

2005-04-21 Thread Brian van den Broek
codecraig said unto the world upon 2005-04-21 09:13: Hi, First, I come from a Java background. ...so that is what I am thinking. However, i guess my issue is how to make EventBus a singleton or prevent it from being instaniated and making it's methods statically accessible. thanks. I don't come

Re: building a small calculator

2005-04-20 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 2005-04-20 08:41: Sorry. This is my first day using Python. Is there an equivelent to the goto command? I want to find some way to take the user back to the main menu. When I first started learning Python some long time after having done some BASIC, I fo

Re: pydoc preference for triple double over triple single quotes--anyreason?

2005-04-18 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-04-18 08:20: The puzzle for me was that if I enter my module name in the "Search for" box, it shows up in the list of results, as expected. But whether the results list entry for my module incorporates the description form my module's docstring or inst

Re: pydoc preference for triple double over triple single quotes-- anyreason?

2005-04-17 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-04-17 16:17: Brian van den Broek wrote: Kent Johnson said unto the world upon 2005-04-16 16:41: Brian van den Broek wrote: I've just spent a frustrating bit of time figuring out why pydoc didn't extract a description from my module docstr

Re: pydoc preference for triple double over triple single quotes -- anyreason?

2005-04-17 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-04-16 16:41: Brian van den Broek wrote: Hi all, I'm posting partly so my problem and solution might be more easily found by google, and partly out of mere curiosity. I've just spent a frustrating bit of time figuring out why pydoc didn&#

pydoc preference for triple double over triple single quotes -- any reason?

2005-04-16 Thread Brian van den Broek
Hi all, I'm posting partly so my problem and solution might be more easily found by google, and partly out of mere curiosity. I've just spent a frustrating bit of time figuring out why pydoc didn't extract a description from my module docstrings. Even though I had a well formed docstring (one l

  1   2   >