What's so funny? WAS Re: rotor replacement

2005-01-22 Thread Brian van den Broek
Paul Rubin said unto the world upon 2005-01-22 20:16: Fredrik Lundh [EMAIL PROTECTED] writes: You're not making any bloody sense. oh, I make perfect sense, and I think most people here understand why I found your little lecture so funny. if you still don't get it, maybe some- one can explain it

Re: how to write a tutorial

2005-01-26 Thread Brian van den Broek
Terry Reedy said unto the world upon 2005-01-26 14:08: Xah the arrogant wrote, among other things, SNIP However, there are several errors in the above that would mislead a Python learner. I advise any such to ignore Xah's writings. Terry J. Reedy Hi all, here's a thought: There isn't any doubt

Re: naive doc question

2005-01-29 Thread Brian van den Broek
Gabriel B. said unto the world upon 2005-01-29 19:38: Is it just me that can't find a full reference in the docs? I wanted a list of all the methods of dict for example... where can i find it? Thanks, and sorry if this question is just dumb, i really can't find it It's just you ;-) Try the Library

Re: returning True, False or None

2005-02-04 Thread Brian van den Broek
Alex Martelli said unto the world upon 2005-02-04 13:02: Steven Bethard [EMAIL PROTECTED] wrote: I have lists containing values that are all either True, False or None, e.g.: [True, None, None, False] [None, False, False, None ] [False, True, True, True ] etc. For a given

Re: [noob] Error!

2005-02-04 Thread Brian van den Broek
administrata said unto the world upon 2005-02-04 17:59: I'm programming Car Salesman Program. It's been 3 days learning python... But, i got problem Write a Car Salesman program where the user enters the base price of a car. The program should add on a bunch of extra fees such as tax, license,

broke IDLE while defining a key-binding scheme

2005-02-04 Thread Brian van den Broek
Hi all, IDLE refuses to launch, and I believe it is because I attempted to define a custom key-binding that it doesn't like. I was recently defining a custom keybinding in IDLE 1.1 under Python 2.4 on WinMe. (I was using the simpler of the two binding definition interfaces.) When done, I hit

Re: returning True, False or None

2005-02-04 Thread Brian van den Broek
Fahri Basegmez said unto the world upon 2005-02-04 23:14: Mick Krippendorf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Fahri Basegmez wrote: reduce(lambda x, y: x or y, lst) This doesn't solve the OPs problem since reduce(lambda x, y: x or y, [False, None]) returns None instead of

Re: empty classes as c structs?

2005-02-05 Thread Brian van den Broek
Steven Bethard said unto the world upon 2005-02-05 14:05: Nick Coghlan wrote: Steven Bethard wrote: Yes -- help me rally behind my generic object PEP which proposes a Bunch type (probably to be renamed) for the Python standard lib. =) Did you see the suggestion of 'namespace' as a name? Yup,

Re: empty classes as c structs?

2005-02-05 Thread Brian van den Broek
Carlos Ribeiro said unto the world upon 2005-02-05 16:35: On Sat, 05 Feb 2005 15:59:00 -0500, Brian van den Broek [EMAIL PROTECTED] wrote: (I'm just a hobbyist, so if this suggestion clashes with some well established use of 'Bag' in CS terminology, well, never mind.) There's already a well know

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-05 Thread Brian van den Broek
Daniel Bickett said unto the world upon 2005-02-05 19:46: I was reading the Pickling and inheritance are making me hurt thread, and the latest suggestion (as of this posting) was to do with the __setstate__ and __getstate__ methods. They caught my attention because I hadn't encountered them

Re: Unable to run IDLE Under Windows

2005-02-07 Thread Brian van den Broek
Peter Otten said unto the world upon 2005-02-07 09:14: Jonathan Polley wrote: I have one account on a WindowsXP machine that refuses to run IDLE (or any other python script that uses Tk). Other people can login to that PC and IDLE runs just fine, so it is not an installation issue. When the

Re: python code with indention

2005-02-07 Thread Brian van den Broek
Xah Lee said unto the world upon 2005-02-07 14:39: is it possible to write python code without any indentation? Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html print It would seem it is indeed possible. print print Note: although I know this, I don't consider myself an print

Re: variable declaration

2005-02-07 Thread Brian van den Broek
Steve Holden said unto the world upon 2005-02-07 17:51: Alexander Zatvornitskiy wrote: Alex! 05 2005 17:00, Alex Martelli All : SNIP AM to all intents and purposes working as if AM it was a declaration. If I had to vote about the one worst formal AM defect of Python, it would surely be

Re: Learning Python - resources and ideas

2005-02-08 Thread Brian van den Broek
[EMAIL PROTECTED] (Cody Houston) said unto the world upon 2005-02-08 05:06: Hi. What is the best way to learn Python? None of the local schools near me teach any courses on the topic. Thanks. -- Cody Houston [EMAIL PROTECTED] Hi Cody, rec.photo.equipment.35mm? -- kind of an odd follow-up for a

Re: variable declaration

2005-02-08 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2005-02-07 20:36: Steve Holden said unto the world upon 2005-02-07 17:51: SNIP The reason global is a wart can clearly be seen in the following example: x = 3 def f(tf, v): ... if tf: ... global x ... x = v ... f(0, 5) x 5 SNIP Hi

Re: goto, cls, wait commands

2005-02-10 Thread Brian van den Broek
BOOGIEMAN said unto the world upon 2005-02-10 16:06: OK, thanks all Here's presentation of my advanced programming skills :) import os import time os.system(cls) number = 78 guess = 0 while guess != number: guess = input(Guess number: ) if

Re: Unit Testing in Python

2005-02-10 Thread Brian van den Broek
rhat said unto the world upon 2005-02-10 21:10: Hi Everyone, I've recently been reading some articles about unit-testing in Python [1] [2], but I am a bit confused: where do I go to get started with this? I tried googling for unittest but all I've found are some old links to projects that already

Re: problem with tutor mailing

2005-02-16 Thread Brian van den Broek
administrata said unto the world upon 2005-02-16 16:11: i'm using tutor maling... i e-mail some questions to tutor and get answers. but, i frequently get mails which aren't related with my question. how should i stop it? You do know it's a mailing list that you've subscribed too, right? As in,

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 with n given

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 instead of:

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 1,

Re: compare list

2005-11-14 Thread Brian van den Broek
Ben Bush said unto the world upon 2005-11-14 23:20: trimmed and un-top-posted 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,5] lisC=[5,6,3] lisD=[11,14,12,15] how can I write

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 myself :-( snip

Re: compare list

2005-11-15 Thread Brian van den Broek
Ben Bush said unto the world upon 2005-11-15 01:24: top posting corrected and post trimmed 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:

Re: hello all

2004-12-03 Thread Brian van den Broek
Ishwor Gurung said unto the world upon 2004-12-03 03:36: Hello all, I am just starting out on learning Python and joined this list. I have grabbed the Learning Perl book by Mark David. This book really seems good so far.. the concepts are explained pretty nicely. :) I have a background a bit in

