Re: [Tutor] killing a thread

2005-02-22 Thread Max Noel
On Feb 22, 2005, at 23:08, Bill Mill wrote: If I recall correctly, there is not a direct way. Instead, you're going to want to have your worker thread check a queue it shares with the parent every so often to see if the supervisor thread has sent a quit message to it. Peace Bill Mill bill.mill at

Re: [Tutor] Trivia program.

2005-02-16 Thread Max Noel
On Feb 16, 2005, at 10:26, . Sm0kin'_Bull wrote: it prints like...   John GoodmanJohn GoodmanJohn GoodmanJohn GoodmanJohn Goodman   But i want to print it like...   John Goodman  John Goodman  John Goodman  John Goodman  John Goodman   How can I do it? Try replacing the called = name * 5 line

Re: [Tutor] Queued threads

2005-02-15 Thread Max Noel
On Feb 16, 2005, at 01:58, Bernard Lebel wrote: Now, I have a list of jobs, each job being a windows bat file that launches an executable and performs a rendering task. So I have this queue of jobs, and would like to launch one only when the previous one has finished, and in a separate window.

Re: [Tutor] Queued threads

2005-02-15 Thread Max Noel
On Feb 16, 2005, at 02:36, Liam Clarke wrote: I'm sorry, but when does oThread get the value 1? If you're testing for it's existence via a True/False thing, try if oThread: But otherwise, I'm not sure what you're expecting to get. Once again, you hit the spot, Liam. It seems that a Thread object

Re: [Tutor] Problems with test cgi script on windows XP/Apache

2005-02-14 Thread Max Noel
On Feb 14, 2005, at 22:18, Liam Clarke wrote: Windows, she is a woman, and woman are mysterious in their little quirks. Unfortunately, you cannot divorce her, for she controls your software and you really need DirectX if you want to play Sid Mier's Pirates! Actually, you can find Atari ST and

Re: [Tutor] newbie OSX module path question

2005-02-14 Thread Max Noel
On Feb 15, 2005, at 02:38, Mike Hall wrote: Ok, I've got it working. The environment.plist file wants a path beginning with /Users, not /Local_HD. So simple! Thanks everyone. Yeah, the system hard drive on Mac OS X (which is seen as Macintosh HD, or in your case Local HD in the Finder) is

Re: [Tutor] calling an external program

2005-02-13 Thread Max Noel
On Feb 14, 2005, at 10:37, Lobster wrote: - I am trying to call up an external program with something like a Shell command - can not find a way of doing this (in windows) Any hints? What about os.system('your_command_here')? -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 Look at you

Re: [Tutor] Perl Symbology (was: Are you allowed to shoot camels?)

2005-02-10 Thread Max Noel
On Feb 10, 2005, at 19:50, Bill Mill wrote: so #{variable} seems to do it. The googling shows that there are a myriad of other ways, which I haven't even looked at. They all seem to involve #{[symbol]variable} . Here, [symbol] refers to the scope(?) of the variable. See the discussion between me

