__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 se

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

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: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-31 Thread Brian van den Broek
Hi all, a question about using parenthesis for tuples veered very far off topic before I returned from a trip and found the thread. I've a comment on the original topic, and then a comment off-topic even for the off-topic direction in which the thread ended up :-) The on-topic: the use of '(' a

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

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 Thank you, and please make all answers simple enough to be understood by a highschool student and his fa

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

Re: Python 2.1 - 2.4 differences

2005-01-24 Thread Brian van den Broek
"BOOGIEMAN" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I found some e-book about Python 2.1, I want to print it but just to check first if sintax of Python 2.1 is same as 2.4 ? Also does anybody know where can I download any newer Python related e-book, because there isn't any p

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

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: Where are list methods documented?

2005-02-01 Thread Brian van den Broek
Grant Edwards said unto the world upon 2005-02-01 12:21: I'm trying to figure out how to sort a list, and I've run into a problem that that I have tripped over constantly for years: where are the methods of basic types documented? The only thing I can find on a list's sort() method is in the tutor

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 l

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

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 th

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

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, it'

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.) T

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 befor

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

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

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: 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: 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: 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: 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: 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: 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: empty classes as c structs?

2005-02-07 Thread Brian van den Broek
Alex Martelli said unto the world upon 2005-02-06 18:06: 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.) Yep: a Bag is a more common

RESOLVED broke IDLE while defining a key-binding scheme

2005-02-07 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2005-02-04 22:21: 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. shortcuts, etc.) by clicking on it. Nothing. Ran idle.py instead > . The DOS-console this b

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 pers

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 писал: 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> defec

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 post

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: 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 ... &g

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

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 thi

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 numbers

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 d

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. :-) G: Hi. I'm looking for a docum

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

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 info

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 __bui

Re: using the set command

2005-03-11 Thread Brian van den Broek
Leeds, Mark said unto the world upon 2005-03-11 20:03: Do I have to import something In order to use the set command ? I am trying to use it but I keep getting an error. Mark The answer depends upon which version of Python you are using. That information, along with

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 butto

Re: Tkinter WEIRDNESS or Python WEIRDNESS?

2005-03-12 Thread Brian van den Broek
steve said unto the world upon 2005-03-12 18:46: Brian van den Broek <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... 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

Re: try / except not worknig correctly

2005-03-12 Thread Brian van den Broek
'@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])]) said unto the world upon 2005-03-12 19:20: the code below will not execute the except section when i enter a number. what am i missing ? # .while 1: . print 'Pump Protection ? ' . #line 133 .

Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-13 Thread Brian van den Broek
Martin v. Löwis said unto the world upon 2005-03-10 20:55: Anthony Baxter wrote: On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.1 (release candidate 1). I'd like to encourage feedback on whether the Windows installer works for peo

[OT] Re: Python becoming less Lisp-like

2005-03-16 Thread Brian van den Broek
news.sydney.pipenetworks.com said unto the world upon 2005-03-16 05:57: trust the guy to do a good job. If you don't, then you can write it yourself which means you can do exactly how you want it which again makes the whole argument mute. Anyone else having images of mimes engaged in street figh

Re: newbie : modifying a string in python

2005-03-16 Thread Brian van den Broek
Leeds, Mark said unto the world upon 2005-03-16 14:46: I want to modify a string in the following way : for s in stks: s = s.strip() if ( s[-2:] == 'GR' ): s[-2:]= 'GF' so, if the last two characters are GR, I want to change them to GF ( there will be other if statem

replace from end of string?

2005-03-16 Thread Brian van den Broek
Hi all, in writing my response to Mark Leeds' recent question about replacing text at the end of a string, I was moved to wonder if it wouldn't it be handy if the replace method of string instances did one of the following: took a negative integer for count and interpreted that as replace the

Re: newbie:unique problem

2005-03-17 Thread Brian van den Broek
Leeds, Mark said unto the world upon 2005-03-17 14:08: I have a function uniqueList that is below : Def uniqueList(origList): nodups= {} for temp in origList: nodups[temp] = None returns nodups.keys() When used in the following context : industryList = uniqueList(jpb

Re: newbie:unique problem

2005-03-17 Thread Brian van den Broek
Heiko Wundram said unto the world upon 2005-03-17 16:29: On Thursday 17 March 2005 20:08, Leeds, Mark wrote: But, I also want it to get rid of the AAA KP because there are two AAA's even though the last two letters are different. It doesn't matter to me which one is gotten rid of but I don't know h

Re: newbie:unique problem

2005-03-18 Thread Brian van den Broek
Heiko Wundram said unto the world upon 2005-03-18 01:27: On Thursday 17 March 2005 23:31, Brian van den Broek wrote: Am I not right in thinking that with the dict approach there is no guarantee that the order from the original list will be preserved? Yup, absolutely right that the original

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Brian van den Broek
Raymond Hettinger said unto the world upon 2005-03-18 20:24: I would like to get everyone's thoughts on two new dictionary methods: def count(self, value, qty=1): try: self[key] += qty except KeyError: self[key] = qty def appen

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-03-19 07:19: Brian van den Broek wrote: Raymond Hettinger said unto the world upon 2005-03-18 20:24: I would like to get everyone's thoughts on two new dictionary methods: def appendlist(self, key, *values): try:

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: window size in IDLE

2004-12-03 Thread Brian van den Broek
p.kosina said unto the world upon 2004-12-03 04:04: Can I somehow in config-main.cfg set how big shall (and where) open the IDLE window? Cause in my w98 it is always opening so that I can not see the bottom line Thank you Pavel Hi Pavel, I had the same issue with IDLE 1.03 running on Pytho

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 V

Re: simple GUI question

2004-12-08 Thread Brian van den Broek
Roose said unto the world upon 2004-12-08 02:23: You want somthing like: root = Tkinter.Tk() root.withdraw() msg = tkMessageBox.showwarning("Ooops", "Some warning") Awesome thanks! Any chance you know about the font thing : ) Nah I'll stop being lazy and hack it... but for some reason Tkinter doe

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: 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=50&hl=en&q=Tkinter+Python+font+widget&btnG=

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 sinc

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

Re: Adding paths to sys.path permanently, and another problem...

2004-12-16 Thread Brian van den Broek
Jeff Shannon said unto the world upon 2004-12-16 17:54: Amir Dekel wrote: 2. os.path.expanduser("~") always gives me "C:\\" instead of my homepath. I have tried to change my homepath in WinXP using set homepath(in command line), and alsaw using the "Environment Variables" in WinXP system propert

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: http://tinyurl.com/5

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 intend

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. :-) 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 . I do, but then I think it ought be spelled 'colour', too. Best, Brian vdB -- http://mail.pyth

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 P

