Re: [Tutor] reading from stdin

2005-03-01 Thread Max Noel
X philosophy is to have programs start acting as soon as possible -- in that case, as soon as the first line is available. You should be reading sys.stdin as an iterator (same thing you'd do for a file): import sys for line in sys.stdin: # do stuff with that line of input -- Max max

Re: [Tutor] Make a .exe

2005-03-04 Thread Max Noel
e-C, the language in which they're written and which you're supposed to use to develop applications that use them. However, since you're on a Windows box, I have no idea why Python is trying to involve them. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacke

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

2005-03-06 Thread Max Noel
;, '', '', ''], ['', '', '', '', '']] >>> b[0] is b[1] False List comprehensions. Gotta love 'em... ^^ Is there a more elegant solution to if string == 'sun' or string == 'mon' or s

Re: [Tutor] help

2005-03-07 Thread Max Noel
or two dashes, as the slash is the directory separator. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?" _

Re: [Tutor] HELP: subclass of int

2005-03-08 Thread Max Noel
ne doesn't work I'm not absolutely confident with inheritance in Python (nearly all of my serious OO work has been in Java), but shouldn't the call to the superclass's constructor be the very first statement of the subclass's constructor? -- Max maxnoel_fr at yahoo dot fr --

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 -

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
yield the same result. The only time this paradigm is broken is (of course) when dealing with I/O. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge

Re: [Tutor] How do you use pydoc?

2005-03-14 Thread Max Noel
type "pydoc [module name]" at a command prompt. For example, if you want to know how the os module works, just type "pydoc os". Even better: if the modules you're writing use docstrings, then calling pydoc on your module will work automagically. -- Max maxnoel_fr

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

2005-03-14 Thread Max Noel
ython looks for a module when you try to import it. Oh, and on an unrelated topic, could you please turn off HTML in your e-mails? Blue text on green background is not very comfortable to read... Thanks! -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A patheti

Re: [Tutor] creating a tab delimited filename

2005-03-14 Thread Max Noel
p, so that you can break out of it when you've found the correct file name, not before or after. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge

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

2005-03-15 Thread Max Noel
; re.findall returns a list object (as the error message says). Use name = x[1] instead. (and be careful, numbering starts from 0, so this code may contain a Kenobi error). -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, pan

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

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

2005-03-15 Thread Max Noel
On Mar 15, 2005, at 21:59, Liam Clarke wrote: On Tue, 15 Mar 2005 17:09:50 +, Max Noel <[EMAIL PROTECTED]> wrote: re.findall returns a list object (as the error message says). Use name = x[1] instead. (and be careful, numbering starts from 0, so this code may contain a Kenobi

Re: [Tutor] new

2005-03-15 Thread Max Noel
l the fun), but the range() function will generate a sequence of integers depending on the parameters you pass to it (for example, range(start=20, stop=100, step=10) will return [20, 30, 40, 50, 60, 70, 80, 90]). Then, you could use the sum() function. -- Max maxnoel_fr at yahoo dot fr -- ICQ #8527

Re: [Tutor] creating a tab delimited filename

2005-03-15 Thread Max Noel
cape context is a Bad Thing. Either way, it's better to use forward slashes (or os.sep if you're going for overkill and/or obscure, non-POSIX platforms), with which such problems just don't happen. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A

Fwd: [Tutor] creating a tab delimited filename

2005-03-16 Thread Max Noel
Forwarding to the list -- please use Reply to All. Begin forwarded message: From: jrlen balane <[EMAIL PROTECTED]> Date: March 16, 2005 04:13:40 GMT To: Max Noel <[EMAIL PROTECTED]> Subject: Re: [Tutor] creating a tab delimited filename Reply-To: jrlen balane <[EMAIL PROTECTED]&g

Re: [Tutor] primes

2005-03-17 Thread Max Noel
That's the fastest way I can think of -- but I can't prove it, as I don't know how to use the timeit module. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run throug

Re: [Tutor] primes

2005-03-17 Thread Max Noel
) t2 = timeit.Timer('primeConciseOptimized(5)', 'from __main__ import primeConciseOptimized') t3 = timeit.Timer('primeConcise(5)', 'from __main__ import primeConcise') print t1.timeit(1) print t2.timeit(1) print t3.timeit(1) -

