Re: [Tutor] checking for robots on a python script based site

2006-10-21 Thread Danny Yoo
On Sat, 21 Oct 2006, Tsila Hassine wrote: > 1: write a robots.txt file - but then I'd have to rely on the bots' good > will. > 2: implement a "captcha" mechanism, which I am not sure I want. > > Does Python provide anything to deal with such problems ? I think you're asking the question: "Has a

Re: [Tutor] can i pass a list to a function and get one back ?

2006-10-21 Thread Danny Yoo
> great, thanks, i have idle right here, would have been just as easy. > sorry about that No problem; it's cool. >> > hey there, i was just wondering if i could get a list back from a >> > function. >> > something like >> > def return_a_list(some_var): >> > some_list = [] >> >

[Tutor] 'json' should probably be the response to 'can we use eval to parse { ... }?'

2006-10-21 Thread Danny Yoo
Hi everyone, I ran across the JSON data format today: http://json.org/ with a nice Python implementation in 'simplejson'. http://undefined.org/python/#simple_json The JSON format matches very closely with Python data structure syntax. So the next time someone asks if they can use e

Re: [Tutor] rabbit core microcontrollers - Django

2006-10-23 Thread Danny Yoo
On Sun, 22 Oct 2006, Picio wrote: > I would wonder if anyone knows something about programming Rabbit Core > Modules, that normally were programmed diretctly with Dynamic C, with > Python. > I mean either: > - something like using python to create code in dynamic suitable for > the rabbit core >

Re: [Tutor] Evaluate my script?

2006-10-24 Thread Danny Yoo
On Mon, 23 Oct 2006, Adam Gomaa wrote: > Hello, -tutor. I wrote this script in chemistry class, which gets the > user's input for various parts of the PV=nRT ideal gas law, then > calculates the missing variable, which you indicate by putting in an > 'x'. Hi Adam, I haven't looked at your p

Re: [Tutor] problem importing class

2006-10-26 Thread Danny Yoo
Hi Shawn, It looks like people have identified the problem, that your site.py module isn't being found because it conflicts with something from Python's Standard Library. This isn't the first time this kind of problem has hit people. This problem is well known and is the subject of a Python

Re: [Tutor] New to programming and Python

2006-10-26 Thread Danny Yoo
On Thu, 26 Oct 2006, Jorge Azedo wrote: First off, I don't know if I'm doing this right, I've never used a mailing list before, so I'm not sure if I'm sending this to the right place. Thanks for all the help you guys gave me ( e vocês também pessoal, é bom saber que há pessoal português po

Re: [Tutor] Mailing list question

2006-10-26 Thread Danny Yoo
>> Not so much a question about Python, but here goes: >> >> How do I reply to a specific thread in the mailing list? If I place >> "Re:bla bla" in the subject line, I notice that I start a new thread, >> I don't continue one that already exists. How do I go about doing this? >> Thanks for an

Re: [Tutor] basic question ...

2006-10-27 Thread Danny Yoo
On Fri, 27 Oct 2006, Ravi Kondamuru wrote: > How does one figure all the builtin libraries/ classes that python > supports? > > For example if I want to sort a list of names, I would normally think of > implementing the sorting routine in C. I am just beginning to learn > python. It looks lik

Re: [Tutor] problem importing class

2006-10-27 Thread Danny Yoo
>> It looks like people have identified the problem, that your site.py >> module isn't being found because it conflicts with something from >> Python's Standard Library. >> >> This isn't the first time this kind of problem has hit people. This >> problem is well known and is the subject of a Pyt

Re: [Tutor] I am terribly confused about "generators" and "iterators".. Help me

2006-10-28 Thread Danny Yoo
> My understanding is that an iterator is basically a facade` pattern. > If you aren't familiar with patterns, a facade` pattern basically makes > something really easy to use or convenient. Yes, you can "do it by > hand", and many times that is indeed the preferred method, but sometimes > it'

Re: [Tutor] Adding voting to several object in python and db

2006-10-28 Thread Danny Yoo
> Ok now to my question, I m trying to add a ranking feature to various > objects in the system, the users, their posts, their media etc, suffice > to say I have to rank a lot of objects. Hi Anil, It sounds like you want to add some sort of feature to a heterogeneous set of classes. Tradition

Re: [Tutor] name is not defined error