Re: Global variables and modules

2004-12-24 Thread Brian van den Broek
Alex Martelli said unto the world upon 2004-12-24 03:23: <[EMAIL PROTECTED]> wrote: If you really must, consider using a container object. The most suitable container object for these tasks is often a module. I.e., code, in test1: import test2 and then refer to test2.glbl throughout. I.e., forg

Python limericks (was Re: Text-to-speech)

2005-03-20 Thread Brian van den Broek
Steve Holden said unto the world upon 2005-03-20 16:18: Since it's PyCon week, I will offer a prize of $100 to the best (in my opinion) limerick about Python posted to this list (with a Cc: to [EMAIL PROTECTED]) before midday on Friday. The prize money will be my own, so there are no other rule

Re: Text-to-speech

2005-03-21 Thread Brian van den Broek
Paul McGuire said unto the world upon 2005-03-21 03:10: How about a clerihew instead of a limerick? Guido van Rossum Had an idea most awesome. When he lost track of his braces, Just replaced them with spaces. -- Paul McGuire Hi all, that's pretty good, Paul. However, I must insist that you both cea

Re: Beginner Question - Very Easy I'm Sure...

2005-03-24 Thread Brian van den Broek
Todd_Calhoun said unto the world upon 2005-03-24 16:13: I'm trying to generate a random number, and then concetate it to a word to create a password. I get the number and assign it to a variable: + word = "dog" import random rannum = random.randrange(100,999) str(rannu

Re: list-comprehension and map question (simple)

2005-03-27 Thread Brian van den Broek
Charles Hartman said unto the world upon 2005-03-27 09:51: I understand this toy example: lines = "this is a group\nof lines of\nwords" def getlength(w): return len(w) s = map(getlength, [word for ln in lines.split() for word in ln.splitlines()]) (now s is [4, 2, 1, 5, 2, 5, 2, 5]) My question i

Re: list-comprehension and map question (simple)

2005-03-27 Thread Brian van den Broek
Charles Hartman said unto the world upon 2005-03-27 13:35: On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote: >>> def some_arbitrary_function(y): ... return ( (y * 42) - 19 ) % 12 ... >>> [some_arbitrary_function(len(x)) for x in lines.split()] [5, 5, 11, 11, 5, 11, 5,

Re: list-comprehension and map question (simple)

2005-03-27 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2005-03-27 14:12: Charles Hartman said unto the world upon 2005-03-27 13:35: On Mar 27, 2005, at 1:18 PM, Brian van den Broek wrote: >>> def some_arbitrary_function(y): ... return ( (y * 42) - 19 ) % 12 ... >>> [some_arbitrary_func

Re: String Splitter Brain Teaser

2005-03-27 Thread Brian van den Broek
James Stroud said unto the world upon 2005-03-27 17:39: Hello, I have strings represented as a combination of an alphabet (AGCT) and a an operator "/", that signifies degeneracy. I want to split these strings into lists of lists, where the degeneracies are members of the same list and non-degene

Re: String Splitter Brain Teaser

2005-03-27 Thread Brian van den Broek
Michael Spencer said unto the world upon 2005-03-27 20:04: James Stroud wrote: Hello, I have strings represented as a combination of an alphabet (AGCT) and a an operator "/", that signifies degeneracy. I want to split these strings into lists of lists, where the degeneracies are members of the s

  1   2   >