Re: e-mail address change (was Re: [Tutor] python's default argument value handling in functions - weird syntax? problem grappling with the concept)

2005-02-09 Thread Max Noel
On Feb 10, 2005, at 03:07, Ismael Garrido wrote: Danny Yoo wrote: ### def f(a,L=[]): if L==[5]: print 'L==[5] caught' print L print 'resetting L...' L=[] L.append(a) return L ### Now I'm dizzy... I can't understand why there are two L! L is a local variable of

Re: [Tutor] Hex to Str - still an open issue

2005-02-06 Thread Max Noel
On Feb 6, 2005, at 08:59, Liam Clarke wrote: Ah, yeah, gotta get me one of those textbooks. (Wait a minute, that would mean, my approach wasn't the textbook approach... /me salvages a little pride.) While I jest somewhat, that highlights a serious deficiency in my education that becomes more and

Re: [Tutor] This Deletes All my Files

2005-02-04 Thread Max Noel
On Feb 4, 2005, at 06:39, Chad Crabtree wrote: I've tried this and I cannot figure out why this does not work. I figure this has something to do with order of operations. I figured someone would know exactly why it doesn't work. Wouldn't this start inside parens then from left to right?

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-03 Thread Max Noel
On Feb 3, 2005, at 09:48, Alan Gauld wrote: Pythons lambda feature is a bare minimum (and Guido wants to remove it!). Does he? Damn, just when I was learning functional programming! (in Haskell, if you're curious ^^) Yes the Japanese thing is an issue. THere are a few English books now, and the

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-03 Thread Max Noel
On Feb 3, 2005, at 23:19, Alan Gauld wrote: Sean, what book/tutor are you using for Haskell? I learned it from The Haskell School of Expression which was OK but very graphics focused, I'd be interested in recommended second source on Haskell. I'm not Sean, but I'm using Simon Thompson's Haskell:

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-03 Thread Max Noel
On Feb 3, 2005, at 23:41, Jeff Shannon wrote: (But then, at my job I'm stuck using a horrible Frankenstein's monster of a proprietary language on a daily basis, so I can't help but believe that there's plenty more awful languages around that didn't happen to be rescued from oblivion by an

Re: [Tutor] how to separate hexadecimal

2005-02-02 Thread Max Noel
On Feb 2, 2005, at 10:19, Ewald Ertl wrote: Hi! Using binary operations: a='0x87BE' str(hex(int(a,16) 0xFF)) '0xbe' str(hex((int(a,16) 0xFF00) / 0xFF)) '0x87' HTH Ewald Actually, the int conversions aren't even necessary. hex(0x87BE 0xFF) '0xbe' hex((0x87BE 0xFF00) / 0xFF) '0x87' -- Max

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-02 Thread Max Noel
On Feb 2, 2005, at 23:18, Liam Clarke wrote: 1) I'll use Perl for the regex stuff from now on, Perl is obviously built for this. Actually IIRC Perl *invented* regexes as we know them. The standard regex syntax is known as Perl regex syntax. 2 ) There's More Than One Way To Do It makes debugging

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-02 Thread Max Noel
(damn, forgot to add the main part of my argumentation) I learnt Perl as well, a few years ago. It was the first scripting language I came across (all I knew before that were C, Turbo Pascal, and a few calculator programming languages), so I immediately fell in love with its string

Re: [Tutor] Classes

2005-02-01 Thread Max Noel
On Feb 1, 2005, at 23:08, Ismael Garrido wrote: Hello. I was just wondering, what magic can you do with classes? I mean, things like class Name(Exception) or class Name(threading.Thread), which other classes are interesting to subclass? I've seen Object too, but I don't understand what it does.

Re: [Tutor] carriage return on windows

2005-01-29 Thread Max Noel
On Jan 30, 2005, at 02:18, R. Alan Monroe wrote: print Percent completed: + str(percent) + \r Print forces a newline. Try sys.stdout.write instead. Alan You can also use the following syntax: print Percent completed:, str(percent), \r, The trailing comma is NOT a typo, it is intentional. It

Re: [Tutor] New to Python

2005-01-26 Thread Max Noel
On Jan 27, 2005, at 02:09, Jason White wrote: I'm curious about good tutorial websites and books to buy. I learned Python (well, the basics thereof -- enough to do useful stuff on my summer job, anyway ^^) in an afternoon using the official tutorial that's found somewhere on

Re: [Tutor] sorting a 2 gb file

2005-01-25 Thread Max Noel
On Jan 25, 2005, at 23:40, Danny Yoo wrote: In pseudocode, this will look something like: ### hints = identifyDuplicateRecords(filename) displayDuplicateRecords(filename, hints) ### My data set the below is taken from is over 2.4 gb so speed and memory considerations come into play. Are sets more

Re: [Tutor] ascii encoding

2005-01-25 Thread Max Noel
On Jan 26, 2005, at 00:50, Luis N wrote: Ok, urllib.quote worked just fine, and of course so did urllib.pathname2url. I should have run a dir() on urllib. Those functions don't appear in http://docs.python.org/lib/module-urllib.html Now, how might one go about calculating the New York time

Re: [Tutor] ascii encoding

2005-01-25 Thread Max Noel
On Jan 26, 2005, at 02:56, Luis N wrote: In other words I have to do some arithmetic: import time time.timezone 0 The server is located in Dallas, Texas. Which means it's not properly configured. On UNIX systems, to configure the timezone, you must adjust /etc/localtime so that it's a symlink

Re: [Tutor] Should this be a list comprehension or something?

2005-01-25 Thread Max Noel
On Jan 26, 2005, at 03:17, Terry Carroll wrote: My goal here is not efficiency of the code, but efficiency in my Python thinking; so I'll be thinking, for example, ah, this should be a list comprehension instead of a knee-jerk reaction to use a for loop. Comments? The point of the code is to take

Re: [Tutor] ascii encoding

2005-01-24 Thread Max Noel
On Jan 24, 2005, at 23:29, Luis N wrote: How would I best turn this string: '2005-01-24 00:00:00.0' into this string: '2005%2D01%2D24%2000%3A00%3A00%2E0' In order to call a URL. I've hunted through the standard library, but nothing seemed to jump out. The pathname2url in urllib seems to do

Re: [Tutor] How would python messure up in performance?

2005-01-23 Thread Max Noel
On Jan 23, 2005, at 12:55, Kevin wrote: How well would a multi user texed based game created in just Python run if there were over 300 - 400 players (Just a hypathetical question) Would python be to slow to handle that amount of traffic? It depends... What would be happening in said game? What

Re: [Tutor] on the way to find pi

2005-01-23 Thread Max Noel
This code gives the number in an unusual format like 3.1415'None' it has a number part and a string part . I want to seperate these from easc other but I couldn't manage. I mean when I try to turn it into string format then try to use things like [:4] or like that they don't work.Any idea how

Re: [Tutor] Print record x in a file

2005-01-23 Thread Max Noel
On Jan 23, 2005, at 22:08, Liam Clarke wrote: Don't you mean x=random.randint(0, lenoflist) ?? I'm assuming you want an integer. random.randrange() returns an item (which can be a float or whatever, but by default is an int) in the specified range. In that case, an int between 0 and lenoflist.

Re: [Tutor] read line x from a file

2005-01-22 Thread Max Noel
On Jan 22, 2005, at 13:53, Kent Johnson wrote: That is the simplest solution. If your file gets bigger and you don't want to read it all at once, you can use enumerate to iterate the lines and pick out the one you want: f = open(...) for i, line in enumerate(f): if i==targetLine: print

[Tutor] Importing multiple files as a single module?

2005-01-21 Thread Max Noel
Hi everyone, Having learnt OOP with C++, and most of my OOP experience being with Java, I'm used to storing my classes in one file for each class. I find it tidier and easier to read/debug. However, when I try to do the same in Python, each file corresponds to a module with a single class in

Re: [Tutor] A somewhat easier way to parse XML

2005-01-19 Thread Max Noel
On Jan 19, 2005, at 03:58, David Rock wrote: For me, it seems that the way you are supposed to interact with an XML DOM is to already know what you are looking for, and in theory, you _should_ know ;-) Indeed. The problem is, even if I know what I'm looking for, the problem remains that given

Re: [Tutor] Objects Classes...

2005-01-18 Thread Max Noel
On Jan 18, 2005, at 03:46, Liam Clarke wrote: Curious - what's mod_python? A Python module for the Apache web server, that among other things addresses the main shortcoming of CGI: mod_python (and mod_perl, mod_php and mod_ruby, for that matter) keeps the interpreter into memory (and as part

Re: [Tutor] Shadowrun programs

2005-01-18 Thread Max Noel
On Jan 18, 2005, at 17:52, Jack Cruzan wrote: Greetings! Ok if any of you read my earlier email you would have seen that: A) I am a newbie programmer. B) A Shadowrun gamer. C) In over my head making a SRCG (Shadowrun Character Generator) so with that in mind gave up making my python based SRCG.