2006-10-29 Thread Danny Yoo
> It is my understanding that eval turns a string into a number and then I > can do math operations on it. Hi Kristinn, No, no, that's not what it does. *grin* Where did you read about eval() from? If you saw it in a beginner's tutorial, tell us who the guilty party is so we can knock some

Re: [Tutor] name is not defined error (fwd)

2006-10-29 Thread Danny Yoo
-- Forwarded message -- Date: Sun, 29 Oct 2006 12:33:58 -0500 From: Kristinn Didriksson <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] name is not defined error Hi Danny, Thanks :) The program works now. I'll take a look at those thre

Re: [Tutor] documentation/sourceforge bug help

2006-10-30 Thread Danny Yoo
On Mon, 30 Oct 2006, C or L Smith wrote: > Can anyone help me figure out how to actually get logged in so I can > file the report? Do you happen to have cookies disabled? You might need to enable them, since that's what SF will use to track your login status. I'm getting the feeling that i

Re: [Tutor] Does it helps to learn "Regular Expressions" or ...

2006-10-30 Thread Danny Yoo
> Is it useful to know re module and its functions..?? HI Asrarahmed, Yes. Most people find them to be invaluable in their day-to-day work. The problem is that they're powerful enough that they look like an all-in-one tool: it's tempting to use them, even when they are the wrong tool for the

Re: [Tutor] problem importing class

2006-10-30 Thread Danny Yoo
> This only works for code that is in a package, when you want to import a > module in the same package. It doesn't work for code that is not in a > package. For example, > > F:\Tutor>cat site.py > print 'imported site.py' > > F:\Tutor>cat siteimporter.py > from __future__ import absolute_import >

Re: [Tutor] paypal alternative

2006-10-30 Thread Danny Yoo
On Mon, 30 Oct 2006, Over Stock wrote: > International Money Transfer money transfer. [disgusting advertisement cut] [META: admin] This is crass, and deserves an appropriate response. I'm kicking 'Over Stock' off the python-tutor mailing list. I'm now CCing the other list admins on the ot

Re: [Tutor] immutable objects

2006-10-31 Thread Danny Yoo
> Im facing a problem with SOAPpy which checks for recursive objects using > id(obj). > > In my case value for 2 SOAP headers are same and iam getting a recursion > error. if i pass different object with same value SOAPpy does not complain > (by using str(value) and unicode(value)). If you can inc

Re: [Tutor] immutable objects

2006-11-01 Thread Danny Yoo
> here is the stack > trace. i know that SOAPpy is doing wrong by not checking the type of > the element along with id(ele). > I thought if there is any work around the problem i could use that without > upgrading SOAPpy after it is fixed. Hi Premnath, You might want to see if some other SOAP mod

Re: [Tutor] off topic GNOME background

2006-11-01 Thread Danny Yoo
On Tue, 31 Oct 2006, Amadeo Bellotti wrote: > my background just disappeared it shows a black screen like it cant find > the default background. if that makes sense I've added my own and it > cant seem to find it i removed it and re added it it doesn't seem to be > working though anyone have

Re: [Tutor] Writing Classes in python

2006-11-01 Thread Danny Yoo
On Wed, 1 Nov 2006, Rajesh R wrote: > I am new to Python and i have a very basic question about writing > classes. Lets say i have the following code : > [code cut] Hi Rajesh, Take a look at a Python class tutorial: http://www.diveintopython.org/object_oriented_framework/defining_classes.htm

Re: [Tutor] Tutor Digest, Vol 33, Issue 12

2006-11-03 Thread Danny Yoo
On Fri, 3 Nov 2006, dean dermody wrote: > > thank you .you can stop sending me these now thanks Done. In the future, please know that you can usually unsubscribe yourself from these kinds of technical mailing lists. Instructions on how to do so are usually at the footer of each message you

Re: [Tutor] Help me to debug this script .. I tried but ....

2006-11-05 Thread Danny Yoo
On Sun, 5 Nov 2006, Asrarahmed Kadri wrote: > When I am running the script from the command line, its working fine but > when I am trying to run from Pythonwin, its giving me error. > > Can anyone explain the reason? Hi Asrarahmed, Did you see Kent's reply? He mentioned: >> Something strange

Re: [Tutor] numpy and python

2006-11-06 Thread Danny Yoo
On Mon, 6 Nov 2006, linda.s wrote: > I use Python 2.4 IDLE to open a py code which import numeric. > I have installed both scipy and numpy into my c:\python24. However, it > was still reported as: Hi Linda, We need more details. What version of scipy and numpy did you install? Where did you

