Re: [Tutor] Better structure?

2005-01-31 Thread Danny Yoo
On Mon, 31 Jan 2005, Jacob S. wrote: > I think this thing is screaming for better structure, but previous attempts > at using oop for it have failed. Hi Jacob, Ok, I see one big refactoring that should help things quite a bit. There's a large case-analysis off if/elif/elif statements that in

Re: [Tutor] Better structure?

2005-02-01 Thread Danny Yoo
On Mon, 31 Jan 2005, Jacob S. wrote: > BTW, it was a few months ago, not days... but the thought still counts. > At least you remember. Hi Jacob, Wait, was it really a few months ago? Let me check the archive... http://mail.python.org/pipermail/tutor/2004-December/033728.html You're ri

Re: [Tutor] Better structure?

2005-02-02 Thread Danny Yoo
On Tue, 1 Feb 2005, Jacob S. wrote: > Also why shouldn't string methods include stuff like lstrip which do > precisely what I request? Hi Jacob, I think the confusion here is that, in Python, strings can be considered a concrete single thing, but they can also be considered an ordered collect

Re: [Tutor] Presentation

2005-02-02 Thread Danny Yoo
> The community is one of the things I particularly like about Python. I > always hated asking a question in the Perl newsgroups; although you > usually got an answer, you were almost certain to be told you're stupid > for not already knowing it. Hi Terry, Just to act as Devil's advocate: the

Re: [Tutor] Python 2.4 with Mandrake 10.0 query