Re: [Tutor] style question: when to hide variable, modules

2005-01-18 Thread Max Noel
On Jan 18, 2005, at 22:50, Kent Johnson wrote: Python, instead, lets you change what attribute access means. The way to do this is with 'properties'. This is kind of an advanced topic, here are two references: http://www.python.org/2.2.1/descrintro.html#property

[Tutor] A somewhat easier way to parse XML

2005-01-18 Thread Max Noel
Hi everyone, I've just spent the last few hours learning how to use the DOM XML API (to be more precise, the one that's in PyXML), instead of revising for my exams :p. My conclusion so far: it sucks (and so does SAX because I can't see a way to use it for OOP or recursive XML trees). I'm

Re: [Tutor] Objects Classes...

2005-01-17 Thread Max Noel
On Jan 17, 2005, at 20:51, Jack Cruzan wrote: Ok, so each character has his name, race, his stats, his skills, and his gear. since the name and character is unique there is no need for a class these things. hmmm maybe I am conceptualizing this wrong. would each new character then be a dictonary?

Re: [Tutor] COP vs OOP

2005-01-17 Thread Max Noel
On Jan 17, 2005, at 23:07, Bernard Lebel wrote: Okay... so if I follow you, a class that has methods not part of itself, it's not a static class...? So should I understand that a class that gets inherited methods can be considered OOP? Not exactly. Basically, object-oriented programming is just

Re: [Tutor] Objects, persistence getting

2005-01-16 Thread Max Noel
On Jan 16, 2005, at 21:13, Liam Clarke wrote: If I understand correctly, once an object is created, as long as references to it exist, it isn't garbage collected. Correct, more or less (in the exception case where a references b, b references a but nothing else references either, both are GC'd

Re: [Tutor] Help

2005-01-14 Thread Max Noel
On Jan 10, 2005, at 14:31, john stanley wrote: This is my first attempt at programing and my first program sort of did work hear is the program and if any one can tell me what i did wrong or forgot i would appreciate it a = input(Type in the Grose: ) b = input(type in the Miles: ) print a *

Re: [Tutor] List comprehensions

2005-01-13 Thread Max Noel
On Jan 13, 2005, at 04:13, Bob Gailer wrote: I like Kent's response. foobar(item)/0 is a valid expression. It fits the grammar of expressions. The fact that it raises an exception does not make it an invalid expression. Consider foobar(item)/xyz. It is valid. If xyz == 0 then it will also

Re: [Tutor] atof error

2005-01-11 Thread Max Noel
On Jan 11, 2005, at 20:25, Mike Procario wrote: I got an unexpected error today using string.atof. ValueError: invalid literal for float(): -17,019.797 To me -17,019.797 looks like a perfectly good floating point number. I cannot find documentation on what the allowed range is. The problem is not

Fwd: [Tutor] More and more OT - Python/Java

2005-01-11 Thread Max Noel
(yes, forgot to CC the list again -- argh!) Begin forwarded message: From: Max Noel [EMAIL PROTECTED] Date: January 11, 2005 23:33:44 GMT To: Liam Clarke [EMAIL PROTECTED] Subject: Re: [Tutor] More and more OT - Python/Java On Jan 11, 2005, at 23:15, Liam Clarke wrote: Out of curiousity, having

Re: [Tutor] More and more OT - Python/Java

2005-01-11 Thread Max Noel
On Jan 12, 2005, at 01:40, Liam Clarke wrote: So, you've got the XML like - descript You are standing in front of a stump. A path leads north. /descript exits N /exits and you have a XSL that works like a CSS? descript {font:arial, align:center} exits style:bolder Is that a good paraphrasing?

Re: [Tutor] Modifying game of life

2005-01-10 Thread Max Noel
On Jan 10, 2005, at 17:53, Kooser, Ara S wrote: Does anyone have an suggestions, explanations, websites? Thanks. Ara import random perc = raw_input(Please enter a threshold between 0-1. ) raw_input(Press return to make a world) PERSON, EMPTY = '*', '.' def percolation(perc): randval =

Re: [Tutor] More and more OT - Python/Java

2005-01-10 Thread Max Noel
On Jan 10, 2005, at 22:00, Liam Clarke wrote: Hehe, I'm not up to collections yet... working through Learning Java by O'Reilly. If you already know a bit about OOP, I would recommend that you read bruce Eckel's Thinking in Java. An excellent book, freely available on-line (do a quick Google

Re: [Tutor] More and more OT - Python/Java

2005-01-10 Thread Max Noel
On Jan 11, 2005, at 01:38, Kent Johnson wrote: Max Noel wrote: A good follow-up to that would be McMillan Wiggleswrorth's Java Programming - Advanced Topics, through which I'm currently reading. It has some really good stuff, including things about XML parsing with SAX and DOM... I may

Re: [Tutor] More and more OT - Python/Java

2005-01-10 Thread Max Noel
dom4j? What is it? Is it part of the standard Java distribution? If not, where can it be found? Update: Okay, looks like it's time to go to bed. The link was in bright blue and somehow I didn't see it. D'oh. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 Look at you hacker... A pathetic

Re: [Tutor] Re: The Game of Life

2005-01-06 Thread Max Noel
On Jan 6, 2005, at 21:20, Brian van den Broek wrote: Oh, the Life rules allow a world where every cell will change in the next generation, iff your world is a torus (i.e. the lower row touches the upper row as if it were immediately above it, and the right column touches the left column as

Re: [Tutor] Lottery simulation

2005-01-05 Thread Max Noel
On Jan 5, 2005, at 16:33, ümit tezcan wrote: Are there any starting ideas for me to get going on this project either thru the tutor or searching for snippets already created by fellow programmers?? That's probably obvious, but you should proceed as follows: - Generate a number for each person.

Re: [Tutor] Popen? or something else

2004-12-22 Thread Max Noel
On Dec 22, 2004, at 22:24, Israel C. Evans wrote: Fun! testo = [line for line in commands.getoutput('ls -la').split('\n')] for line in testo: print line spits out nicely formatted ls data. It's Shelly! I haven't tried it, but the above code looks like it could be simplified to: for line in

Re: [Tutor] AttributeError: instance has no __call__ method

2004-12-15 Thread Max Noel
On Dec 16, 2004, at 03:56, Marc Gartler wrote: Hi everybody, Prior to this chunk of code 'glass' has been chosen from a list of colors via user input, and I now want to have that choice connect to one of several possible classes: def glass_type(glasstype): if glasstype == 'Red':

Re: [Tutor] AttributeError: instance has no __call__ method

2004-12-15 Thread Max Noel
On Dec 16, 2004, at 04:20, Max Noel wrote: def glass_type(glasstype): if glasstype == 'Red': myglass = RedGlassCost() elif glasstype == 'Blue': myglass = BlueGlassCost() elif glasstype == 'Yellow': myglass = YellowGlassCost

Re: [Tutor] Regexp Not Matching on Numbers?

2004-12-14 Thread Max Noel
On Dec 14, 2004, at 18:15, Gooch, John wrote: This is weird. I have a script that checks walks through directories, checks to see if their name matches a certain format ( regular expression ), and then prints out what it finds. However, it refuses to ever match on numbers unless the regexp is

Re: [Tutor] TypeError: 'int' object is not callable??

2004-12-08 Thread Max Noel
On Dec 8, 2004, at 17:01, Dick Moores wrote: I got this error msg for this line of code: n = -(2(a**3.0)/27.0 - a*b/3.0 + c) (where a = 1, b = 2, c = 3) And was baffled until I realized the line should be n = -(2*(a**3.0)/27.0 - a*b/3.0 + c) But I still don't understand what callable means. Can

<    1   2