Re: How did you learn Python?

2004-12-03 Thread Brian van den Broek
Shawn Milo said unto the world upon 2004-12-03 09:54: I was just wondering what the best books were for learning Python. Which books are good for getting started, and which should be saved for later, or or not useful except as a reference for the learned? I have a decent programming background in

Re: simple GUI question

2004-12-08 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2004-12-08 03:16: SNIP Hi, I don't know Tkinter past a hour of playing, so I cannot show you how. I can, however, show you a good place to start looking: http://www.google.com/search?num=50hl=enq=Tkinter+Python+font+widgetbtnG=Searchmeta= Best, Brian

Re: uptime for Win XP?

2004-12-12 Thread Brian van den Broek
Esmail Bonakdarian said unto the world upon 2004-12-12 20:45: Greg Krohn wrote: if you have win32all installed, you can get it from Python: import win32api print Uptime:, win32api.GetTickCount(), Milliseconds Uptime: 148699875 Milliseconds Hi Greg! Thanks, that was usefull, esp since I had

lowering the case of strings in list -- WAS: (No subject)

2004-12-16 Thread Brian van den Broek
Mark Devine said unto the world upon 2004-12-16 10:49: Hi I'm brand new to python and I was wondering if anybody knew of a easy way to change every character in a list into its lower case form. The list is like so: commands = ['CLASS-MAP MATCH-ALL cmap1', 'MaTch Ip AnY', 'CLASS-map Match-Any

mailing list welcome welcome msg in wiki suggestion

2004-12-12 Thread Brian van den Broek
Hi all, There have been a few posts over the last month or so expressing a bit of exasperation with the rising tide of newbie's. (Or, more accurately, the rising tide of questions from newbie's not trying to follow ESR's advice.) A month or so ago (in a thread found here:

Re: NO REALLY

2004-12-15 Thread Brian van den Broek
Peter Hansen said unto the world upon 2004-12-15 17:39: Martijn Faassen wrote: Jive wrote: Isn't there a comp.lang.flame or something? I've doublechecked, but I didn't see any significant flaming in this article (and I'm generally not very tolerant of it). My PSU posting was certainly not

Re: Boo who? (was Re: newbie question)

2004-12-20 Thread Brian van den Broek
Doug Holton said unto the world upon 2004-12-20 18:45: Peter Hansen wrote: Doug Holton wrote: Peter Hansen wrote: Virtually identical indeed. :-) SNIP I gave such a short answer because the way you framed your questions and the context of your post made it clear you are a troll. Your reply here

Re: input record sepArator (equivalent of $| of perl)

2004-12-21 Thread Brian van den Broek
John Machin said unto the world upon 2004-12-21 18:20: Subtle distinction: A metER is a measuring device. A MetRE is a unit of distance. Not everyone agrees http://www.bartleby.com/61/18/M0251800.html. I do, but then I think it ought be spelled 'colour', too. Best, Brian vdB --

Dubious Python WAS: Re: Lambda going out of fashion