Re: [Tutor] Please help to debug this function.. it takes a date and num. of days and returns startdate and enddate

2006-11-06 Thread Danny Yoo
On Mon, 6 Nov 2006, Asrarahmed Kadri wrote: > I have written a function that takes a date and an integer representing > the number of days. > > Please test it, comment on the logic . Hi Asrarahmed, You should be able to write your own tests too. You might want to look at: http://www.

Re: [Tutor] First real script

2006-11-06 Thread Danny Yoo
On Mon, 6 Nov 2006, Carlos wrote: > This is my first script, I mean the first that I'm trying to do on my > own. Its a very simple Cellular Automata thing, the idea is that the > initial list A_List is rewritten based on some rules, in this case > Wolfram's rule 30. You can modify the list le

Re: [Tutor] Please help to debug this function.. it takes a date and num. of days and returns startdate and enddate (fwd)

2006-11-06 Thread Danny Yoo
[Forwarding to Tutor; busy at the moment] -- Forwarded message -- Date: Mon, 6 Nov 2006 18:41:54 + From: Asrarahmed Kadri <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Please help to debug this function.. it takes a date and num.

Re: [Tutor] (OT) Flame wars

2006-11-06 Thread Danny Yoo
> Wow... I had to click this e-mail just because I saw the first posts on the > mentioned thread and could see it turning for the worst.. Hi everyone, So let's try to squash this one now. There are more interesting problems to solve. Or other flame wars to fight. Let me see if we can do som

Re: [Tutor] First real script

2006-11-06 Thread Danny Yoo
> Do you know a better way to do this? > >if i < A_Len-1: > >a = A_List[i-1] >b = A_List[i] >c = A_List[i+1] > >else: > >a = A_List[i-1] >b = A_List[i] >c = A_List[0] Hi Carlos,

Re: [Tutor] (OT) Flame wars

2006-11-06 Thread Danny Yoo
On Mon, 6 Nov 2006, Chris Hengge wrote: > I may have just missed the point to your attempt to derail this > conversation =P Hi Chris, Ah! Are we talking about regular expressions anymore? No? Good. *grin* > Why do all that when you can just > > str = "Hello World" > print str * 2 Let

Re: [Tutor] numpy and python

2006-11-06 Thread Danny Yoo
[Danny] >> If you're using NumPy, then the correct package name for it is 'numpy', >> not 'Numeric'. >> >> from numpy import * [Linda] > I think the code is suing Numeric (is it called numpy now? if so, how > to make the change?) So it's not your code? If it's not your own code then, nail

Re: [Tutor] is gotchas?

2006-11-06 Thread Danny Yoo
c='1' ## one byte d='1' ## one byte c is d > True c='1,2' d='1,2' c is d > False > > The Hmmm! is emmitted because I'm thinking that if everything is an > object in python, then why does `c is d` evaluate to True when > the assigned value is 1 byte and evaluate to Fa

Re: [Tutor] hardware specs from python on OSX

2006-11-07 Thread Danny Yoo
On Tue, 7 Nov 2006, Yi Qiang wrote: > I am trying to get some basic information about the computer's hardware > specs in OSX in python. In linux I can get most of what I need from the > /proc filesystem. Is there an equivalent in OSX? If not, where else > can I get information about the sy

Re: [Tutor] Encoding and XML troubles

2006-11-08 Thread Danny Yoo
Vanilla (this works fine): #!/usr/bin/python from elementtree import ElementTree as etree eg = """redblue""" xml = etree.fromstring(eg) If I change the example string to this: redblu� I get the following error: xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 32)

Re: [Tutor] Please help to resolve this...

2006-11-08 Thread Danny Yoo
> *#server.py* > import SOAPpy > > > def hello(): > return "Hello World" > > server = SOAP.SOAPServer(("localhost", 23000)) > server.registerFunction(hello) > server.serve_forever() Hi Asrarahmed, I also want to reiterate what Luke said: it does get a little irritating if we see the same

Re: [Tutor] Please help to resolve this...

2006-11-08 Thread Danny Yoo
>> def hello(): >> return "Hello World" >> >> server = SOAP.SOAPServer(("localhost", 23000)) >> server.registerFunction(hello) >> server.serve_forever() > > Have you tried running server.py? There's a glaring error in it. (Hint: SOAP > != SOAPpy) Actually, there's a much more glaring er