Re: [Tutor] primes

2005-03-18 Thread Max Noel
On Mar 18, 2005, at 02:15, Kent Johnson wrote: Max Noel wrote: #!/usr/bin/env python import math import timeit def primeConcise(limit): return [2] + [x for x in xrange(3, limit, 2) if not [y for y in [2] + range(3,x,2) if x%y==0]] def primeConciseOptimized(limit): return [2] + [x for x in

Re: [Tutor] Accessing List items

2005-03-21 Thread Max Noel
On Mar 21, 2005, at 12:57, Matt Williams wrote: for i in range(len(y)): y[i]="z" print y Surely there must be a better way than this ? Sounds like a job for... list comprehensions! (cue cheesy superhero music) y = ["z" for i in y] -- Max maxnoel_fr at yahoo dot fr --

Re: [Tutor] problems with dictionary

2005-03-23 Thread Max Noel
you with this email, so I can't really help you much more than that. Also, rename it. The str name is already used by a Python built-in (namely, the string datatype). -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, pa

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Max Noel
bject transform into an object of a different class. You need to identify what class the object will be an instance of before loading it. Which, if you're using XML tags like or , shouldn't be very difficult to do. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you

Re: [Tutor] max. range of list

2005-03-25 Thread Max Noel
guess the maximum number of elements in a list is either (2^63 - 1) or the available space in your computer's memory (RAM + swapfile), whichever is the smallest. In other words, enough that you don't have to worry about it. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Loo

Re: [Tutor] A simple question about creating a program

2005-03-30 Thread Max Noel
On Mar 30, 2005, at 23:00, Kevin wrote: I was wondering, can you make a program the uses alot of classes do the exact same thing with out useing classes? Yes. At some point, a program always has to be translated to machine code to be executed by the processor. Machine language is not object-orie

Re: [Tutor] Class and methods?

2005-03-30 Thread Max Noel
t: myImage1 = Image("test.jpg") # Creates an image from the file "test.jpg" myImage2 = Image() # Creates a blank image Get the idea? -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone

Re: [Tutor] Sorting more than one list