2004-12-24 Thread Brian van den Broek
Fernando Perez said unto the world upon 2004-12-23 14:42: Alex Martelli wrote: I don't know what it IS about lambda that prompts so much dubious to absurd use, but that's what I observed. I don't know if that plays any role in Guido's current thinking, though -- I have no idea how much dubious

Re: Cookbook 2nd ed Credits (was Re: The Industry choice)

2005-01-04 Thread Brian van den Broek
Alex Martelli said unto the world upon 2005-01-04 11:15: [EMAIL PROTECTED] wrote: But then I have THREE published recipes!! Does that mean that I get three free copies of the cookbook ? ;-) ...ti piacerebbe eh...?-) Sorry, one each, even though you have _five_ credits. For the curious, here's

Re: DOS problem (simple fix??)

2005-01-07 Thread Brian van den Broek
Gavin Bauer said unto the world upon 2005-01-07 15:47: My DOS window (running in windows ME) closes the second it finishes running my programs. As you can imagine, this makes it hard to see the SNIP Thank you, and please make all answers simple enough to be understood by a highschool student and

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

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 __init__(self): print self.__v, self.u class Derived(Base): __v, u = Derived v

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

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

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 use them.

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: 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 obvious

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

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 have the chance of changing the

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= lambda x,y: cmp(orig_list.index(x), orig_list.index(y))) new_list [3, 1, 2] A better

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: snip 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 has volunteered to guide me

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 the

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 coming back across the

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 the reason

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: 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 having success following the online

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 need to be

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 constructor

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: 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 already

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's

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 programmers would probably have

__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: __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 self.__class__.__name__ == __TwoUnderBase: print From

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: snip 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,

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. to

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 yourself

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:

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: 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

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 are

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

2005-06-25 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: 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 VB message

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 of all, mathematical sets can be

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-level

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,zipfile from os.path import join

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 Python? afaik, the zlib module has been

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 the number. print

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 named random by

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 best solution.

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 :-) Optimization codes don't always succeed

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: Another newbie question from Nathan.

2005-07-02 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

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 rational number too; I can understand how when doing 1

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,

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 numbers (python ints, longs, or Decimals

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 list

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 get it to not

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. Regards and

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

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 help()

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 allows

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 because I think

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

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: snip 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: 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): if (coin == 0):

Re: duplicate docstrings

2005-02-19 Thread Brian van den Broek
Steven Bethard said unto the world upon 2005-02-18 13:58: I have two classes that implement the same interface, e.g. something like: class C(object): def foo(self): Foo things ... def bar(self): Bar things ... def baz(self): Baz things in a C

Re: NOOB coding help....

2005-02-22 Thread Brian van den Broek
Igorati said unto the world upon 2005-02-22 03:51: #This program will ask for a user to imput numbers. The numbers will then be calculated #to find the statistical mean, mode, and median. Finallly the user will be asked #if he would like to print out the answers. numbers = [ ] print 'Enter

Re: Selective HTML doc generation

2005-02-23 Thread Brian van den Broek
Graham said unto the world upon 2005-02-23 09:42: Hi. I'm looking for a documentation generation tool (such as pydoc, epydoc, happydoc, etc.) that will allow me to filter what it includes in it's output. I only want the reader to know about classes and methods in my package if if the classes have

Re: Selective HTML doc generation

2005-02-24 Thread Brian van den Broek
Graham Ashton said unto the world upon 2005-02-24 04:54: Thanks Brian, much appreciated. Looks quite straightforward. Graham Hi Graham, glad it helped -- I think this marks the first time I've given a useful answer to a non-trivial question on comp.lang.python. :-) context for future thread

Re: Need help running external program

2005-02-27 Thread Brian van den Broek
Rigga said unto the world upon 2005-02-27 15:04: Tim Jarman wrote: SNIP No, the r was the point - it's there to tell Python not to do any escaping on the string. Try it again with the r and see what happens. Brilliant!!! that works a treat thankyou!!, where on earth did you find out about the 'r'

Re: Trees

2005-02-27 Thread Brian van den Broek
Alex Le Dain said unto the world upon 2005-02-27 19:54: Would this be for a GUI toolkit or maybe using a standard class scheme? Sorry, yes I should have been more specific. I meant a non-GUI, standard class scheme. I want to use the scheme to hold a structure in memory and retrieve/add

Re: Python 2.4 removes None data type?

2005-03-07 Thread Brian van den Broek
Steven Bethard said unto the world upon 2005-03-07 11:55: Warren Postma wrote: Michael Hoffman wrote: The fact that True and False are not constants? Yowza. a = True b = False False = a True = b if (1==2)==True: print Doom Why stop there when you can really cause some doom: py import

Re: Tkinter WEIRDNESS or Python WEIRDNESS?

2005-03-11 Thread Brian van den Broek
steve said unto the world upon 2005-03-12 00:06: In a nutshell, my problem is that I am getting this runtime error, and I have no clue why. Please bear in mind its my first python program: localvariable 'currentAbility' referenced before asignment in this function which is a callback for a

  1   2   >