Re: [Tutor] Questions about PIL

2006-11-08 Thread Danny Yoo
On Wed, 8 Nov 2006, Chris Hengge wrote: > I'm trying to figure out how to compare im1 to im2 and recognize the > difference. I dont care what the difference is... > > something like > > if im1 is not im2: >print "Not same" Do not use 'is' here. It is not doing any kind of equality testing

Re: [Tutor] Calling instance method using a string

2006-11-09 Thread Danny Yoo
>> Say I have class A: >> >> class A: >> def myMethod( self ): >> print 'foo' >> >> a = A() > > getattr(a, 'myMethod')() > > The getattr() call gets the bound method, the extra parentheses at the > end call it. Hi Bernard, You can also do this in a controlled manner by treating the

Re: [Tutor] Request - please join the list to post

2006-11-09 Thread Danny Yoo
On Thu, 9 Nov 2006, Kent Johnson wrote: > Tim Johnson wrote: >> On a related note, every time I post, I get some kind of advisory >> email back that is worded as if this is the first time I've posted. >> (I've been on this list for close to 6 years).. >> Not exactly spam, but not necessa

[Tutor] Some sample code: review?

2006-11-09 Thread Danny Yoo
Hi everyone, I wrote up some sample code to make a more extensible str()-like function. I'd like some comments before putting it up onto the Python Cookbook: # class DeepStr: """Deep stringifier.""" def __init__(self,

[Tutor] Can you help me with Elementtree (fwd)

2006-11-09 Thread Danny Yoo
Forwarding to tutor. Please don't email tutor questions directly to me, but do share them with the group instead. I don't want to shoulder the obligation of answering your question on my own; I'd rather share that with a support group like Tutor. See: http://catb.org/esr/faqs/smart-ques

Re: [Tutor] Some sample code: review?

2006-11-10 Thread Danny Yoo
> Some of the names and comments are confusing, I've commented below. > Other than that it looks good to me. >> def __init__(self, default_str=str, >> recursive_str=lambda obj, dstr: "..."): > > What are the arguments to default_str? Ah, good. I should document that

Re: [Tutor] Some sample code: review?

2006-11-10 Thread Danny Yoo
> I should, though, rephrase the signature as: > >register: object str_function -> string or None > > to be more readable. Separately, I can then define that a 'str_function' is > a callable that takes anything and turns it into a string. Ok, I made those changes. I've also fixed a very sil

Re: [Tutor] Tutor Digest, Vol 33, Issue 48

2006-11-11 Thread Danny Yoo
>>> I should, though, rephrase the signature as: >>> >>>register: object str_function -> string or None >>> >>> to be more readable. Separately, I can then define that a 'str_function' is >>> a callable that takes anything and turns it into a string. >> >> Ok, I made those changes. I've also

Re: [Tutor] Tutor Digest, Vol 33, Issue 48

2006-11-11 Thread Danny Yoo
>> What was the bug? > > If the stringifier saw two instances of the same object, it'd think that > recursion was going on. Unfortunately, since the numbers between 1-100 > are typically interned (as well as strings), it'd also think that if I > visited "0" twice,that I was in a recursive loop

[Tutor] church numerals

2006-11-11 Thread Danny Yoo
The function just mathematically converted a base-10 number into a base-2 number. > For what its worth - we say "base 10" to mean "decimal". But 10 = > decimal only when we have already agreed we are talking decimal! > Consider a planet where residents have 8 fingers. They count 0

Re: [Tutor] church numerals (fwd)

2006-11-12 Thread Danny Yoo
[Forwarding to tutor. Asrarahmed, please learn to use the "Reply to All" feature on your email client.] -- Forwarded message -- Date: Sun, 12 Nov 2006 11:03:42 + From: Asrarahmed Kadri <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subje

Re: [Tutor] Tutor Digest, Vol 33, Issue 52

2006-11-13 Thread Danny Yoo
> Is it possible to a single that contains two classes: > > Myclass.py file contains: > > Class one(object): > def needsomething(self): > Class two (object): > def dosomething(self): > > I want Class one's methods to access Class two methods? > > Class one(object): > def needsomething(self): >

Re: [Tutor] Tutor Digest, Vol 33, Issue 64

2006-11-16 Thread Danny Yoo
> I have been fighting with this for a couple of days and am getting > frustrated with it. I am trying to figure out a way to walk through the > windows registry and to capture all nodes under the > HKEY_CLASSES_ROOT\CLSID key and then put it into a list. Ok, let's do this carefully. Let's fir