2005-03-30 Thread Max Noel
you put the list you want to sort against as the first argument to zip, all you have to do is to then sort() the resulting list of tuples, and to "unzip" it, which should be trivial. >>> a = zip([3, 2, 1], [1, 2, 3]) >>> a [(3, 1), (2, 2), (1, 3)] >>> a.sort(

Re: [Tutor] Launching a file browser

2005-03-31 Thread Max Noel
you should ask this one on the python-mac SIG mailing list: http://www.python.org/sigs/pythonmac-sig/ Kent You have to launch your script with pythonw, not with python. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting

Re: [Tutor] A simple question about creating a program

2005-03-31 Thread Max Noel
On Mar 31, 2005, at 23:07, Alan Gauld wrote: And if Sun ever get round to finishing their JVM on a chip we'll have a chip that is both OO and procedural! At that point it would be a JRM, then, wouldn't it? :D -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacke

Re: [Tutor] Launching a file browser

2005-03-31 Thread Max Noel
On Apr 1, 2005, at 00:14, Mike Hall wrote: On Mar 31, 2005, at 12:21 AM, Max Noel wrote: It's been too long since I used Python on MacOSX, but IIRC you can't just run a Python GUI program from the shell. Or something like that...you should ask this one on the python-mac SIG mailing

Re: [Tutor] Sorting more than one list

2005-04-01 Thread Max Noel
hould just work The default sort will order the tuples by the first member... Alan G. What's the advantage of this compared to the "zip" method (which yields the same result AFAICT)? -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic crea

Re: [Tutor] Self referencing within a dictionary

2005-04-02 Thread Max Noel
oesn't exist yet, as the assignment hasn't happened yet. Therefore it fails. If foo existed before that line, it would work. Witness the following example: >>> foo = {'a':555, 'b':1} >>> foo {'a': 555, 'b': 1} >>> foo = {&

Re: [Tutor] building strings of specific length

2005-04-04 Thread Max Noel
and zfill: >>> "xxx".rjust(10) ' xxx' >>> "xxx".ljust(10) 'xxx ' >>> "xxx".zfill(10) '000xxx' Note that the string will not be truncated if it's more than (here) 10 characters long,

Re: [Tutor] newb problem running the translator (fwd)

2005-04-09 Thread Max Noel
x27;t find it: there is none. Python is an interpreted language (well, bytecode, but let's not get into that, shall we?). To run your Python programs, you call the Python interpreter on them: "python foo.py", for example, runs the foo.py program. -- Max maxnoel_fr at yahoo dot fr -

Re: [Tutor] quicksort using list comprehension

2005-04-09 Thread Max Noel
al as a "real" quicksort algorithm (like the one the list.sort method implements). -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you

Re: [Tutor] when to use properties?

2005-04-13 Thread Max Noel
Danny! -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?" ___ Tutor mai

Re: [Tutor] odd behavior within __init__

2005-04-14 Thread Max Noel
eatly appreciated. Well, if you want b and a to refer to the same object, just use b = a. Everything is a reference in Python, make use of this feature. (at that point, I expect Alan to drop in and explain why what I said is not entirely accurate, but good enough ;) ) -- Max maxnoel_fr at yahoo d

Re: [Tutor] Question regarding the len function of a list while using a loop

2005-04-14 Thread Max Noel
- 100 is an integer. How, as a human being, would you define its "length"? How many elements does it contain? It doesn't make sense, does it? Well, you have it. Numbers (ints, floats...) don't have a length. Therefore, calling len() on an integer is a non-sense that result

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Max Noel
recursion. You should do the same if you've got a few hours of spare time, it's an enlightening experience. ^^ -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through m

Re: [Tutor] high score lists

2005-04-14 Thread Max Noel
0 when x == y and 1 when x > y. it allows you to sort the list based on arbitrary criteria without having to re-write a sort function. If it is None, the default sort function is used. I'm still using Python 2.3, so someone else will have to tell you what the "key" argument i

Re: [Tutor] high score lists

2005-04-15 Thread Max Noel
ve my lazy arse and install it by hand. Meh. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immort

Re: [Tutor] high score lists

2005-04-15 Thread Max Noel
nitely is my favorite language. I can't wait to do some serious programming in it (don't have enough time at the moment, with all the work I have to do in Java... But as soon as Shadowrun 4 hits the stores, I'll start working on a character generator, perhaps learning PyObjC in the

Re: [Tutor] Has anyone ever tried to convert the textual output of the dis module to another language

2005-04-17 Thread Max Noel
e gcc effort is at least 15 years old, yet they're still finding ways to make it spit out faster code... Which leads me to my next point: if you want your Python program to be faster, rewrite the speed-critical parts (there aren't that many of them) in C. That way, you can take advantage

Re: [Tutor] More Function Questions (Joseph Q.)

2005-04-17 Thread Max Noel
e itself calls functions: the randint function from the random module, and the built-in range function. (it also uses a list comprehension, but that's another topic) -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting

Re: [Tutor] Problems with encodings

2005-04-18 Thread Max Noel
you also specify the encoding in the HTML your code generates? -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a

Re: [Tutor] Of fish and foul...(aka the Perl require command)

2005-04-18 Thread Max Noel
version)) >>> require((2,4,1)) Traceback (most recent call last): File "", line 1, in ? File "", line 3, in require OSError: This program requires Python v2.4.1 or later I'm not really sure what exception I should raise, though -- OSError is the most

Re: [Tutor] unrelated sound error - pygame, or other?

2005-04-18 Thread Max Noel
ative positions of the program and the WAV file -- it looks like they should be in the same directory in order for the program to work. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run

Re: [Tutor] TKinter and things over Linux

2005-04-19 Thread Max Noel
sourceforge.net/projects/mysql-python . Chances are it's a standard distutils module, i.e. you install it with "sudo python setup.py install". -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as

Re: [Tutor] TKinter and things over Linux

2005-04-19 Thread Max Noel
erstanding right the language (ENGLISH) of the link you attached Wherever you want, it doesn't matter. When you run "python setup.py install", the module is installed in the Python standard library, so once you've done it, you can delete the files. -- Max maxnoel_fr at yahoo do

Re: [Tutor] Dynamically composing a module name

2005-04-19 Thread Max Noel
ou are. So yes, it can be done, and quite easily at that (although not as easily as in Ruby, IIRC, whose metaprogramming features truly frightened me last time I had a look at it). -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat an

