Re: [Tutor] Python regular expression

2004-12-03 Thread Max Noel
On Dec 3, 2004, at 21:34, Rick Muller wrote: The file type you mention is also called an INI file, and is used for Windows initialization scripts, among other things. There's a nice recipe on this in the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334 This will read y

Re: [Tutor] Accuracy of time.sleep()

2004-12-04 Thread Max Noel
On Dec 4, 2004, at 14:24, Dave S wrote: OK I may be pushing it, ;-) I need a script to sleep from any point to 8:05AM when in needs to re-start. So I calculate the number of seconds with the following IMO, instead of doing this you should use cron to make your script start at 08:05. It's

Re: [Tutor] Simple RPN calculator

2004-12-04 Thread Max Noel
On Dec 4, 2004, at 23:30, Alan Gauld wrote: to make it request for input(s) of say a simple math like "1 2 3 4 5 + - * /". Look at raw_input() But if you are that much of a beginner you need to take several steps back and try one of the tutorials, they all cover raw_input fairly early on... And fi

Re: [Tutor] hello.py: line 1: print: command not found

2004-12-04 Thread Max Noel
On Dec 5, 2004, at 00:53, Cullen Newsom wrote: Hello List, Here is my Error: hello.py: line 1: print: command not found Here is my cat hello.py: [EMAIL PROTECTED]:~> cat hello.py #!/usr/bin/python print "Hello, world!" [EMAIL PROTECTED]:~> I know this is a Linux question (or SuSE ques

Re: [Tutor] Simple RPN calculator

2004-12-04 Thread Max Noel
On Dec 5, 2004, at 05:31, Liam Clarke wrote: RPN calculator, with operators and operands separate? Sounds counter-intuitive to me. What's the advantage I'm missing? Well, the best way to explain is to take an example. Let's say you want to calculate ((2 + 5) * 3 - (4 / 6)) * ((8 - 2 * 3) / 9 + (1

Re: [Tutor] Removing/Handing large blocks of text

2004-12-08 Thread Max Noel
On Dec 8, 2004, at 14:42, Jesse Noller wrote: Hello, I'm trying to do some text processing with python on a farily large text file (actually, XML, but I am handling it as plaintext as all I need to do is find/replace/move) and I am having problems with trying to identify two lines in the text file,

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 s

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

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] Printing two elements in a list

2004-12-20 Thread Max Noel
On Dec 19, 2004, at 06:16, Jacob S. wrote: Would this work for you? a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] for index,thing in enumerate(a): if "Name=" in thing: del a[index] I know, that it might be slow, but I thought that maybe it would hold its own bec

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 com

Re: [Tutor] Am I storeing up problems ?

2005-01-02 Thread Max Noel
On Jan 2, 2005, at 23:00, Danny Yoo wrote: (Aside: one nonobvious example where copying can be avoided is in Conway's Game of Life: when we calculate what cells live and die in the next generation, we can actually use the 'Command' design pattern to avoid making a temporary copy of the world. We

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] Re: The Game of Life

2005-01-06 Thread Max Noel
First of all, thanks for answering our questions, Danny! And sorry for the lag before my reply, but I was rather busy over the last few days (moving "back" to the UK). On Jan 6, 2005, at 20:05, Brian van den Broek wrote: I am having a hard time figuring out how to efficiently snip and comment,

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

Re: [Tutor] Slightly OT - Python/Java

2005-01-10 Thread Max Noel
On Jan 10, 2005, at 00:18, Liam Clarke wrote: Hi all, I've been forcing myself to learn Java, and I was wondering if anyone's used Jython. To clarify - Jython generates Java bytecode? I've also learnt Java in roughly 1 week last autumn, because that's what's used at the University of Leeds. All i

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 = ran

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 se

Fwd: [Tutor] Slightly OT - Python/Java

2005-01-10 Thread Max Noel
(*bangs head on keyboard* gah, I clicked Reply instead of Reply to All again -- sorry!) Begin forwarded message: From: Max Noel <[EMAIL PROTECTED]> Date: January 11, 2005 00:09:11 GMT To: "Alan Gauld" <[EMAIL PROTECTED]> Subject: Re: [Tutor] Slightly OT - Python/Java On

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 w

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 c

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 o

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