[Tutor] Returning compound objects?

2006-11-16 Thread Danny Yoo
On Thu, 16 Nov 2006, Chris Hengge wrote: > I didn't send this to the list because I didn't want to go off-topic. [Meta] Then let's start a new topical thread. Let's call this one "Returning compound objects?" and work from there. But please let's keep this on Tutor; I'm serious when I say

Re: [Tutor] Tutor Digest, Vol 33, Issue 67

2006-11-16 Thread Danny Yoo
> > while True: # use the boolean value, its clearer IMHO :-) >try: > name.append(...) > print name[-1] > i += 1 >except WindowsError: pass > [some comments cut] > > Note that this call will create a new name list inside the recursive > call. You probably need to do: > >

[Tutor] Re A question about: Adding seconds to datetime object

2006-11-18 Thread Danny Yoo
> Is it possible to add seconds to a datetime object and get the result as > a new datetime object. I mean when we keep adding, for example, 3600 > seconds, the date will get changed after 24 iterations. Is it possible > to carry out such an operation ? Hi Asrarahmed, I want to add that you c

[Tutor] Changing mailing list options

2006-11-18 Thread Danny Yoo
> I am new subscriber to python and now, I'm getting e-mail from all sorts > of people having to do with questions I did not ask. Please take steps > to remove my address from that list and take steps to help me get e-mail > only from people answering my questions. I hope this is not an > unr

Re: [Tutor] Tutor Digest, Vol 33, Issue 84

2006-11-23 Thread Danny Yoo
> I think I see how to make a simple GUI with Tkinter, but I still > don't see how to use one with even a simple, previously non-GUI > Python script. I'm wondering if someone could create an example for > me, using the 2 functions fact() and printFact() at >

Re: [Tutor] a question about indentation

2006-11-24 Thread Danny Yoo
> I'm fairly new to python, and trying to get used to the indentation. I > just encountered my first problem with it. I wrote the following code: > > for ord in f_ord: >if not ordliste.has_key(ord) : >ordliste[ord] = {} >for word in e_ord: >if ordliste[ord].h

Re: [Tutor] Tutor Digest, Vol 33, Issue 100

2006-11-27 Thread Danny Yoo
> done=0 > fd = open("draw__output.txt",'r') > while not done: >line = fd.readline() >if line == '': >done = 1 >else: > for i in line: > d[i] = int(d[i])+ 1 Code simplification: you can do a loop directly across files. Files provide an "iterator" that allow us

Re: [Tutor] about reload

2006-12-29 Thread Danny Yoo
On Fri, 29 Dec 2006, linda.s wrote: > I read something about reload of modules. > #test.py > from ABC import M # M is an attribute of Module ABC > > if I change module ABC, I need import ABC and reload ABC before "from > ABC import M" work. in IDLE, I just click F5 and run the code, it works >

Re: [Tutor] about reload

2006-12-29 Thread Danny Yoo
> Actually, if you have IDLE in the default setup on Windows and you > right-click something to edit it, > IDLE doesn't open a subprocess each time a script is executed, so it > will keep the imports in between runs of the program. Hi Luke, Ah, thanks for the correction. _

Re: [Tutor] Need help with rewriting script to use Decimal module

2007-01-03 Thread Danny Yoo
>> Dick, if your goal is to have a routine to get the fraction with the least >> possible error (as opposed to learing how to use Decimal), have a look at >> this recipe from the Python Cookbook: >> >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52317 > > Terry, that is truly ingenio

Re: [Tutor] how to know if a file exists

2007-01-03 Thread Danny Yoo
On Thu, 4 Jan 2007, Andre Roberge wrote: >> > i am writing an app for linux. what command would be easiest to test >> > and see if a certain file exist ? >> > i was going to do something like this >> > try: >> > file = open('/path/to/file', 'rb') >> > return True >> > except: >> > re

Re: [Tutor] CGI script: get the client user

2007-01-10 Thread Danny Yoo
On Wed, 10 Jan 2007, [EMAIL PROTECTED] wrote: > I have some python CGI scripts running in an intranet. > > I would like to get the user of the client browser to use it as an input > in the script, so it can show the the data related to that user. > > There is the function getpass.getuser() that

Re: [Tutor] Psyco Puzzle

