Re: [Tutor] Prepend to a list? (fwd)

2005-03-20 Thread Danny Yoo
> I ended up changing my approach so that it won't require appending to > the list, but it's good to know anyway because I'm sure it will come up > in the future. I'm sort of surprised there isn't a prepend() method for > lists, but I'm sure there's a reason. Hi Jay, The interface of a data stru

Re: [Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-22 Thread Danny Yoo
> well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply has > been deprecated in 2.3. Hi Sean, Sorry for straying away from the original poster's question, but do you know why apply() is being deprecated? This is new to me! ... ok, I see some discussion on it: http://mail.python.

Re: [Tutor] Dictionary blues...

2005-03-23 Thread Danny Yoo
On Wed, 23 Mar 2005, Igor Riabtchuk wrote: > I posted the wrong code before. The code is: > > from Tkinter import * > > D={a:"tom", b:"dick", c:"harry"} > > text.bind('', self.Conv) > > def Conv(self,event): > if D.has_key(event.keysym): > str=D[event.keysym] > self.text.insert(END

Re: [Tutor] Getting "file sizes" (fwd)

2005-03-24 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 18 Feb 2004 16:44:49 -0800 From: Joshua Banks <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Getting "file sizes" On Wednesday 18 February 2004 01:22 pm, you wrote: >

Re: [Tutor] Trying to use MySQLdb.cursor

2005-03-24 Thread Danny Yoo
On Fri, 25 Mar 2005, Vicki Stanfield wrote: > I finally gave up and used MySQLdb to connect to my database. It > connects okay, and returns data, but now I have a new question. I use > the code below to print the data returned from my query, but I would > like to make labels at the top of the co

Re: [Tutor] Getting "file sizes" (fwd) [oops, old message!]

2005-03-24 Thread Danny Yoo
Hi everyone, My apologies about the repeated message; I just got an old message from last year, and didn't look closely enough to see that it was a repeat from last year! The mail queue of some folks is really ancient; I wonder why that bounced to me today. Odd. Anyway, sorry about that!

Re: [Tutor] Unique elements mapping

2005-03-25 Thread Danny Yoo
On Fri, 25 Mar 2005, Srinivas Iyyer wrote: > NameState > DrewVirginia > NoelMaryland > NikiVirginia > Adams Maryland > JoseFlorida > Monica Virginia > Andrews Maryland > > > I would like to have my ouput like this: > > Virginia : Drew,Niki,Monica > Maryland: Noel,Adams

RE: [Tutor] a shorter way to write this

2005-03-25 Thread Danny Yoo
> jrlen balane wrote: > > basically, i'm going to create a list with 96 members but with only > > one value: > > > > list1[1,1,1,1...,1] > > > > is there a shorter way to write this one??? Hi Jrlen Balana, I wanted to ask: why do we want to make a list of 96 members, with the same value? This s

Re: [Tutor] Python and Javascript

2005-03-25 Thread Danny Yoo
> Yikes, that sounds pretty hairy. Maybe this kind of thing is not as > straight forward as anticipated. Why HTML you say? Well I've been > intrigued by Dashboard, which will be in the next OSX release. It allows > you to create "widgets" which are essentially little html pages that do > things.

Re: [Tutor] hash()ing a list

2005-03-27 Thread Danny Yoo
On Sun, 27 Mar 2005, Orri Ganel wrote: > While I do not have a pressing need to hash a list, I am curious as to > why, if lists are unhashable, there is a __hash__() method in the list > class, which also does not work on lists, but results in a 'TypeError: > list objects are unhashable'. What'

Re: [Tutor] hash()ing a list

2005-03-28 Thread Danny Yoo
On Sun, 27 Mar 2005, Orri Ganel wrote: > So, any class that has 'rich comparison methods' defined is unhashable? > What gives? (See '[Tutor] unhashable objects') Hi Orri, If we change what it means for two objects to be equal, hashing won't work in a nice way until we also make hashing take e

Re: [Tutor] commands with multiple things to do?

2005-03-29 Thread Danny Yoo
On Tue, 29 Mar 2005, Diana Hawksworth wrote: > Is it possible for me to make a command do multiple things instead of 1? > For instance, I have a button that allows me to "submit" some user input > (that is, show it in a window), but I also want it to count the number > of times that submit button

Re: hash issues [WAS] Re: [Tutor] hash()ing a list

2005-03-29 Thread Danny Yoo
> *Almost* all ints are fixed points for the hashing function in the > sense that hash(some_int) == some_int. Almost all as: > > >>> hash(-1) > -2 > > Any idea why -1 is the sole exception? [warning: beginners, skip this. Completely inconsequential CPython detail ahead.] Hi Brian, Yeah, I reme

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

2005-03-30 Thread Danny Yoo
On Wed, 30 Mar 2005, Kevin wrote: > I was wondering, can you make a program the uses alot of classes do the > exact same thing with out useing classes? Hi Kevin, Yes. We can even do a lot of object oriented programming without classes, although it might be slightly painful. You asked an ea

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Danny Yoo
On Wed, 30 Mar 2005, Marcus Goldfish wrote: > I need to implement a FIFO with a fixed maximum capacity. Hi Marcus, Out of curiosity, why do you require a first-in-first-out queue with a maximum capacity? > Would limiting the max capacity of the FIFO improve performance by > allowing one to p

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread Danny Yoo
> My script is still not working properly, I am obviously missing a > statement somewhere, the script return: > > >>> > Enter a number: 25 > You are just a bit too high, try again > The End > >>> > > The script exits and don't give another try, could you enlight me in > this one, thanks Hi John,

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Danny Yoo
> ps -- as for the need for a circular buffer vs. FIFO: I think my dsp > background pushed me toward the CB. My app involves data acquisition > for extended periods of time. I can't grow the FIFO infinitely, but it > is no big deal if a few samples get overwritten. Does this make sense? Hi Mar

Re: [Tutor] pickle in unicode format

2005-04-05 Thread Danny Yoo
> > I have this dictionnary : > > > > a={'partition': u'/export/diskH1/home_evol/ricquebo', > > 'rsmFirstname': u'Fran\xe7ois', > > 'rsmLastname': u'Ricquebourg', > > 'size': u'8161222.0', > > 'size_max': '1'} > > > > and I'd like to *serialize* it with pickle and that the output format > > w

Re: [Tutor] pickle in unicode format

2005-04-05 Thread Danny Yoo
> Are you trying to send it off to someone else as a part of an XML > document? If you are including some byte string into an XML document, > you can encode those bytes as base64: > > ## > >>> bytes = 'Fran\xe7ois' > >>> encodedBytes = bytes.encode('base64') > >>> encodedBytes > 'RnJhbudvaXM=\

Re: [Tutor] Major Newbie Here

2005-04-05 Thread Danny Yoo
> I'm a cell biologist that is learning python. I've been following Alan > Gauld's tutorial online and I've hit a wall. > > I'm typing > > class Spam: > """A meat for combining with other foods > > It can be used with other foods to make interesting meals. > It comes with lots

Re: [Tutor] str.split and quotes

2005-04-07 Thread Danny Yoo
On Wed, 6 Apr 2005, Kent Johnson wrote: > s = 'Hi "Python Tutors" please help' > s.split() > > > > ['Hi', '"Python', 'Tutors"', 'please', 'help'] > > > > > > I wish it would leave the stuff in quotes in tact: > > > > ['Hi', '"Python Tutors"', 'please', 'help'] > > You can do this easily

Re: [Tutor] regular expression question

2005-04-07 Thread Danny Yoo
> I wonder if anyone can help me with an RE. I also wonder if there is an > RE mailing list anywhere - I haven't managed to find one. Hi Debbie, I haven't found one either. There appear to be a lot of good resources here: http://dmoz.org/Computers/Programming/Languages/Regular_Expressions

Re: [Tutor] UselessPython 2.0

2005-04-07 Thread Danny Yoo
On Thu, 7 Apr 2005, Sean Steeg wrote: > So please, do this list and Python in general a favor and visit (and > support through your code) the new and (hopefully) improved > UselessPython. > > Thank you for your time. > Sean > http://www.uselesspython.com It looks great; I'll try submitting some

Re: [Tutor] Associate functinos with Dictionary/Class Usage

2005-04-07 Thread Danny Yoo
On Thu, 7 Apr 2005, Luke Jordan wrote: > I am looking for a little clarification of how exactly this would work. > > 1. How do I associate a function to a dict key? Hi Luke, We're probably already familiar of values like numbers and strings, and how to give them names with variables: ##

Re: [Tutor] str.split and quotes

2005-04-07 Thread Danny Yoo
> > I'm not sure if this is appropriate for Marilyn's purposes though, but > > I thought I might just toss it out. *grin* > > Thank you Danny. Very interesting. Both approaches are perfect for > me. > > Is there a reason to prefer one over the other? Is one faster? I > compiled my regular expr

Re: [Tutor] Re: IDLE crashing suddenly

2005-04-08 Thread Danny Yoo
On Fri, 8 Apr 2005 [EMAIL PROTECTED] wrote: > I've noticed that after 20 or 30 compile/link/execute runs, IDLE > crashes. This seems to happen pretty consistently. At the time, I'm not > doing anything that might cause it to crash. Does this happen to anyone > else? What causes it? Is it just a

RE: [Tutor] Talking to mssql?

2005-04-08 Thread Danny Yoo
On Sat, 9 Apr 2005, j2 wrote: > Well, doesn't fly for me, because I can't install it. Can you offer any > help on the below? Hi J2, This is a slightly specialized question for tutor; you might be able to get some better help by asking on the db-sig mailing list: http://mail.python.org/mail

[Tutor] newb problem running the translator (fwd)

2005-04-09 Thread Danny Yoo
-- Forwarded message -- Date: Fri, 8 Apr 2005 22:03:58 EDT From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: newb problem running the translator I will try to make this quick. I am a newb to python, and programming at that, but i am realy interested. I have been looking

[Tutor] What is "foo"?

2005-04-09 Thread Danny Yoo
> > Foo: What's it good for? > > Foo and Bar are popular names used in examples. They don't mean > anything. For example to show how to define a function I might write > > def foo(): >print 'Hello' > > I just use foo to avoid having to think of a meaningful name. Hi Joseph, I sometimes get l

Re: [Tutor] Python starting books

2005-04-12 Thread Danny Yoo
> The requested URL /hp/alan.gauld/ was not found on this server. > > Additionally, a 404 Not Found error was encountered while trying to use > an ErrorDocument to handle the request. Hi Alexis, Odd! It might be that Alan's hosting service is doing something bonkers; perhaps the service's virt

Re: [Tutor] Python starting books (fwd)

2005-04-12 Thread Danny Yoo
-- Forwarded message -- Date: Tue, 12 Apr 2005 17:16:18 -0300 From: Alexis <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Python starting books Hi people thanks to all of you for the suggestions, I am currently reading some programming

Re: [Tutor] when to use properties?

2005-04-12 Thread Danny Yoo
On Tue, 12 Apr 2005, Marcus Goldfish wrote: > Are there guidelines for when properties should be used vs. instance > variables? Hi Marcus, In Python, it's easy to modify things so that things that look like instance variable access are automatically shunted off to do programatic stuff. In Py

RE: [Tutor] Python backwards program

2005-04-12 Thread Danny Yoo
On Wed, 13 Apr 2005, Tony Meyer wrote: > > I am very new to programming and I have an assignment to have a > > raw_input string that is inputted by the user and then is printed > > backwards. Can anyone help me? I can get it to print regular but > > backwards in not working. > > I guess that I

Re: [Tutor] Python backwards program (fwd)

2005-04-12 Thread Danny Yoo
-- Forwarded message -- Date: Tue, 12 Apr 2005 22:37:44 -0500 From: Jim and Laura Ahl <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Python backwards program I have read about loops, strings, tuples. I am taking this class on distance e

Re: [Tutor] Python backwards program (fwd)

2005-04-12 Thread Danny Yoo
Hello Jim, > I have read about loops, strings, tuples. Can you show us an example of a loop? Can you show us the last program that you've written? It sounds like you've done a lot of reading. The problem with learning how to program is that you can't just read it: you actually have to write

Re: [Tutor] Re: Python starting books (fwd)

2005-04-13 Thread Danny Yoo
> > Hi people thanks to all of you for the suggestions, I am currently > > reading some programming books but it seems as if i can't findn a > > suitable one to get me started the way i want, i mean not only > > learning the basics but getting prepared for more complex programming, > > I would say

[Tutor] help (fwd)

2005-04-13 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 13 Apr 2005 17:12:55 +0200 From: Feziwe Mpondo <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: help how to run a programm after you have typed in the commands ___ Tutor maillist - Tutor@python.or

Re: [Tutor] Python backwards program (fwd)

2005-04-13 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 13 Apr 2005 09:01:16 -0500 From: Jim and Laura Ahl <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Python backwards program (fwd) Danny I cannot write a program that gives me a double letter. I can get

Re: [Tutor] Python backwards program (fwd)

2005-04-13 Thread Danny Yoo
> I cannot write a program that gives me a double letter. > I can get each letter separate or pieces or parts of the word Hi Jim, [Please don't reply just to me: use the Reply-to-All feature on your email program. This allows your reply to be seen by the rest of us here. I want to make sure yo

RE: [Tutor] help (fwd)

2005-04-13 Thread Danny Yoo
[Hi Mark, I'm not the original poster of the question. I've forwarded your reply back to tutor as well as the original poster. Thanks!] -- Forwarded message -- Date: Wed, 13 Apr 2005 14:56:18 -0400 From: "Leeds, Mark" <[EMAIL PROTECTED]> To: D

Re: [Tutor] Python backwards program

2005-04-13 Thread Danny Yoo
> I have wrote 3 other programs in the class. Hi Jim, [cut] Ok, that's where I have to stop you for a moment. We're not going to do your homework problems; please understand that we actually don't care if you get your homework done. And I really hope that people don't just start blurting stu

Re: [Tutor] Python backwards program

2005-04-13 Thread Danny Yoo
cuse to say things like that. I will try to better answer your questions, without making such stupid mistakes. And I hope that folks on the list will forgive me for the bad temper in my last emails. Sincerely, Danny Yoo ___ Tutor maillist - Tutor@pyth

Re: [Tutor] Python backwards program (fwd)

2005-04-14 Thread Danny Yoo
-- Forwarded message -- Date: Thu, 14 Apr 2005 00:41:40 -0500 From: Jim and Laura Ahl <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Python backwards program I thought you were on me a bit but I am so frustrated at this point. My inst

Re: [Tutor] Python backwards program (fwd)

2005-04-14 Thread Danny Yoo
> Does the 2.2 python have the ability to do this? Hi Jim, Python 2.2 is actually a bit old; you may want to update the version of Python on your system to Python 2.4. You can find it here: http://www.python.org/2.4/ A lot of the approaches you were trying earlier used features that were

Re: [Tutor] how to display an image using python

2005-04-14 Thread Danny Yoo
> xv on the machines and PIL uses xv to display. I have looked at > PythonMagick but I could not even get past installing it. It does not have > a setup.py and uses boost. I am hoping for a more straightforward Python > way. Hi John, You may want to try PyGame: http://www.pygame.org/

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

2005-04-14 Thread Danny Yoo
> What I want to know is this: what are other specific situations where a > recursive algorithm would be better or easier to program than an > iterative one? Hello, Programs that have to deal with data often have an internal structure that mimics that data. A program that deals with lists looks

Re: [Tutor] Python backwards program (fwd)

2005-04-15 Thread Danny Yoo
[Jim, when you reply, please send to [EMAIL PROTECTED] Don't just send your reply only to me. Use your email client's Reply-To-All feature.] [Jim] > > The following gives me the last letter of the string. > > > > backwords=raw_input("enter number or string:") > > print backwords[-1]

Re: [Tutor] Re: Recommendations needed for a good data structures text

2005-04-15 Thread Danny Yoo
On Fri, 15 Apr 2005 [EMAIL PROTECTED] wrote: > Can anyone recommend a good data structures text that is not too heavy > on math and theory? > > I need something very practical, with many short examples. I'm trying to > learn to program 2D games like checkers, card games, etc. The book "Game Pro

Re: [Tutor] Contructor Overloading and Function Tooktips

2005-04-15 Thread Danny Yoo
On Fri, 15 Apr 2005, Gooch, John wrote: > Is there a way to create multiple __init__ routines in a Python Class? Hi John, In general, Python doesn't support "overloading". Overloading wouldn't interact well at all with functions that can take a variable number of arguments. That being said,

Re: [Tutor] help

2005-04-17 Thread Danny Yoo
On Sun, 17 Apr 2005, james middendorff wrote: > I was wondering if there was a tutorial and or module that would help me > create a program to use a parallel port to turn on/off a device in > linux? I have searched but cannot find a tutorial on a good way to do > this. The whole project would be

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

2005-04-17 Thread Danny Yoo
> > Just curious. Googling for 'python "dis module" convert "another > > language" ' only got two hits. So maybe no one is trying it? I was > > just daydreaming about a native python compiler, and wondered how > > feasible it would be. > > You might be interested in Pyrex and Psyco: > http://www.co

Re: [Tutor] Re: If elif not working in comparison

2005-04-17 Thread Danny Yoo
On Sun, 17 Apr 2005, gerardo arnaez wrote: > I have finished a coumadin dose calcalutor > but want to have it work via a web interface. > > The base code is here > http://mung.net/~dude/coumadinAll.html > > but not sure what would be the next step in getting this working > on the web. Hi Gerar

Re: [Tutor] TKinter and things over Linux

2005-04-18 Thread Danny Yoo
On Sun, 17 Apr 2005, Alberto Troiano wrote: > [emvamp.gif] Gaucho > Hey everyone I have Python 2.3 installed and when I try to import Tkinter > I get the following error> >>>import Tkinter Traceback (most recent call > last): File "", line 1, in ? File > "/usr/local/lib/python2.3/lib-tk/Tkinter

Re: [Tutor] website information

2005-04-18 Thread Danny Yoo
On Mon, 18 Apr 2005, Williams, Thomas wrote: > Does anyone know how to prevent this error from occurring: IOError: > [Errno socket error] (10060, 'Operation timed out'). Hi Tom, You can adjust the amount of time that sockets will wait, by using socket.setdefaulttimeout(): http://www.pytho

Re: [Tutor] TKinter and things over Linux

2005-04-19 Thread Danny Yoo
On Tue, 19 Apr 2005, Alberto Troiano wrote: > Sorry I have Mysql-python 1.20 > that's the one I can not install > I said MySQLdb because I'm still using it for windows > I can't install mysql-python it gives me the error i described > > With mysql-python does the sintax change???What should

Re: FW: [Tutor] Trying to d0 HTTP GET

2005-04-19 Thread Danny Yoo
On Tue, 19 Apr 2005, Ertl, John wrote: > I have figured out a bit more. I can get the binary values from the > service but I think they come back as a single string. How do I read > that into an array? Hi John, > The code below will read the first number into the array and print it > out bu

Re: [Tutor] inexplicable MySQLdb behavior, INSERT data doesn't appear

2005-04-19 Thread Danny Yoo
On Tue, 19 Apr 2005 [EMAIL PROTECTED] wrote: > hi all, while recently trying to insert some data into the following > table: > > # stores unique course definitions > CREATE TABLE adminCourses ( > ID TINYINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, > Code CHAR(6), > Title VARCHAR(55), > Unit

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

2005-04-19 Thread Danny Yoo
> > Is there a convention for obfuscating database passwords? Hi David, Most people run passwords through some sort of hashing function. That is, databases almost never contain passwords in the clear, but instead store the hashes of those passwords. For example, I am almost positive that Amaz

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

2005-04-19 Thread Danny Yoo
-- Forwarded message -- Date: Tue, 19 Apr 2005 19:47:20 -0500 From: David Driver <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] How to obfuscate a database password. I am not necessarily talking about passwords for users but about the pass

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

2005-04-19 Thread Danny Yoo
> I am not necessarily talking about passwords for users but about the > password that is used for connecting to the database. Hi David, Ah, ok, I misunderstood the problem then. Hmmm... I agree with the others who have said that this is difficult. *grin* Eventually, you'll need to decrypt wh

Re: [Tutor] TKinter and things over Linux

2005-04-20 Thread Danny Yoo
> >>I couldn't print the exact error because it's a lot of pages that says > >>mostly the same Hi Alberto, No, that's precisely the kind of wrong kind of attitude toward error messages that's making this debugging much harder than it should be. You may think that those error messages are most

Re: [Tutor] TKinter and things over Linux [how to make a transcript]

2005-04-20 Thread Danny Yoo
On Wed, 20 Apr 2005, Alberto Troiano wrote: > You're so right and I apologize for my mistake > > Do you or anybody knows where the error.log for this kind o things is? > > or how can I capture the output in a file???Cause is so damn > long that I barely see the 10% of all the things

Re: [Tutor] Help regarding optparse

2005-04-20 Thread Danny Yoo
On Wed, 20 Apr 2005, Prasad Kotipalli wrote: > I am a newbie to python, I have been working with getopt for parsing > command line options, but i came to know that optparse module is more > effecient. Can anyone suggest some ideas why it is powerful than > getopt. Hi Prasad, According to:

Re: [Tutor] GNUPLOT

2005-04-21 Thread Danny Yoo
[Kent] > Strange. This example works for me on Win2K with Python 2.4. [Ray] > > Hoping that someone can help me here. I have been reading about > > gnuplot and it's plotting functionality, so i decided to install this: > > I downloaded the gnuplot windows function and then installed the > > gnu

Re: [Tutor] GNUPLOT

2005-04-21 Thread Danny Yoo
> Yeah, it looks like Joshua Pollack ran into this issue three years ago: > > http://mail.python.org/pipermail/tutor/2002-September/017579.html > > I'm going through the archive now to see if he was able to resolve the > problem ok. Hi Ray, Yikes, it looks like someone never really answered

Re: [Tutor] Pychecker

2005-04-22 Thread Danny Yoo
> In Perl, you can perl -c somehardtoreadperlprogram.pl that will just > check the syntax. The above problem would have been caught in Perl since > I always use strict. Is there a command line option in Python to do a > Pychecker-like syntax check? Hi Mike, Unfortunately, no, because there are s

Re: [Tutor] Pychecker

2005-04-22 Thread Danny Yoo
On Fri, 22 Apr 2005, Danny Yoo wrote: > > > In Perl, you can perl -c somehardtoreadperlprogram.pl that will just > > check the syntax. The above problem would have been caught in Perl > > since I always use strict. Is there a command line option in Python to > > do a

Re: [Tutor] Tracking URL in browser location bar

2005-04-22 Thread Danny Yoo
On Fri, 22 Apr 2005, Gautam Saha wrote: > A newbie here..I was wondering if python can help me to track the URL in > browser (IE6+, FF, Mozilla) location bar. > > What I want is to get each URL from the the browser location bar, as > user clicks from links to link in the web (or types an URL) an

Re: [Tutor] Does Python have anything like Perls format output?

2005-04-23 Thread Danny Yoo
On Sat, 23 Apr 2005, Tom Tucker wrote: > Good evening! Does Python have a print function similar to Perl > format output (example below)? Hi Tom, Not exactly, but we can get something close, by using the String Formatting operators. http://www.python.org/doc/current/lib/typesseq-strings.

Re: [Tutor] design questions: pythonic approach to ostriches

2005-04-23 Thread Danny Yoo
> I do remain a bit surprised that there seems to be no way to implement > what I naively thought would be the obvious solution -- to remove an > inherited method from the instance's dictionary. Hi Brian, If we're trying to do this, we probably don't want to "inherit" from a parent. A subclas

Re: [Tutor] Bandwidth Tester

2005-04-24 Thread Danny Yoo
On Sun, 24 Apr 2005, Ali Polatel wrote: > How can i write a simple bandwidth tester with Python? Hi Ali, A really rough sketch would be: ## Really rough pseudocode def bandwidthTest(): Record the current time (use time.time()) Choose some resource that you can download, and downl

Re: [Tutor] Is it possible to load variable into a regex string?

2005-04-27 Thread Danny Yoo
On Wed, 27 Apr 2005, Tom Tucker wrote: > Hello all! I am trying to pass a variable to my re.compile string (see > broken example below). Is something like this possible? Thanks! > > regexstring = 'H\sb' > textstring = 'BLAH blah' > match = re.compile((%s) % (regexstring)) # ? Hi Tom, Ah, I t

Re: [Tutor] wxpython error when upgrading?

2005-04-29 Thread Danny Yoo
On Thu, 28 Apr 2005, Jeff Peery wrote: > hello, I recently upgraded my wxpython to 2.5, now I get an error > message when I try to edit a dialog in the boa constructor that says : > collection body not in init, body, fin form - anyone have an idea what > this means? thanks. Hi Jeff, This sound

Re: [Tutor] permutations using list comprehensions

2005-05-01 Thread Danny Yoo
> The best I've been able to do is pretty obvious:- > def perms (t): > if len (t) == 0: > return [] > else: > return [[x] + perms ([y for y in t if y <> x]) for x in t] > >Needless to say, it doesn't work. It does produce a list of > lists but they are so horribly n

Re: [Tutor] Problem with threading

2005-05-02 Thread Danny Yoo
[Side note: try to just send messages to either tutor@python.org, or [EMAIL PROTECTED], but not both.] > Someone suggested the use of CRON (I'm working over Linux) but how can I > built a program to which I can pass an argument??? > > I mean in CRON I will have to put one task for each user

Re: [Tutor] Problem with threading

2005-05-03 Thread Danny Yoo
On Tue, 3 May 2005, Alberto Troiano wrote: > In answer to Matt the cameras push the photos via ftp at my server at 1 > photo every 3 seconds Hi Alberto, Just as another note: the folks here have no idea who you mean by Matt. I do know that you mean Matt from [EMAIL PROTECTED], but the folks on

Re: [Tutor] missing module?

2005-05-03 Thread Danny Yoo
> Hello, I get an error message from py2exe that it can't find a module > ntpath.py. I pasted the error message below: > > Traceback (most recent call last): > File "wxApp1.py", line 4, in ? > File "wx\__init__.pyc", line 42, in ? > File "wx\_core.pyc", line 4, in ? > File "wx\_core_.pyc"

Re: [Tutor] Problem with threading

2005-05-03 Thread Danny Yoo
On Tue, 3 May 2005, Max Noel wrote: > > I believe that cron has a resolution of a minute, so now it doesn't > > sound that cron is so viable. But how about writing a program that > > just continues to run as a "daemon" service in the background? A > > simple example is something like: > >

Re: [Tutor] nested os.popen()

2005-05-03 Thread Danny Yoo
On Tue, 3 May 2005, Jules Bravo wrote: > I'm trying to create a program that can recreate the unix pipe. So > basically I need to be able to take something like "ls *.py | du | wc" > and be able to run it just like unix would, doing a wordcount of the du > of all files that end with .py. My ques

Re: [Tutor] help

2005-05-05 Thread Danny Yoo
On Wed, 4 May 2005 [EMAIL PROTECTED] wrote: > i need help with my wmconnect service. it keeps on losing connection > once logged on-line every 5 or 10 minutes. i have to continuosly keep > trying to make a connetion. Hello Keisha, I hope you don't mind me asking, but how is this related to P

Re: [Tutor] python challenges

2005-05-06 Thread Danny Yoo
> > Anyone have a gentle hint, or pointer to another 'beginner' tutorial > > to regular expressions? > > > > Thanks! I dont want to get stuck here in the riddles! Yeah, there is also a great regular expression HOWTO here: http://www.amk.ca/python/howto/regex/ Best of wishes!

Re: [Tutor] Basics

2005-05-06 Thread Danny Yoo
On Fri, 6 May 2005, Evi Wyns wrote: > I know this is probably too soon still. I am busy with classes at the > moment and I am having a difficult time understanding the use of > classes... do you have a good tutorial or good explanation for me how to > understand classes more better? Hi Evi, Yo

Re: [Tutor] Importing C,C++,Asm modules

2005-05-06 Thread Danny Yoo
On Wed, 4 May 2005, Ali Polatel wrote: > Dear friends, > Is there a way to import C,C++ or Asm modules to python scripts? > If yes how? Hi Ali, Python can be "extended" to use external libraries, as long as we can call them from C. There's a tutorial for C programmers here: h

Re: [Tutor] python challenges

2005-05-07 Thread Danny Yoo
> 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 Hi John, By the way, just to make sure you know, the mailing list here has an archive here: http://mail.python.org/

Re: [Tutor] read() question

2005-05-11 Thread Danny Yoo
On Wed, 11 May 2005, John Carmona wrote: > MyText = open('The_text.txt','r').read() > > In the above line could someone tell me what the 'r' stand for. Hi John, You may want to look at: http://www.python.org/doc/lib/built-in-funcs.html#l2h-25 If you're still unsure about what 'r' means,

Re: [Tutor] Python sort with a delimiter

2005-05-11 Thread Danny Yoo
On Wed, 11 May 2005, Tom Tucker wrote: > Good morning! Does Python have a sort function thats supports a delimiter? Hi Tom, Not directly, but it's actually not too difficult to get this working. Python's sort() function can take in an optional "comparison" function, so we can do something lik

Re: [Tutor] map() and lambda to change class instance attribute

2005-05-11 Thread Danny Yoo
On Wed, 11 May 2005, Bernard Lebel wrote: > Let say I have several class instances in a list, and these class > instances have an attribute named "value", whose value is an integer. > > I would like to know if it is possible to loop over the list of > instances to change their "value" attribute,

Re: [Tutor] map() and lambda to change class instance attribute

2005-05-11 Thread Danny Yoo
> It is possible to abuse map() to do what you're trying to do, using the > setattr() function: > > ## Pseudocode > map(lambda instance: setattr(instance, 'value', 42)) > ## Hi Bernard, Grrr... I did label that as Pseudocode, but that doesn't excuse me from not actually trying to make t

Re: [Tutor] map() and lambda to change class instance attribute (fwd)

2005-05-11 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 11 May 2005 14:29:58 -0400 From: Bernard Lebel <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] map() and lambda to change class instance attribute Hi Danny, Thanks for the answer. I have to confess th

Re: [Tutor] map() and lambda to change class instance attribute

2005-05-11 Thread Danny Yoo
> I have to confess that I already use map(), or should I say abuse, for > this, although it is the first time I consider using lambdas. Up until > now I always used map() to perform a looped call on a function that > would change the attribute value, as shown in Mark Lutz & David Ascher's > Learn

Re: [Tutor] map() and lambda to change class instance attribute

2005-05-11 Thread Danny Yoo
On Wed, 11 May 2005, Bernard Lebel wrote: > Thanks a lot for the advice. I will put that in practice. > > The blasphemous example is on page 227 of the second edition, under > Mapping Functions Over Sequences. Hi Bernard, Ah, thank you. I'll start the Inquisition shortly. *grin* ___

Re: [Tutor] solutions to API version mismatch

2005-05-11 Thread Danny Yoo
On Wed, 11 May 2005, Charmaine Chia wrote: > My computer only has the following versions installed: Python 2.1.3+, > 2.2.3+ and 2.3.4. I have changed my PYTHONPATH to use look for > different site-packages (I've tried version 1.5 and 2.2 -- 1.5 was > attempted in case the scripts were written i

Re: [Tutor] map() and lambda to change class instance attribute

2005-05-11 Thread Danny Yoo
> On Wed, 11 May 2005, Danny Yoo wrote: > > > map(lambda x: x^2, [1, 2, 3]) > > > > [x^2 for x in [1, 2, 3]] > > then we're really saying something like this: > > > > [1, 2, 3] > > | | | > > |

Re: [Tutor] Pipe variable to external command

2005-05-11 Thread Danny Yoo
On Wed, 11 May 2005, Jeffrey Rice wrote: > I am having a little problem with how to pipe a variable's contents to an > external command. Essentially, I have a variable that contains the > contents of a variable that I want to feed to a series of external commands > (clamav and spamassassin).

Re: [Tutor] total newbie [profiling example]

2005-05-12 Thread Danny Yoo
On Wed, 11 May 2005, Michael Cole wrote: > What I noticed while testing the program is that the ball moves fairly > slowly, I tried incrementing the ball's speed (dx and dy) but it still > seemed to move pretty slow no matter how much I increased its speed. I > went ahead and played out the game

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
-- Forwarded message -- Date: Thu, 12 May 2005 11:31:57 -0600 From: Jeffrey Rice <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Pipe variable to external command At 12:16 AM 5/12/2005, Danny Yoo wrote: >## > >>> c

Re: [Tutor] *nix-specific Python Scripting

2005-05-12 Thread Danny Yoo
On Thu, 12 May 2005, William O'Higgins wrote: > I am trying to learn Python by translating some of my Perl scripts. One > thing that is eluding me is assigning the results of system calls to > variables. Here's what I want to do in Perl: > > $isxrunning = `ps -C startx | grep "startx"`; >

Re: [Tutor] help with tabs and Tkinter

2005-05-12 Thread Danny Yoo
On Thu, 12 May 2005, Zenten wrote: > Ok, I'm writing a program using tkinter, that has a bit of data entry in > it. It would be useful to have a window with various tabs to select > between different "pages" in my entry. However, I can't figure out how > to do this part, after looking through

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
> http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/68786 > As a work around, I end up calling popen3 like this: > > Open3.popen3 ("/some/command/to/run ; echo $? 1>&2") { ... } > > That ensures the exit code from /some/command/to/run will be the last > line of the standard error stream from

Re: [Tutor] any help with this piece of code

2005-05-12 Thread Danny Yoo
On Thu, 12 May 2005, Richard gelling wrote: > fileToSearchFor = raw_input( "Type in the file name you want to search > for: ") > > if fileToSearchFor in fileList: > print "%s was found" % fileToSearchFor > else: > print "%s was not found" % fileToSearchFor > > Could someone explain to me

<    1   2   3   4   5   6   7   8   9   10   >