2005-01-11 Thread Max Noel
On Jan 12, 2005, at 00:49, Guillermo Fernandez Castellanos wrote: Does that mean that you use XML as a database to store data and make queries, or that you store your information as XML in a database (as MySQL)? Nope, nothing that fancy, I'm afraid. Just your run-off-the-mill "load from XML/save

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 - You are standing in front of a stump. A path leads north. N and you have a XSL that works like a CSS? descript {font:arial, align:center} exits style:bolder Is that a good paraphrasing? How browser dependent would th

Re: [Tutor] spaces in print

2005-01-12 Thread Max Noel
On Jan 12, 2005, at 17:17, kevin parks wrote: when i print: print '\n','siday_q', key, '.wav'# event i get: siday_q 515 .wav how can you eliminate the spaces to get: siday_q515.wav The quick and dirty way is to do: print '\n' + 'siday_q' + key + '.wav' The elegant way is to do use

Re: [Tutor] List comprehensions

2005-01-12 Thread Max Noel
On Jan 13, 2005, at 01:13, Bob Gailer wrote: At 04:48 PM 1/12/2005, Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Does that mean that there are invalid expressions? I'd enjoy se

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 rai

Re: [Tutor] Faster procedure to filter two lists . Please help

2005-01-14 Thread Max Noel
On Jan 14, 2005, at 23:28, kumar s wrote: for i in range(len(what)): ele = split(what[i],'\t') cor1 = ele[0] for k in range(len(my_report)): cols = split(my_report[k],'\t') cor = cols[0] if cor1 == cor:

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] 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 if

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] Objects & Classes...

2005-01-17 Thread Max Noel
On Jan 17, 2005, at 22:02, Chad Crabtree wrote: (why would an attri bute need to be a separate class?) So that the points or Karma (depending on the generation system) cost of the Attribute can be calculated without having to resort to procedural programming. You'd be then able to get the Karm

Re: [Tutor] COP vs OOP (was: Objects, persistence & getting)

2005-01-17 Thread Max Noel
On Jan 17, 2005, at 22:41, Bernard Lebel wrote: Alan Gauld wrote: In fact I usually refer to Java as a Class Oriented Programming rather than Object Oriented. If you allow me a question What is the fundamental difference between the two? To me this is not clear. I thought that a class was ba

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 & Classes...

2005-01-17 Thread Max Noel
On Jan 18, 2005, at 02:59, Jack Cruzan wrote: Wouldn't it though! I haven't checked but doesn't he use xml for his equipment lists - if that was the case it would be worth it to ask him for those files 'eh? Last time I checked, he didn't. I have the DAT files here (extracted them off a Windows in

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 of

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 http://www.python.org/doc/2.2.

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

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 th

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

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 lin

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 wou

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 ho

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] How would python messure up in performance?

2005-01-23 Thread Max Noel
On Jan 23, 2005, at 23:57, Kevin wrote: Well not sure how to answer that but I will try. For file I/O you would have a seperat file for each character that would store HP/MANA/MOVE points, store items that the character would have on. Areas would be loaded from there own files with all the creature

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 wha

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

Re: [Tutor] ascii encoding

2005-01-25 Thread Max Noel
On Jan 26, 2005, at 02:44, Tony Meyer wrote: time.timezone gives you, I think, the offset between your current timezone and GMT. However, being myself in the GMT zone, I don't know exactly if the returned offset is positive or negative (it returns 0 here, which makes sense :D ). Whether or not it's

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 th

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] 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 http://www.python.or

Re: [Tutor] Safely buffering user input

2005-01-27 Thread Max Noel
On Jan 27, 2005, at 18:17, Bill Mill wrote: I've never used buffer(); in fact, I didn't even know it existed, and I've been using python for a while now. Instead of using buffer, just do: sys.argv[1] = sys.argv[1][:255] This says "Set the second element of sys.argv equal to its first 256 characters

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 inten

Re: [Tutor] carriage return on windows

2005-01-29 Thread Max Noel
On Jan 30, 2005, at 02:40, Jacob S. wrote: I don't think that's what he wants. I think he wants to *overwrite* what's in the shell with new output. For example. so that the whole line is overwritten. In my experience, this is not possible and if anyone can show me how to do it, I would be gratef

Re: [Tutor] Presentation

2005-01-31 Thread Max Noel
On Feb 1, 2005, at 16:35, Paul Hartley wrote: When I was a member of the Forth Interest Group in the USA we learned that Forth was used on the buggy that went to mars, that it started life controlling huge radio telescopes which only had 4k (yes 4k) of memory for both language and application.  

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 doe

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) '0x8

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 debugg

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 manipulation

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