2007-01-11 Thread Danny Yoo
> Sometimes psyco speeds up a script by a factor of 10, and sometimes > it makes no difference at all. Here's a case where I fully expected > it to make a difference: > . Whether using psyco > or not, this takes about 13 seconds on my computer. Why n

Re: [Tutor] Image Question, List of Image Colors

2007-01-11 Thread Danny Yoo
> I'm trying to do what Kent suggested, but I have a little problem, no > matter were I put my image or if I use sys.path.append to append the > folder were my Image is located it is impossible to open the image. I > know that this is a silly question but what is going on? sys.path contains a l

Re: [Tutor] Converting a string to a list with each character as an item

2007-01-11 Thread Danny Yoo
On Thu, 11 Jan 2007, Terry Carroll wrote: > On Thu, 11 Jan 2007, Amadeo Bellotti wrote: > >> does anyone know how to do this? I need it because i want to make a binary >> coverter > s = "101001100100101" l = list(s) l > ['1', '0', '1', '0', '0', '1', '1', '0', '0', '1', '0', '0',

Re: [Tutor] it is about definitions

2007-01-16 Thread Danny Yoo
On Tue, 16 Jan 2007, Andreas Kostyrka wrote: > * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [070116 15:19]: >> >> is there a difference between: >> >> class foo: >> >> and >> >> class foo(): > This is a SyntaxError. Hi Andreas, We should ask Emilia why she's asking this question. This particular

Re: [Tutor] Array indexing

2007-01-16 Thread Danny Yoo
> While trying to implement a PE parser, I ran into the following problem: > > #** START CODE*** > data = file.read(128); > directoryTable = struct.unpack('', data); > i=0; > print "Export table 0x%08X + 0x%08x" % (directoryTable

Re: [Tutor] dealing with 406 HTTP response

2007-01-16 Thread Danny Yoo
On Tue, 16 Jan 2007, Tsila Hassine wrote: > has anybody dealt with a 406 reponse through a urllib.FancyURLopener > class ? I have a code that downloads images from websites and soemsites > respond with an 406 which I don't know how to handle Hi Tsila, Have you looked at the description of a

Re: [Tutor] dealing with 406 HTTP response (fwd)

2007-01-16 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 17 Jan 2007 02:08:48 +0100 From: Tsila Hassine <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] dealing with 406 HTTP response Danny - thanks! it works though I am not sure I fully understand what i d

Re: [Tutor] dealing with 406 HTTP response (fwd)

2007-01-16 Thread Danny Yoo
> Danny - thanks! it works though I am not sure I fully understand what i > did :-) Hi Tsila, When you have time, you may want to take a closer look at how HTTP works. Here's one place you can look: http://www.jmarshall.com/easy/http/ If you are writing applications for HTTP, you should

Re: [Tutor] What is a mixin class?

2007-01-17 Thread Danny Yoo
On Wed, 17 Jan 2007, Don Taylor wrote: > I have a vague idea what a mixin class is, I would like to get a better > handle on it. Hi Don, This post might help: http://mail.python.org/pipermail/tutor/2006-October/050448.html The core idea is that, since classes themselves are first-clas

Re: [Tutor] Division doesn't work

2007-01-18 Thread Danny Yoo
On Thu, 18 Jan 2007, Johan Geldenhuys wrote: > Thanks at lot. Something as simple as that... No, don't feel bad about it: integer division is a bad "gotcha!" in Python. Integer division is known to be suprising, and it'll eventually be replaced by true division in Python 3: http://www.

Re: [Tutor] Variables of Variables

2007-01-18 Thread Danny Yoo
> Rather than storing your data as variables, you could store it in a > dictionary. Then you can dynamically access data however you like.. Suggesting a dictionary here is right. The technique in the original poster's question is deprecated and widely known to be a Bad Idea in Perl. See Mark

Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress

2007-01-19 Thread Danny Yoo
> I've been dabbling into Python for about 6 weeks now.I'm a Social > Sciences student who just got interested in programming and chose Python > as first language. Out of curiosity, what materials are you using to learn how to program? > Isn't it legal to start a new block of code when start

Re: [Tutor] (no subject)

2007-01-19 Thread Danny Yoo
On Fri, 19 Jan 2007, Max Jameson wrote: > I know this is totally off-the-wall, but what am I doing wrong here? I > am using Python 2.5, and I am just learning...please be kind! Hi Max, Let's take a look. ### >>> aList = [2,3] >>> bList = [5,7,9] >>>