Re: [Tutor] How to obfuscate a database password.

2005-04-19 Thread Max Noel
ection the program establishes to the DB). Storing clear-text passwords would be terrible from a security point of view, since some people, despite being warned, use the same password for everything that they do. I think you can safely s/some/most/ on this one :D -- Max maxnoel_fr at yahoo dot

Re: [Tutor] Installation Routines (Joseph Quigley)

2005-04-20 Thread Max Noel
) but still does a good job, and I hear autopackage isn't bad. Also, there was a project at some point that aimed at making Linux applications into self-contained "executable folders" (like .app bundles in Mac OS X). I don't remember the name, but I recall Rox-filer

Re: [Tutor] TKinter and things over Linux

2005-04-20 Thread Max Noel
stall them. In order to install modules that aren't entirely written in Python (such as this one, I wager), you need a working C compiler and standard library. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and

Re: [Tutor] crash - switching between text window and graphics/gamewindow (high score)

2005-04-20 Thread Max Noel
due soon... I hate those :( ). -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?" ___

Re: [Tutor] crash - switching between text window and graphics/gamewindow (high score)

2005-04-20 Thread Max Noel
On Apr 21, 2005, at 00:19, D. Hartley wrote: Max - I thought it might be a version issue as well, thanks. Also, good luck on your paper! 50 pages, whoo! Haven't done that since grad school, my condolences man. ~Denise :) Thanks... I'm almost done now, only a few more pages and all tha

Re: [Tutor] Re: [Pythonmac-SIG] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-22 Thread Max Noel
(functionFromMain): functionFromMain() -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal ma

Re: [Tutor] Newbie Question:Regarding Command line Parsing and Run Unix Shell Command

2005-04-23 Thread Max Noel
x27;t had the occasion to use it yet, but it seems like an instance of Best Thing Ever(TM). -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect

Re: [Tutor] Re Help with this script

2005-04-23 Thread Max Noel
what you want. #!/usr/bin/env python while True: print "yo." onceMore = raw_input("Once more?").strip().lower() if "no".startswith(onceMore): break -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature o

Re: [Tutor] "saving"?

2005-04-24 Thread Max Noel
ose of this program (other than learning more python) would be to actually help me study for a test, so I would need to be able to save the information somehow. Any ideas? The shelve module seems to be what you're looking for. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Loo

Re: [Tutor] Highlighting instructions: pedagogical preferences

2005-04-25 Thread Max Noel
highlighting the instruction about to be executed makes more sense to me. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal mach

Re: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
ng.join method -- joins a list or tuple of strings. Example: 'xx'.join(["foo", "bar", "baz"]) returns "fooxxbarxxbaz". - string formatting. You ever programmed in C? It's basically the same thing as printf, only better. Example: "Hi, my na

Fwd: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
[Forwarding to the list. Please use "Reply to all", not "Reply", if you want your reply to a message to go to the list] Begin forwarded message: From: "D. Hartley" <[EMAIL PROTECTED]> Date: April 27, 2005 01:36:26 BST To: Max Noel <[EMAIL PROTECTED]>

Re: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
could start by modifying your for loop so that it reads like this: for score, name, posY in mylist, range(270, 540, 30): The rest shouldn't be hard to figure out. ;) -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, pant

Re: [Tutor] properties and subclasses

2005-04-26 Thread Max Noel
. In fact I have never built an industrial size OO system yet that did not use meta classes somewhere in the design... Speaking of that, would you happen to know a good tutorial/introduction to metaclasses in Python? -- Max "Metaclass is an instance of one of its own subclasses." It&

Re: [Tutor] Help with daemon

2005-04-27 Thread Max Noel
I have one process for each user to check the database at the same time is checking other users This sounds like it'd be better done as a cron job (man cron for more info). -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, p

Re: [Tutor] Help with daemon

2005-04-28 Thread Max Noel
in essence, what you're trying to do is store the output of a command in a variable, right? You might be interested in the os.popen family of functions. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweatin

Re: [Tutor] cPickle (Joseph Q.)

2005-04-29 Thread Max Noel
string, and use this string as the name of the file. The raw_input function should allow you to do that. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you chall

Fwd: [Tutor] cPickle (Joseph Q.)