2005-02-02 Thread Danny Yoo
On Wed, 2 Feb 2005, Glen wrote: > [EMAIL PROTECTED] glen]$ idle > set([34, 36, 38, 39]) > Failed to load extension 'CodeContext' > Traceback (most recent call last): > File "/usr/local/lib/python2.4/idlelib/EditorWindow.py", line 737, in > load_standard_extensions > self.load_extension(nam

Re: [Tutor] Python 2.4 with Mandrake 10.0 query

2005-02-02 Thread Danny Yoo
> > Ah! Check to see if there's a "sets.py" program somewhere in your > > current working directory. It's very likely that Python is picking > > that up, instead of the 'sets' standard library module. > > You're a genius! That's exactly what I'd done. Hi Glen, I'd attribute it not to genius,

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

2005-02-02 Thread Danny Yoo
On Thu, 3 Feb 2005, Liam Clarke wrote: > Had the *ahem* joy of learning Perl last night. Egad. Wrote the script > in Python to get it right, and then 'translated' it to Perl. Hi Liam, I strongly recommend sending the Perl code to that Perl-beginners mailing list referenced earlier. I'm sur

[Tutor] In-place changes on loops

2005-02-03 Thread Danny Yoo
On Thu, 3 Feb 2005, Sandip Bhattacharya wrote: > >for x in string: > >if x in chars: > >string[i] = '' > > I just have a hangover from other languages, but I really wanted to know > how Python handles iteration over a variable which is being changed > within the loop itse

Re: [Tutor] In-place changes on loops

2005-02-03 Thread Danny Yoo
> But let's change it to what I think you were thinking of: > > ### > def lstrip(string, chars): > scratchspace = list(string) ## get a mutable list of characters > for x in scratchspace: > if x in chars: > scratchspace[i] = '' > return ''.join(scratchspace)

Re: [Tutor] v.00001

2005-02-03 Thread Danny Yoo
On Thu, 3 Feb 2005, alieks laouhe wrote: > from math import * > z=0 > while z<=2*pi: > print cos(z) > z=z+(pi/6) > > ok i think this is right... Hi Alieks, This looks ok, and is probably the most straightforward way to do this. For safety's sake, you may want to modify the top i

[Tutor] switch vs table dispatch

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, Smith, Jeff wrote: > What you are try to do is "execute a block of code based on the value of > a single statement." if/elif doesn't do that and thereby introduces the > possibility of errors. > > switch on-this: > case 'a': > do something > case 'b

Re: [Tutor] arrays

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, alieks lao wrote: > in this tutorial it's telling me to > > "from Numeric import *" > > to load array functions > but it doesn't work is there a replacement for > "Numeric" or are arrays built in functions? Hi Alieks, Just out of curiosity, which tutorial are you reading?

[Tutor] Whitespace indentation

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, Smith, Jeff wrote: > On the indentation topic. I would be curious to know if anyone has had > an experience where a rogue process or editor has trashed the > indentation in your Python and how you recovered from it. [Meta: switching subject line again --- this conversation

Re: [Tutor] arrays

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, alieks lao wrote: > > Just out of curiosity, which tutorial are you reading? > > heres the url... > http://www.pentangle.net/python/ Hi Alieks, Ah, ok, that makes sense now. Michael William's tutorial assumes an environment where some third-party modules, like Numeric, ha

Re: [Tutor] question about expressing mathematical equations

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, alieks lao wrote: > Once again i have a question concerning something from the tutorial im > being tortured by. > > ___ > x.y= \ x (dot)y(dot) > /__ i >i > > How would i express this in python. > If the above doesn't make any sense to ya'll. > It's at

Re: [Tutor] question about expressing mathematical equations

2005-02-05 Thread Danny Yoo
On Sat, 5 Feb 2005, alieks lao wrote: > I've spent hours trying things out and I'm no better off. I don't > understand exactly what I'm supposed to do. Hi Alieks, What part of the problem are you working on? If you show us what you've tried so far; we can then try to figure out why you're get

Re: [Tutor] manipulating a file

2005-02-06 Thread Danny Yoo
On Mon, 7 Feb 2005, Reed L. O'Brien wrote: > I want to read the httpd-access.log and remove any oversized log records > > I quickly tossed this script together. I manually mv-ed log to log.bak > and touched a new logfile. > > running the following with print i uncommented does print each line t

Re: [Tutor] Iterating over multiple lists- options

2005-02-07 Thread Danny Yoo
On Mon, 7 Feb 2005, Tony Cappellini wrote: > There are 4 lists total, each of which *may* have a different length > from the other lists. Each list has been stored in a master dictionary. > > North=[Bill, Bob, Sue, Mary] > South=['Tim', ''Tom', 'Jim', 'John', 'Carl', 'Evan', 'Rich'] > etc > > I

Re: [Tutor] Iterating over multiple lists- options

2005-02-07 Thread Danny Yoo
On Mon, 7 Feb 2005, Tony Cappellini wrote: > > Here's a quick function that should force a certain length on an > > iterator: > > > > ### > > def ipad(iterable, length, sentinel=None): > > i = 0 > > for thing in iterable: > > yield thing > > i = i + 1 > > while i < le

Re: [Tutor] where do we use acquisition ?

2005-02-07 Thread Danny Yoo
Hi Chandu, Ah, so you're looking into "environmental acquisition". I think the reason you're asking about on Tutor is because one of the most visible deployments of acquisition has been in the Zope web framework. But just because Zope is written in Python doesn't mean that acquisition is a conc

Re: [Tutor] python lists to C arrays and vice versa

2005-02-07 Thread Danny Yoo
On Mon, 7 Feb 2005, Viktor Hornak wrote: > I've been trying to find more resources/documentation about how to > convert python lists to C arrays (and vice versa) when writing a python > extension. Hi Viktor, There was a post back in 1999 that might be useful for you: http://mail.python.o

Re: [Tutor] CRC-16 calculation

2005-02-08 Thread Danny Yoo
On Tue, 8 Feb 2005, Johan Geldenhuys wrote: > I have a data packet in Hex values and need to determine how to > calculate the CRC-16 bit checksum for these values: > > 0x55,0x00,0x0A,0x01,0x01, 0x01,0xFF,0x00,0xDC,0xCC > Sync|Lenght |source addr|dest. adr |Data| CRC check| > > This example sh

Re: [Tutor] What is in the traceback object

2005-02-08 Thread Danny Yoo
On Tue, 8 Feb 2005, Ertl, John wrote: > I have a bit of code that uses a module and I am trying to get more info > on the error. > > I am using this bit of code: > > try: > rhfill= Ngl.contour(wks,rhisobar,rh_res) > except: > execType,value,tracebak = sys.exc_info()[:

Re: [Tutor] Re: manipulating a file

2005-02-08 Thread Danny Yoo
> >>This simplifies the code down to: > >> > >>### > >>srcfile = open('/var/log/httpd-access.log.bak', 'r') > >>dstfile = open('/var/log/httpd-access.log', 'w') > >>for line in srcfile: > >>if len(line) < 2086: > >>dstfile.write(line) > >>srcfile.close() > >>dstfile.close() > >>### >

Re: [Tutor] help

2005-02-08 Thread Danny Yoo
On Tue, 8 Feb 2005, james middendorff wrote: > I want to use mysqldb to add people into a database, but when I ask for > the certain fields like Name, PhoneNumber and such, I cannot get it to > put them in as a string? I am not sure what I am doing wrong but here is > my code thanks to anyone wh

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

2005-02-09 Thread Danny Yoo
On Thu, 10 Feb 2005, Jeffrey Lim wrote: > > > > > >Example 1 > > > >>> def f(a,L=[]): > > >... if L==[5]: > > >... print 'L==[5] caught' > > >... print L > > >... print 'resetting L...' > > >... L=[] > > >... L.append(a) > > >... return L > > >... Hi Jeffery,

Re: [Tutor] help with refactoring needed -- which approach is more Pythonic?

2005-02-09 Thread Danny Yoo
On Wed, 9 Feb 2005, Brian van den Broek wrote: > Hi all, > > I have data files with a format that can be scheamatized as: > > File Header Contents > . . . > File Header End Tag > Node Header Contents > . . . > Node Header End Tag > Node Contents > . . . > Node End Tag > [Repeat Node elements unt

Re: [Tutor] help with refactoring needed -- which approach is more Pythonic?

2005-02-09 Thread Danny Yoo
> If we want to be fancy, we can also take advantage of Python's generator > support to avoid constructing an explicit list: > > ### > def partition_node_content(self, body_contents): > """Returns an iterator whose contents are a bunch of >node_content lists.""" > c

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

2005-02-09 Thread Danny Yoo
On Thu, 10 Feb 2005, Ismael Garrido wrote: > Danny Yoo wrote: > > >### > > > >def f(a,L=[]): > >if L==[5]: > >print 'L==[5] caught' > >print L > >print 'resetting L...' > >L=[

Re: [Tutor] Simple question on creating a filter

2005-02-11 Thread Danny Yoo
On Fri, 11 Feb 2005, Smith, Jeff wrote: > I'm sorry to both with such a simple question but I've looked in the > normal places and don't see the quick and dirty answer I know must > exist. > > I want to write a simple line selection filter that could be used like: > > filter < file > > I get the

Re: [Tutor] Idle needles

2005-02-11 Thread Danny Yoo
On Fri, 11 Feb 2005, Lobster wrote: > The tutorials I am accessing with Firefox and there seems to be a > conflict in which the Idle editor is trying to (or reported as accessing > the Net but does not (according to the literature and warning) Hello! IDLE does use network connections to talk t

Re: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-11 Thread Danny Yoo
> >way we ASP.NET at my company, and I'm having some trouble finding a good > >way to organize all the code. > > My take on doing that in Python: > > Organize things into modules. Especially with an eye to potential reuse. > Look at the module index in the docs to see how most of the "standard" >

Re: [Tutor] References in loops

2005-02-12 Thread Danny Yoo
On Fri, 11 Feb 2005, Matt Dimmic wrote: > In Python, one bug that often bites me is this: > > (example A) > aList = [1,2,3] > for i in aList: > i += 1 > print aList > --> [1,2,3] > > This goes against my intuition, which is that aList == [2,3,4], probably > because so much in Python is passe

Re: [Tutor] Idle needles

2005-02-12 Thread Danny Yoo
On Sat, 12 Feb 2005, Lobster wrote: > Idols subprocess didn't make connection Either Idle can't start or > personal firewall is blocking the connection = > > Now I am getting the added message that the "socket connection is > refused" (recently updated to the latest Zone Alarm) Hi Ed,

Re: [Tutor] I thank you . . .

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Lobster wrote: > # Wikipedia single word search engine > # Monday Feb 14 > > import webbrowser > > sought_word = raw_input("What is your wikipedia search word? ") > goto_url_location = "http://en.wikipedia.org/wiki/"; + sought_word > webbrowser.open(goto_url_location) Hi L

Re: [Tutor] calling an external program

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Alan Gauld wrote: > > - I am trying to call up an external program with something like a > > "Shell" command - can not find a way of doing this (in windows) > > Look in the os module, there are several options depending on exactly > what you need to do. The simplest option i

Re: [Tutor] Is an executable available?

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Kent Johnson wrote: > > I am working from within python and want to know the best way to know > > if a certain package is installed for use on my machine. > > > > I want to know from within python that a specific executable file is > > on my path where I could actually run t

Re: [Tutor] newbie OSX module path question

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Mike Hall wrote: > I'm on OS X, and I cannot get Python to import modules I've saved. I > have created the the environment.plist file and appended it with my > desired module path. If I print sys.path from the interpreter, my new > path does indeed show up as the first listi

Re: [Tutor] newbie OSX module path question

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Mike Hall wrote: > > Can you show us what your sys.path looks like? Just do a > > cut-and-paste so we can quickly validate it for you. > > Thanks for the response. Here's a paste of what sys.path returns. The > first listing is the path inside of environment.plist: > > ['',

Re: [Tutor] SQL Datetimes

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Bill Kranec wrote: > I'm using Kinterbasdb to access a Firebird database through Python, and > when I retrieve a row with a datetime value, I get a tuple like: > > >>> myCursor.execute( 'SELECT * FROM table' ) > >>> for row in myCursor.fetchall(): > print row > > (

Re: [Tutor] count words

2005-02-15 Thread Danny Yoo
On Tue, 15 Feb 2005, Ron Nixon wrote: > I know that you can do this to get a count of home many times a word > appears in a file > > > f = open('text.txt').read() > print f.count('word') > > Other than using a several print statments to look for seperate words > like this, is there a way to do i

Re: [Tutor] Basic terminology

2005-02-15 Thread Danny Yoo
> A remainder is what's left over after a division: > > 10/3 = 3 remainder 1 > 12/5 = 2 remainder 2 > 27/3 = 9 remainder 0 > > and the modulus operator (which is % in python) gives you that remainder: > > 10%3 = 1 > 12%5 = 2 > 27%3 = 0 Hi Bernard, Another familiar example of modulo is checking

RE: [Tutor] Case acceptance using raw_input

2005-02-15 Thread Danny Yoo
On Wed, 16 Feb 2005, Tony Meyer wrote: > >> Is there a better way for raw_input to accept both caps and > >> lower case letters than: > [...] > >>if action == 'y' or action == 'Y': > > > > if action in 'yY': > > dostuff() > [...] > > Although, that does mean that if a user enters 'nN' they'l

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Danny Yoo
On Wed, 16 Feb 2005, Bill Mill wrote: > > I have several thousand files in dBaseIV format that I need to convert > > to shapefiles for use in ArcGIS. I've written a script (see below) to > > automate this process but thus far have been unable to get it to work. > > I suspect that there's a simpl

Re: [Tutor] how to read from a txt file

2005-02-17 Thread Danny Yoo
> >> Traceback (most recent call last): > >> File "C:\Python23\practices\opentxt", line 12, in -toplevel- > >> process(data) > >> File "C:\Python23\practices\opentxt", line 6, in process > >> data_points.append(int(line)) > >> ValueError: invalid literal for int(): Hi Brian, Ah, th

Re: [Tutor] Advanced Calculator Program...

2005-02-19 Thread Danny Yoo
> > I want to make caculator program which enables me to enter 2numbers > > and mathsmatics sign and calculates it. I think this is too difficult > > for newbie like me... > > > > Please input data > > > > Number1: > > Mathsmetics Sign: > > Number2: > > > > (Number1) (Sign) (Number2) = (Result) >

Re: [Tutor] database programming

2005-02-21 Thread Danny Yoo
On Mon, 21 Feb 2005, Chris Mallari wrote: > hi there! can u pls send me sample code in accessing a simple database > using python. Hi Chris, You may want to look at the Database topic guide: http://www.python.org/topics/database/ It has links to examples, tutorials, and other documentati

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Danny Yoo
> > > I'm trying to figure out how to subclass the list built-in. > > > You could do it e.g. like that: > > > > class Mylist (list): > > def __init__(self, seq=None): > > super(self.__class__, self).__init__(seq) > > def __getslice__(self, start, stop): > > return self.__cl

Re: [Tutor] Python sizeof()

2005-02-23 Thread Danny Yoo
On Wed, 23 Feb 2005, Shitiz Bansal wrote: > Is there a python equivalent of c's sizeof function. Unfortuntately, no, not as a standard builtin. However, there is a third-party library called mxTools that does include a sizeof() function: http://www.egenix.com/files/python/mxTools.html B

Re: [Tutor] threads

2005-02-23 Thread Danny Yoo
On Wed, 23 Feb 2005, Shitiz Bansal wrote: > I am trying to build a traffic network simulator using python, for my > degree project. > > I need to run at least 5-6000 cars simultaneously. I wanted to run each > car in a separate thread. However , after about 400 threads i am unable > to create ne

Re: [Tutor] Precompiling to bytecode

2005-02-24 Thread Danny Yoo
On Thu, 24 Feb 2005, Smith, Jeff wrote: > I notice that python only pre-compiles imported modules and not the main > script. The only way I seem to be able to get this to happen is to run > > python -c "import mainscript" Hi Jeff, Python automatically tries to compile module code on an 'imp

Re: [Tutor] Interpreter level objects

2005-02-24 Thread Danny Yoo
On Wed, 23 Feb 2005, Jacob S. wrote: > Say I put the code > > import psyco > psyco.full() > > in sitecustomize.py and run a random file that I have already got an > average execution time of. Then I run it again, with the above > implemented. My execution time is has dropped. Which brings me to

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Danny Yoo
> > > > I'm writing a simple game (run in command line) in which narrative > > > > text is printed in response to a user's decisions. The problem I'm > > > > running into is that triple quotes used in an indented block > > > > preserves the indentation when it prints. [text cut] > > > Why not j

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread Danny Yoo
On Thu, 24 Feb 2005, Adam Cripps wrote: > I'm trying to create recursive Tkinter buttons with: > > for i in range(0,10): > print i > buttonlabel = "field " +str(i) > button[i] = Button (text=buttonlabel) >

Re: [Tutor] sys.argv[1: ] help

2005-02-25 Thread Danny Yoo
> > I am reading ' Learning Python second edition' by Mark Lutz and David > > Ascher, and I trying the code examples as I go along. However I am > > having a problem with the following, which I don't seem to be able to > > resolve :- > > # test.py > > import sys > > > > print sys[ 1: ] > > > > T

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Danny Yoo
> >(I know I'm being a bit silly about asking about what looks like a > >simple email typo, but computer programming bugs are all-too-often > >about typos. *grin* > > Sorry for the late response, I tried all of the the suggestions, > including correcting my typo of print sys[1:] and tried print >

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Danny Yoo
> Add a file called 'test.cmd' in the same directory as your 'test.py' > program with the following content: > > ### > python test.cmd %* > ### Scratch that! *grin* Sorry, meant to write that the test.cmd should contain: ### python test.py %* ### Darn it, but I don't have a Windows box handy

Re: [Tutor] Learning python as a thing to do

2005-02-27 Thread Danny Yoo
On Sun, 27 Feb 2005, Greg T wrote: > I am a Rubyist, but I've decided to learn Python so that when a > conversation springs up about the merits of the two languages amd how > they compare, I will be well informed. Hi Greg, Welcome aboard! That sounds great; you can help us understand Ruby bet

Re: [Tutor] Python and a web image map

2005-02-28 Thread Danny Yoo
> Save the above as an HTM and click, it should give you the x,y co-ords > for the browser window excluding scrolbars etc. It is possible to do this with Python, since a server-side HTML ISMAP will send its coordinates off as part of the request. There are some notes here: http://www.algon

Re: [Tutor] Setting up a database

2005-03-01 Thread Danny Yoo
On Tue, 1 Mar 2005, James O. Sweeney wrote: > I have an assignment that entails entering cash transactions as records. Hi James, Just to make it clear: we are prohibited from doing homework questions. Since it's an assignment, we'll try to stay clear of direct solutions. > My question is ab

Re: [Tutor] Setting up a database

2005-03-01 Thread Danny Yoo
> ### > >>> d = {} > >>> def addTally(name): > ... d.setdefault(name[0], []).append(name) > ... > >>> addTally('john') > >>> addTally('brian') > >>> addTally('jane') > >>> addTally('alice') > >>> addTally('bob') > >>> d > {'a': ['alice'], 'j': ['john', 'jane'], 'b': ['brian', 'bob']} > ### > >

Re: [Tutor] slow html generation code

2005-03-02 Thread Danny Yoo
On Wed, 2 Mar 2005, Luis N wrote: > This code seems a little slow, is there anything in particular that > jumps out as being not quite right. Hi Luis, Some comments: You have an empty 'except' exception-handling block in the code: ## try: for i in files:

Re: [Tutor] Re: Q & A

2005-03-03 Thread Danny Yoo
[Meta note to other folks on the list: I'm sorry for letting this post through; I was rushing, and I should have been more careful when going through my moderation queue.] On Fri, 25 Feb 2005, liew choon chui wrote: > Here are two question to need some solution. Hi Lieu Choon Chui, I do not

Re: [Tutor] Programming challenge (C++ and Python)

2005-03-04 Thread Danny Yoo
On Fri, 4 Mar 2005, Liam Clarke wrote: > ??? Why am I getting this one as new again? Hi Liam, This one is my fault. As a mailing list administrator, I have to go through stuff that's sitting in a moderation queue. I'd been a little derelict in my responsibility lately, and hadn't looked at t

Re: [Tutor] Re: Linked List

2005-03-04 Thread Danny Yoo
On Fri, 4 Mar 2005, Andrei wrote: > Shitiz Bansal wrote on Fri, 4 Mar 2005 09:19:41 -0800 (PST): > > > Any body has any idea on how to implement a linked list in python? There's a chapter on Linked Lists in "How to Think Like a Computer Scientist": http://www.ibiblio.org/obp/thinkCSpy/chap

Re: [Tutor] Re: Q & A

2005-03-04 Thread Danny Yoo
On Fri, 4 Mar 2005, Chelan Farsight wrote: > Okay this is a real question I have and I am not trying to defend the > actions of Mr. Chui. I simply wanted to make sure that I have joined > the right list. Are we allowed to ask total n00b questions on this > list? Hi Chelan, Yikes! Newcomer

Re: [Tutor] Anyone know of a window utility to reverse engineer unknown binary graphic file format?

2005-03-05 Thread Danny Yoo
On Sat, 5 Mar 2005, R. Alan Monroe wrote: > I have some graphics files from an old DOS game that I want to convert > to a normal .png or whatever. Anyone know of a program that can load > binary data and view it multiple different ways? Like treating the raw > data as 1 bit, 4 bit, 8 bit, planar

Re: [Tutor] Linked List

2005-03-06 Thread Danny Yoo
> > >>> myls=range(50) > > >>> for i in myls: > > print i > > if i==20: > > myls.insert(5,5) > > > > The point is, the list(both size and elements) is > > changing even as it is being operated upon. > > My first thought was to say, "Use a queue.Queue." But it appe

Re: [Tutor] How to get graphical representation in Excel file

2005-03-07 Thread Danny Yoo
[Ravi] > > I am working on Python on Windows XP, Iam being able to create or > > generate an Excel file using python, but unable to write the excel > > file with the graphs in it. I want to represent some data in the form > > of Graph (Gant chart, Pie chart and all), [Liam] > Erm win32api?

Re: [Tutor] Paradox database files

2005-03-07 Thread Danny Yoo
On Mon, 7 Mar 2005, Victor Bouffier wrote: > Does anybody know of a Python module to read from Paradox database > files? I don't need to write back to the files. These files are being > exported using a proprietary application and I need to parse them to > extract transaction information. Hi V

Re: [Tutor] regular expression question

2005-03-08 Thread Danny Yoo
On Tue, 8 Mar 2005, Mike Hall wrote: > I'd like to get a match for a position in a string preceded by a > specified word (let's call it "Dog"), unless that spot in the string > (after "Dog") is directly followed by a specific word(let's say "Cat"), > in which case I want my match to occur direct

Re: [Tutor] regular expression question

2005-03-08 Thread Danny Yoo
On Tue, 8 Mar 2005, Mike Hall wrote: > Yes, my existing regex is using a look behind assertion: > > (?<=dog) > > ...it's also checking the existence of "Cat": > > (?!Cat) > > ...what I'm stuck on is how to essentially use a lookbehind on "Cat", > but only if it exists. Hi Mike, [Note: Please

Re: [Tutor] regular expression question

2005-03-08 Thread Danny Yoo
> > Regular expressions are a little evil at times; here's what I think you're > thinking of: > > ### > >>> import re > >>> pattern = re.compile(r"""dog(?!cat) > ...| (?<=dogcat)""", re.VERBOSE) > >>> pattern.match('dogman').start() > 0 > >>> pattern.search('dogcatcher').start

Re: [Tutor] Acessing files in Windows 2000

2005-03-08 Thread Danny Yoo
[Windows bashing cut] Python's support for Windows stuff is actually quite good, thanks to the work of Mark Hammond: http://starship.python.net/crew/mhammond/ A lot of us here do use Windows for COM programming. Let's get back to talking about Python programming and let's help Dave with hi

Re: [Tutor] Newbie in Python

2005-03-10 Thread Danny Yoo
On Thu, 10 Mar 2005, oscar ng wrote: > Needing help on a mail filtering system that explores the headers and > text and determines which category the email falls into. [text cut] Hi Oscar, Ok. What help do you need? You have not told us what problems you're having, so we're stuck just twidd

Re: [Tutor] Please help me get started on how to program useing python 2.4!!!

2005-03-11 Thread Danny Yoo
On Fri, 11 Mar 2005 [EMAIL PROTECTED] wrote: > OK i have learned that on the python shell if you put, print "some > message" the output is, some message Hi Jeff, Ok, yes, that looks right. Let me do that myself: ### >>> print "hello world" hello world ### (The '>>>' thing is what the Pytho

Re: [Tutor] Installing Python

2005-03-11 Thread Danny Yoo
On Fri, 11 Mar 2005, [iso-8859-1] Jan Ekström wrote: > I have tried to install Python 2.4 on two pc-s and get this error when I > follow the instruction and type python at the comand window or Idle > window. I am running Windows xp home edition. What am I doing wrong? >> > Here is the error. > I

Re: [Tutor] Installing Python....Getting Started (fwd)

2005-03-11 Thread Danny Yoo
AIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Installing PythonGetting Started Thank you for Your answer. I felt fresh air in my face. I got the instruction to start like this below What will we cover? How

Re: [Tutor] Please help me get started on how to program useing python 2.4!!! (fwd)

2005-03-11 Thread Danny Yoo
[Forwarding to [EMAIL PROTECTED] Please use your email client's "Reply-to-all" feature whenever you're replying to messages on the tutor list. Otherwise, no one else gets to see your questions.] -- Forwarded message -- Date: Fri, 11 Mar 2005 17:07:15 EST From: [EMAIL PROTECTED]

Re: [Tutor] Please help me get started on how to program useing python 2.4!!! (fwd)

2005-03-11 Thread Danny Yoo
[Forwarding to [EMAIL PROTECTED] Sorry about the repetition.] -- Forwarded message -- Date: Fri, 11 Mar 2005 17:18:03 EST From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [Tutor] Please help me get started on how to program useing python 2.4!!! ok heres where i got

RE: [Tutor] Newbie in Python (fwd)

2005-03-13 Thread Danny Yoo
-- Forwarded message -- Date: Sun, 13 Mar 2005 21:58:09 +1100 From: oscar ng <[EMAIL PROTECTED]> To: 'Danny Yoo' <[EMAIL PROTECTED]> Subject: RE: [Tutor] Newbie in Python Hi Danny, Thanks for the reply..i wasn't sure how this works so I am glad the

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

2005-03-13 Thread Danny Yoo
> > > > Where I come from, the output of a function is determined by the input > > to the function. > > Well, actually, your being upset at that is the exact point of > functional programming languages: in functional programming, the output > of a function is determined by its input, and *

Re: [Tutor] creating a tab delimited filename

2005-03-13 Thread Danny Yoo
On Sun, 13 Mar 2005, jrlen balane wrote: > what does a tab delimited filename mean? how am i going to make this? > also how does it differs from space delimited, csv, and others? Hello, As Kent mentioned, you probably mean "tab delimited file", which means a file whose lines are split up into

Re: [Tutor] creating a tab delimited filename

2005-03-13 Thread Danny Yoo
On Sun, 13 Mar 2005, Brian van den Broek wrote: > jrlen balane said unto the world upon 2005-03-13 19:37: > > so for example, i am creating a text file with file.write() > > > > how am i going to make the file a tab-delimited file??? any > > parameters needed??? > > > > >>> record1 = ['Foo', 'B

RE: [Tutor] Newbie in Python (fwd)

2005-03-13 Thread Danny Yoo
On Sun, 13 Mar 2005, Danny Yoo wrote: > Thanks for the reply..i wasn't sure how this works so I am glad there is > someone that might be able to help me. Because this is an university > assignment I am not sure how much of help you can provide..but here it > goes. [text c

Re: [Tutor] python>data>sqlite>python>data>paper

2005-03-13 Thread Danny Yoo
On Sat, 12 Mar 2005, [iso-8859-1] Jan Ekström wrote: > I have looked through a lot of tutor documentation. But I would ask > someone to show me python code for putting som data in a sqlite database > and code showing how I get data out of such a database Hi Jan, You may want to look at:

Re: [Tutor] help [Please use better subject lines than "help!"]

2005-03-13 Thread Danny Yoo
On Sun, 13 Mar 2005, R. Alan Monroe wrote: > > ok i have learned that on the python shell or new window you can > > type in..print "hello world"...and the output is ..'hello > > world'.. or you can put in anything realy and it say it back to > > you.is this a program or what > >

Re: [Tutor] strange hotshot error

2005-03-15 Thread Danny Yoo
On Tue, 15 Mar 2005 [EMAIL PROTECTED] wrote: > So I tried using the example code verbatim to see if I get the same > error messages, and I do! When I try "import hotshot.stats" I get: > > >>> import hotshot.stats > > Traceback (most recent call last): > File "", line 1, in -toplevel- > im

Re: [Tutor] strange hotshot error

2005-03-15 Thread Danny Yoo
> This is highly unusual! This should have worked without any error > messages, as both the 'profile' and 'hotshot' modules are part of the > Standard Library, and should work out of the box. Hi Tpc, Oh, wait. The above statement is usually true, unless we're running something from a Linux dis

Re: [Tutor] strange hotshot error

2005-03-15 Thread Danny Yoo
On Tue, 15 Mar 2005 [EMAIL PROTECTED] wrote: > hi Danny, I had no idea Debian split its profiler into a separate > package in the testing distro. That would explain it, except I am using > Debian unstable with Debian stable for security packages, as my "more > /etc/apt/sources.list" output is:

Re: [Tutor] Convert doesn't work... I'm stumped

2005-03-16 Thread Danny Yoo
On Tue, 15 Mar 2005, Jacob S. wrote: > Okay, not a very descriptive subject, but here goes... > > This is the code Hi Jacob, > from decimal import Decimal as D Ok, I think I see why you're using this, but you have to be aware that the decimal module itself is susceptible to imprecision:

Re: [Tutor] Convert doesn't work... I'm stumped

2005-03-16 Thread Danny Yoo
> > A table that stores a similar amount of information might be something > like this: > > ### > meterRatios = { 'm' : D(1), ## 1 meter == 1 meter > 'km' : D(1000),## 1000 meters == 1 kilometer > 'cm' : D(1)/D(100),## .001 meters == 1 c

RE: [Tutor] Newbie in Python (fwd)

2005-03-16 Thread Danny Yoo
[Forwarding to [EMAIL PROTECTED] Oscar, when you reply next time, please use your email client's Reply-to-all feature. Otherwise, no one else will see the message.] -- Forwarded message -- Date: Wed, 16 Mar 2005 23:03:13 +1100 From: oscar ng <[EMAIL PROTECTED]> To:

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Danny Yoo
On Wed, 16 Mar 2005, Shitiz Bansal wrote: > No, this list is not a linked list. > Since mu original code is rather huge, I am presenting > the relevant snippet. > queue=[] > def genpassenger(num,destination,queue=queue): > for i in range(num): > newpass=passenger(destination) >

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Danny Yoo
> --- Danny Yoo <[EMAIL PROTECTED]> wrote: > > > Ok, this makes sense. Each passenger thread needs to know about the > > queue, because that's the place you want the passenger to drop out of. > > > > Lists support a 'remove()' method, so

Re: [Tutor] set(...)

2005-03-17 Thread Danny Yoo
> I use: > > Python 2.3.4 (#2, Aug 19 2004, 15:49:40) [GCC 3.4.1 (Mandrakelinux (Alpha > 3.4.1-3mdk)] on linux2 ... IDLE 1.0.3 > > I wa

Re: [Tutor] unicode

2005-03-17 Thread Danny Yoo
On Mon, 14 Mar 2005, Stefan Elwesthal wrote: > I'm swedish, our databae is full of horrible characters with strange > dots on top and Python won't have none of it. it falls apart telling me > that it can't decode that sort of thingy! > > So.. will I have to do some terrible magic storing all sin

Re: [Tutor] primes

2005-03-17 Thread Danny Yoo
On Thu, 17 Mar 2005, Gregor Lingl wrote: > Hi! > Who knows a more concise or equally concise but more efficient > expression, which returns the same result as > > [x for x in range(2,100) if not [y for y in range(2,x) if x%y==0]] Hi Gregor, Here is one that's traduced... er... adapted from ma

Re: [Tutor] Prepend to a list?

2005-03-19 Thread Danny Yoo
On Sat, 19 Mar 2005, Jay Loden wrote: > How can I prepend something to a list? I thought that I could do > list.prepend() since you can do list.append() but apparently not. Any > way to add something to a list at the beginning, or do I just have to > make a new list? Hi Jay, Liam and Sean po

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

2005-03-19 Thread Danny Yoo
-- Forwarded message -- Date: Sun, 20 Mar 2005 00:05:07 -0500 From: Jay Loden <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Prepend to a list? Thanks for the replies everyone, I ended up changing my approach so that it won't require

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