Re: [Tutor] (no subject) (fwd)

2007-01-19 Thread Danny Yoo
-- Date: Fri, 19 Jan 2007 10:10:04 -0800 (PST) From: Max Jameson <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] (no subject) Thanks, Danny. I expected to get the third element of the second list printed, as shown on the on-line tutorial I am r

Re: [Tutor] What is a mixin class?

2007-01-19 Thread Danny Yoo
> Wow, Danny. I am impressed. I am not sure that this should not be > called a 'mash-up' rather than a 'mix-in' but it has really been food > for thought. Thank you, but this isn't an original contribution. I mostly adapted the stuff in papers like: http://www.cs.utah.edu/plt/publicati

Re: [Tutor] Set changing order of items?

2007-01-19 Thread Danny Yoo
On Fri, 19 Jan 2007, Adam Cripps wrote: > I'm adding strings to a Set to prevent duplicates. However, the strings > are meant to be in the correct order. When I add the string to the Set, > the order seems to change (and I don't seem to be able to predict what > order they are in). Hi Adam,

Re: [Tutor] Redirect from a CGI script

2007-01-19 Thread Danny Yoo
On Sat, 20 Jan 2007, Paulino wrote: > well it doesn't work either! Hi Paulino, Try being more descriptive: what does your program look like now? It sounds like you've made a few changes. If you can show us the program, we'll do what we can to pinpoint the problems.

Re: [Tutor] Redirect from a CGI script

2007-01-20 Thread Danny Yoo
On Sat, 20 Jan 2007, Paulino wrote: > Still doesn't work. [some text cut] > I tryed all the sugestions from Andre with no succes. > > The cgi script as only these two lines: > 'print "Content-type:text/html\r\n" > 'print "Location:http://python.org/\r\n\r"; Ok, good. The last li

Re: [Tutor] Redirect from a CGI script

2007-01-20 Thread Danny Yoo
On Sat, 20 Jan 2007, Python wrote: > On Sat, 2007-01-20 at 10:13 -0800, Danny Yoo wrote: >> The last line of the program looks suspicious. If it helps, let me >> rearrange the program that you've written to: >> >> ###

Re: [Tutor] Staring myself blind

2007-01-20 Thread Danny Yoo
On Sat, 20 Jan 2007, Toon Pieton wrote: > In a program I'm writing, I'm getting a Tab/space error, with the usual > 1) identation is incorrect or 2) mixes tabs and spaces. I just can't > seem to find. I tried selecting everything and untabbing it, no workie. > I searched an searched and searc

Re: [Tutor] Staring myself blind

2007-01-20 Thread Danny Yoo
> This is also a possible code smell. Unless my code estimation is way off, I > don't believe that code shouldn't be so long. Oh good grief. Forgive me for the double negative there. I meant: "I don't believe the code should be that long." ___ Tutor

Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress

2007-01-21 Thread Danny Yoo
On Sun, 21 Jan 2007, jim stockford wrote: >no need for apology on my side. there's >no agreed-upon and expressed policy. >i like the model that we accept each > other as we are. [meta; not really related to Python programming] Hi Jim, I did want to bring up that there are some com

Re: [Tutor] Variables of Variables