2005-04-29 Thread Max Noel
Begin forwarded message: From: Joseph Quigley <[EMAIL PROTECTED]> Date: April 29, 2005 17:16:22 BST To: Max Noel <[EMAIL PROTECTED]> Subject: Re: [Tutor] cPickle (Joseph Q.) I tried that and it doesn't work! I type the name and it just sits there! Here's the code: # v

Re: [Tutor] guess the number game help

2005-04-30 Thread Max Noel
guilty of plagiarism, but also in violation of the GPL. Hope that helps, -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challeng

Re: [Tutor] guess the number game help

2005-04-30 Thread Max Noel
ot; is and why it's stupid, dangerous and illegal. Yeah, I guess that's why I'm not a teacher :D -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating a

Re: [Tutor] Problem with threading

2005-05-03 Thread Max Noel
> example is something like: > Actually, cron has a resolution of one second, so it may still be useful. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How c

Re: [Tutor] Problem with threading

2005-05-03 Thread Max Noel
o keep the connection up, just so that we > pay > the cost of startup just once. > Good point. Of course, that also involves keeping it alive by sending NOPs every once in a while when there is no activity. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at y

Re: [Tutor] Psyco (Joseph Quigley)

2005-05-04 Thread Max Noel
supposed to be a Python Compiler. The programs are said > to run > faster than normal Python and they almost run as fast as C. It's not a compiler. It's a JIT (Just-In-Time) compiler, a little bit like HotSpot for Java. Also, while it is faster than regular Python, it is s

Re: [Tutor] Python riddles

2005-05-05 Thread Max Noel
On May 5, 2005, at 00:53, [EMAIL PROTECTED] wrote: > As seen on python-announce (via Dr Dobbs): > > http://www.pythonchallenge.com/ > > Good fun! > Very interesting indeed! I'm stuck on number 7, though -- looks like it requires the use of PIL, which I'v

Re: [Tutor] Dictionary Inserts...

2005-05-05 Thread Max Noel
x27;: 2} >>> a {'foo': 1, 'bar': 2} >>> a['baz'] = 'boo' >>> a {'baz': 'boo', 'foo': 1, 'bar': 2} >>> Interactive Python is your friend ^^. -- Max maxnoel_fr at yahoo dot f

Re: [Tutor] Fwd: Python riddles

2005-05-05 Thread Max Noel
~Denise The goal for each riddle is to use the clues found on the page and in its source code (together with some Python bits) to find the URL (page name) for the next one. So the question you have to ask yourself is, what do you see on the first page that could be a clue? -- Max max

Re: [Tutor] python challenges

2005-05-05 Thread Max Noel
processing tool available for any language. In other words, try to remember what you'll learn about them: they're very useful.) -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through

Re: [Tutor] python challenges

2005-05-05 Thread Max Noel
with regular expressions: they use a lot of backslashes, so use raw strings in order not to have to escape them all. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... H

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
I'm not gonna be able to use a workaround this time. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?" _

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
e to apply this thing? It's elsewhere in the page's source code... Look carefully. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
involving a certain program by Adobe and lots of mouse clicks. Yes, you can laugh at me now. > but it's just a few lines of Python code using PIL > once you know what you're after. Could you send me the code you used? (off-list, we don't want any spoilers here, do we?)

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
ke. There's something in the big picture that I'm not getting > here, I think. If you've found the target file, saved it to your hard disk, used the module on it and it says "file not found", I suspect there's something wrong with your computer. If it was th

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
gt; first thought was i needed to use the module to do that. but > apparently i need to use the module AFTER i get the file onto my hard > disk? sorry to be so dense, i just dont get it. > Just enter the file's URL into your browser's address bar. -- Max maxnoel_fr at yahoo d

[Tutor] elegant way to turn list into string?

2005-05-07 Thread Max Russell
', 'z', 'a'] What I'd like to do is take my list and turn it into a string, which looks neater when printed. I've tried using join() but that didn't work, can anyone give me a pointer here? the other method I've used was dealing with a string

Re: [Tutor] Generator function question?

2005-05-07 Thread Max Noel
7;, '-', '/'] while True: yield statusChars[index] index = (index + 1) % 4 As for how to access it, use a for loop (for i in neverEndingStatus()). xrange, for example, is a generator function. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274