2005-02-02 Thread Max Noel
On Feb 3, 2005, at 00:42, Liam Clarke wrote: I don't find it that bad. Ruby does it as well, and it's perfectly readable. It's more or less equivalent as if condition: and if(condition): both being valid in Python. Yeah, but you'd never call a function foo like this- x = foo in Python. It's just g

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] got it

2005-02-03 Thread Max Noel
On Feb 3, 2005, at 18:17, alieks laouhe wrote: So far I really like python...alot. it's so intuitive I started trying to learn c but it's lack of intuitive string handling made me shudder... so, i tried perl and it was a breath of fresh air after c. then i stumbled upon python. it's the most intuit

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

2005-02-03 Thread Max Noel
On Feb 3, 2005, at 22:21, Smith, Jeff wrote: Perl and Python both resist the introduction of a switch statement which I (and many others) feel is the most elegant way to express what it does. I echo that. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic crea

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 acci

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

2005-02-03 Thread Max Noel
On Feb 3, 2005, at 23:41, Alan Gauld wrote: The reasons for the K&R style of brace winning is to do with the way the brain process structure and despite the subjects stated preference for the 'Pascal' style they still had lower perception scores. Little nit-picking here: if(foo) { bar()

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? open(ite

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

2005-02-04 Thread Max Noel
On Feb 4, 2005, at 09:09, Alan Gauld wrote: Correct. The style you show (which I called Pascal style) is the one that doesn't work. K&R style if(foo) { bar; } Is the one that won the shootout. With the outsider(which I dont know a name for!) beating both... if (foo) { bar; } According to

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 mo

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-10 Thread Max Noel
On Feb 10, 2005, at 05:43, Johan Geldenhuys wrote: I am not so clued up on the 'base 2' and 'base 8' stuff. Care to explain that a little? Usually, we use base 10 numbers, that is, numbers that can be represented with 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). Binary, or base 2, represents all

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 "#{} . Here, [symbol] refers to the scope(?) of the variable. See the discussion between me and Alan on this topic a while ago -- the use of these symbols being his main criticism of Ruby. foo is a local variable $foo is a global variable @foo is a

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 ha

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 Amig

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 m

Re: [Tutor] count words

2005-02-15 Thread Max Noel
On Feb 15, 2005, at 17:19, Ron Nixon wrote: Thanks to everyone who replied to my post. All of your suggestions seem to work. My thanks Ron Watch out, though, for all of this to work flawlessly you first have to remove all punctuation (either with regexes or with multiple foo.replace('[symbol]',

Re: [Tutor] Basic terminology

2005-02-15 Thread Max Noel
In a slightly more generic fashion (everybody started dropping examples), the goal of an integer (euclidian) division (say, a / b) is to express an integer as such: a = b * quotient + remainder Where all the numbers used are integers, and 0 <= remainder < b. When you perform integer di

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] 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 w

Re: [Tutor] Problem in making calulator

2005-02-17 Thread Max Noel
On Feb 17, 2005, at 23:11, . Sm0kin'_Bull wrote: I wrote this to add 2 numbers... print "Please input data" number1 = int(raw_input(" ")) number2 = int(raw_input("+ ")) total = number1 + number2 print total raw_input("") I want to make output like this... 1 + 1 = 2 But, actually... it looks like th

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

Fwd: [Tutor] threads

2005-02-23 Thread Max Noel
Some day I'm actually going to learn how to hit the "Reply All" button. I swear. Begin forwarded message: From: Max Noel <[EMAIL PROTECTED]> Date: February 23, 2005 18:42:37 GMT To: Shitiz Bansal <[EMAIL PROTECTED]> Subject: Re: [Tutor] threads On Feb 23, 2005, at 17:

Re: [Tutor] reading from stdin

2005-03-01 Thread Max Noel
On Mar 1, 2005, at 22:08, Nick Lunt wrote: The way I did this was to use sys.stdin.readlines() to get the output from the pipe. Here is the program: [code] import sys, glob args = sys.stdin.readlines() # found on the net pat = sys.argv[1] for i in args: if (i.find(pat) != -1):

Re: [Tutor] Make a .exe

2005-03-04 Thread Max Noel
On Mar 4, 2005, at 09:26, David Holland wrote: It Completed with these errors :- The following modules appear to be missing {'AppKit', 'Foundation', 'objc'] Now that's really weird. AppKit and Foundation are Mac OS X frameworks, and objc stands for Objective-C, the language in which they're writ

Re: [Tutor] 2d list matrix 7 x 75 problem

2005-03-06 Thread Max Noel
On Mar 6, 2005, at 09:49, Dave S wrote: so I thought I would be clever with ... >>> a=[0]*5 >>> a [0, 0, 0, 0, 0] >>> b=[a[:]]*5 same problem. It seems realy simple but how do I generate a 7 x 75 list matrix ? Dave Try this: >>> a = [''] * 5 >>> b = [a[:] for i in range(5)] >>> b [['', '', '',

Re: [Tutor] help

2005-03-07 Thread Max Noel
On Mar 7, 2005, at 16:46, Kent Johnson wrote: Gregory Sexton wrote: Thanks for the help! Sorry for the trivial questions, but I guess we all have to start somewhere. Beginning python student, OS Windows XP,using Python 2.4. Also novice to programming. I cant get the "/a" command to work. I do

Re: [Tutor] HELP: subclass of int

2005-03-08 Thread Max Noel
On Mar 8, 2005, at 22:10, Shidai Liu wrote: Hi all, I'll sum up a question as following: def int5(): '''return 5''' return 5 class my_int(int): def __init__(self): self.id = int5() int.__init__(self, self.id) # FIXME: this line doesn't work I'm not absolutely confident

Re: [Tutor] Acessing files in Windows 2000

2005-03-08 Thread Max Noel
On Mar 8, 2005, at 22:26, John Purser wrote: Try c:\\my documents\\memo.txt John Or even better, c:/My Documents/memo.txt In most programming languages, you can use the slash as a path separator under Windows as well. It'll save you a lot of trouble. -- Max maxnoel_fr at yahoo dot fr -- ICQ

Re: [Tutor] Acessing files in Windows 2000

2005-03-08 Thread Max Noel
On Mar 9, 2005, at 01:13, Shitiz Bansal wrote: Whats worse, I had found that the rule is different for different versions of windows.Just proves what we all know...Windows Suxx. The Windows OS sucks! And blows! At the same time! (name the reference, get a cookie ;) ) -- Max maxnoel_fr at yahoo dot

Re: [Tutor] Terminology WAS Whats so good about OOP ?

2005-03-13 Thread Max Noel
On Mar 13, 2005, at 18:38, Brian van den Broek wrote: Thanks for the explanation, Sean. The reference to grammatical theory here does seem to make sense. But, relying on correspondence between the technical terms in programming/comp. sci. and other fields with similar terminology can get in the

Re: [Tutor] How do you use pydoc?

2005-03-14 Thread Max Noel
On Mar 15, 2005, at 00:28, [EMAIL PROTECTED] wrote:   I have read but don't under stand how to use pydoc. here what i read can't figer out how to use it. pydoc is more or less a help browser. Think of it as "man for Python". If you need documentation on a module, just type "pydoc [module na

Re: [Tutor] what is the "path browser" used for?

2005-03-14 Thread Max Noel
On Mar 15, 2005, at 00:55, [EMAIL PROTECTED] wrote: What is the path browser for and all the sys.path's for? are these for copying and pasteing to help you on your program? No, sys.path (as explained by pydoc sys ;) ) is the module search path; that is, the list of the folders into which Python

Re: [Tutor] creating a tab delimited filename

2005-03-14 Thread Max Noel
On Mar 15, 2005, at 03:35, jrlen balane wrote: how am i going to change the filename automaticaly? for example: #every 5 minutes, i am going to create a file based on the data above for i in range(100) output_file = file('c:/output' +.join(i) +'.txt', 'w') #guess this won't work

Re: [Tutor] re.findall vs. re.search and re.match

2005-03-15 Thread Max Noel
On Mar 15, 2005, at 16:44, Ron Nixon wrote: Kent: The code is below. Here's the error message. Traceback (most recent call last): File "C:/Python24/reformat.py", line 5, in -toplevel- name = x.group(1) AttributeError: 'list' object has no attribute 'group' re.findall returns a list object (a

Re: [Tutor] re.findall vs. re.search and re.match

2005-03-15 Thread Max Noel
On Mar 15, 2005, at 17:41, Ron Nixon wrote: Max: Thanks that seem to do the trick. One question though, how do you write a tuple out as a list to a new file like the example I have in my code Ron You mean, all the members of the list, separated by commas, with a new line at the end? Well, this ma

  1   2   3   >