2007-01-22 Thread Danny Yoo
> Actually, I started off with a dictionary with a bunch of parameters. To > give you some background, I writing my > first GUI, and using the parameters in a dictionary to control what box the > GUI displays next. So, it looks > something that looks like this: > > data={'position':'middle', >

Re: [Tutor] Difference between filter and map

2007-01-23 Thread Danny Yoo
On Tue, 23 Jan 2007, vanam wrote: > i want to know the difference between filter(function,sequence) and > map(function,sequence). Hi Vanam, They may both take functions as input, but the intention of the functions is different. In the case of filter(), the input function is used to cull the

Re: [Tutor] Python re without string consumption

2007-01-24 Thread Danny Yoo
On Wed, 24 Jan 2007, Jacob Abraham wrote: import re re.findall("abca", "abcabcabca") > ["abca", "abca"] > > While I am expecting. > > ["abca", "abca", "abca"] Hi Jacob, Just to make sure: do you understand, though, why findall() won't give you the results you want? The documentati

Re: [Tutor] Help Please

2007-01-28 Thread Danny Yoo
> This may be too elementary for most of you, but could you please help me > with the following question? This is almost certainly a homework problem. We are very restricted in what we can do to help. See: http://www.catb.org/~esr/faqs/smart-questions.html#homework > I would like to u

Re: [Tutor] reassigning/replacing sys.stdout

2007-01-30 Thread Danny Yoo
> The author of the cmd line app suggested I temporarily replace > sys.stdout'with a file descriptor class that can write directly to the > gui'. The author is now out of communications for a few weeks, so I > can't elaborate. It sounds like the subprocess module might be very useful here:

Re: [Tutor] Why this error ?

2007-01-31 Thread Danny Yoo
>> I mean put all the parameters with quotes, I guess that might be a cause >> of the error. >> >> conn = MySQLdb.connect ('host' = "localhost", 'user' = "testuser", >> 'passwd'= "testpass", 'db' = "test") > No, unfortunately the problem remains, but thanks anyway. It's supposed to be without quo

Re: [Tutor] Get variable values

2007-02-01 Thread Danny Yoo
On Thu, 1 Feb 2007, Mário Gamito wrote: I'm new to Python, so forgive me the lame question. I have this code (following my signature) and i'm trying to get the value of "content" and insert it into a MySQL database. Hi Mario, Wait, wait, before we continue here: did you finally get things

Re: [Tutor] Get variable values

2007-02-01 Thread Danny Yoo
>> Wait, wait, before we continue here: did you finally get things working >> from your last question? > > Yes, i got things working. That was just a test for python-MySQldb. Hi Mario, Ok, good. Next time, make it more clear to the group that things worked out fine, to close the thread. Rem

Re: [Tutor] Get variable values

2007-02-01 Thread Danny Yoo
> For now, i'd just like to pull out the variables values, and i don't > know how. For those who may be interested it's about file __init.py__ > from planetplanet code. Hi Mario, Have you read either of the following yet? http://www.amk.ca/python/writing/DB-API.html http://mail.pyth

Re: [Tutor] Get variable values

2007-02-01 Thread Danny Yoo
> Please tell me if you've read those and yet don't understand what they > are saying. Alternatively, if you've read them but still feel that they > are relevant to you, say that, and we'll try to elaborate why they > should be applicable. Errr.. substitute "relevant" with "irrelevant". Sorry

Re: [Tutor] Get variable values [Introduction to Planet RSS news aggregator]

2007-02-01 Thread Danny Yoo
r/lib/python2.4/site-packages/planet/cache.py", line 279, in __getattr__ raise AttributeError, key AttributeError: summary Ok, so some things are not defined. That's to be

Re: [Tutor] Get variable values [Introduction to Planet RSS news aggregator] (fwd)

2007-02-01 Thread Danny Yoo
-- Forwarded message -- Date: Fri, 02 Feb 2007 00:52:49 + From: "[ISO-8859-1] Mário Gamito" <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Get variable values [Introduction to Planet RSS news aggregator] Hi Dann

Re: [Tutor] Get variable values [Introduction to Planet RSS news aggregator] (fwd)

2007-02-02 Thread Danny Yoo
On Fri, 2 Feb 2007, Mário Gamito wrote: 1) This way i can only retrieve information from one blog. The one in the line c = planet.Channel(p, "http://blog.gamito.org/rss.php?blogId=1&profile=rss20";) How can i retrieve from them all ? Hi Mario, Have you tried asking for help from the plan

Re: [Tutor] curious struct problem

2007-02-02 Thread Danny Yoo
On Fri, 2 Feb 2007, Marcus Goldfish wrote: > I'm trying to read a binary file using struct. This code works > interactively in the IPython shell, but not as a function invoked from a > command line (Windows). Can someone point out my error? Thanks! Hi Marcus, There is something very suspici

Re: [Tutor] how to return an error from a CGI

2008-05-12 Thread Danny Yoo
Hi John, It's been a long time! I believe you may be looking for the Status Code stuff that web servers use to tell browsers that something special is happening. See Section 3.3.1.3 in: http://www.unix.com.ua/orelly/linux/cgi/ch03_03.htm for an example done in Perl; the code should be

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread Danny Yoo
Hello, I have a list of strings: data = [ '33386.472.22-1.11 0.43' '33386.67 3.33 -1.23 0.54' ... '46728.470.1-1.87-0.54' '46728.479.75.680.38' '46729.47-0.17-0.470.23'] I wish to convert it to a numpy array of floats. How do I accomplish th

<    8   9   10   11   12   13   14   15   16   17   >