Re: [Tutor] Generator function question?

2005-05-07 Thread Max Noel
ease provide an example of how my Test1() function > changes based > on your suggestion? (sorry to be dense) > Try the following code: for i in neverEndingTest(): print i breaking out of the infinite loop is left to the reader as an exercise ;) -- Max maxnoel_fr at

Re: [Tutor] python challenges

2005-05-07 Thread Max Noel
On May 7, 2005, at 13:17, John Carmona wrote: > Hi to everybody reading this thread, can anybody point me to the > URL where I can find these challenges. Many thanks > > JC > http://www.pythonchallenge.com/ -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Loo

Re: [Tutor] Generator function question?

2005-05-07 Thread Max Noel
On May 7, 2005, at 15:06, Max Noel wrote: > Try the following code: > > > > for i in neverEndingTest(): > print i > Sorry, i meant "for in in neverEndingStatus()" (not neverEndingTest()), where neverEndingStatus is the function I gave as an e

Re: [Tutor] python challenges

2005-05-07 Thread Max Noel
that is not what I > want! > The banner in question is the UNIX program "banner". Try running a search on "UNIX +banner". Also, the theory of Run-Length Encoding may come in handy for this part of the challenge. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 &qu

Re: [Tutor] Else in list comprehension

2005-05-07 Thread Max Noel
return i ... else: return 0 ... >>> b = [f(i) for i in range(10)] >>> b [0, 0, 2, 0, 4, 0, 6, 0, 8, 0] -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as y

Re: [Tutor] How do I squish this bug?

2005-05-09 Thread Max Noel
namespaces are an instance of BestThingEver. By the way, it looks like your code induces an endless recursion in an attempt to emulate GOTO statements (been programming in a variant of BASIC?). That's a Bad Thing. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you

Re: [Tutor] zip question

2005-05-09 Thread Max Noel
t;] Yeah, used that way it pretty much does the same thing as getinfo (), but I think it's more Pythonic (using a getinfo method feels Java- ish). Hope that helps, -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, pa

Re: [Tutor] python challenges

2005-05-11 Thread Max Noel
On May 11, 2005, at 07:23, Liam Clarke wrote: > Ack, banner.p eh? > > Can anyone explain the significance of the numbers? Are they columns? > > Regards, > > > Liam Clarke As I said, read about Run-Length Encoding. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019

Re: [Tutor] character format

2005-05-11 Thread Max Noel
e a look at the first 2 characters of the string, which if I recall are printable, and should point you toward the module you have to use to solve that one. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating

Re: [Tutor] character format

2005-05-11 Thread Max Noel
On May 12, 2005, at 02:22, D. Hartley wrote: > Max - yep, and the hint was "BUSY" (... BZ...)... > > Unfortunately that hint doesnt lead me anywhere (except to bz2, which > involves compression, and didnt seem very likely). > > I went through and removed all

Re: [Tutor] character format

2005-05-12 Thread Max Noel
On May 12, 2005, at 02:42, Tony Meyer wrote: >> >> From the email address, chances are that this was a New Zealand >> cultural >> > assumption. Ah, the French, lumping all English speakers under the > American > banner . Touché. :D -- Max ( What m

Re: [Tutor] character format

2005-05-12 Thread Max Noel
my hard drives, written with edit.exe or e.com)... It gets very messy, very quickly. > Will a standard xterm display chr(130) as é in linux for you, Max? > Or under Mac > OS X? I just made a few tests. So far, it seems that it depends on the character encoding in use: - If it

Re: [Tutor] Help with Challenge number 5

2005-05-12 Thread Max Noel
p farther? > > Thanx, > Jacob > Have a look at the source code of the "peak hell" page. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How

Re: [Tutor] Simple string processing problem

2005-05-13 Thread Max Noel
t".strip ("atgc") 'SCER ATCGATCGTAGCTAGCTATGCTCAGCTCGATC' Combining those 2 pieces of advice should solve your problem. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic creature of meat and bone, panting and sweating as y

Re: [Tutor] Linux variable to Python

2005-05-13 Thread Max Noel
return value of the executed process (that is, 0 if everything went okay). For what you want to do, one of the os.popen* functions is what you're looking for. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hack

<    1   2   3   >