Re: Python Gotcha's?

2012-04-05 Thread Iain King
A common one used to be expecting .sort() to return, rather than mutate (as it does). Same with .reverse() - sorted and reversed have this covered, not sure how common a gotcha it is any more. Iain On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: > Greetings, > > I'm going to

Re: tiny script has memory leak

2012-05-17 Thread Iain King
On Friday, 11 May 2012 22:29:39 UTC+1, gry wrote: > sys.version --> '2.6 (r26:66714, Feb 21 2009, 02:16:04) \n[GCC 4.3.2 > [gcc-4_3-branch revision 141291]] > I thought this script would be very lean and fast, but with a large > value for n (like 15), it uses 26G of virtural memory, and things

Re: use of index (beginner's question)

2011-04-28 Thread Iain King
On Apr 28, 2:45 am, Chris Angelico wrote: > Incidentally, you're allowed to put the comma on the last item too: > >  lists = [ >   ['pig', 'horse', 'moose'], >   ['62327', '49123', '79115'], > ] > > Often makes for easier maintenance, especially when you append > array/list elements. > > Chris Ang

Re: Code Review

2011-05-25 Thread Iain King
On May 25, 2:44 pm, ad wrote: > On May 25, 4:06 am, Ulrich Eckhardt > wrote: > > > > > ad wrote: > > > Please review the code pasted below. I am wondering what other ways > > > there are of performing the same tasks. > > > On a unix system, you would call "find" with according arguments and then

Re: How can I set the size of a window with tkinter?

2005-09-28 Thread Iain King
Tor Erik Sønvisen wrote: > Hi > > I create a canvas that is to big for the default window-size, so it gets cut > to fit... > How can I increase the window-size to make sure the canvas fits? > > regards tores root=Tk() root.minsize(300,300) root.geometry("500x500") will limit the window to be at

Re: backreferences

2005-09-28 Thread Iain King
Amy Dillavou wrote: > Can someone help me with understanding how python uses backreferences? > I need to remember the item that was last matched by the re engine but i > cant seem to understand anything that I find on backreferences. if I > want to access the last match do i use \number or is the

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Iain King
Andrea Gavana wrote: > I have tried your solution, Terry: > > > new_hue # your 'basic color', just the hue part > > rgb_base # color from the basic button image > > rgb_new # the new color you want to replace rgb_base with > > > > rgb_new = hsv_to_rgb( (new_hue,) + rgb_to_hsv(rgb_base)[1:]) >

Re: Python vs Ruby

2005-10-24 Thread Iain King
Tom Anderson wrote: > On Fri, 21 Oct 2005, vdrab wrote: > > > You can tell everything is well in the world of dynamic languages when > > someone posts a question with nuclear flame war potential like "python > > vs. ruby" and after a while people go off singing hymns about the beauty > > of Scheme

Re: more than 100 capturing groups in a regex

2005-10-25 Thread Iain King
Fredrik Lundh wrote: > Joerg Schuster wrote: > > > I just want to use more than 100 capturing groups. > > define "more" (101, 200, 1000, 10, ... ?) > > The Zero-One-Infinity Rule: http://www.catb.org/~esr/jargon/html/Z/Zero-One-Infinity-Rule.html Iain -- http://mail.python.org/mailman/li

Re: more than 100 capturing groups in a regex

2005-10-25 Thread Iain King
Steven D'Aprano wrote: > On Tue, 25 Oct 2005 05:17:52 -0700, Iain King wrote: > > > > > Fredrik Lundh wrote: > >> Joerg Schuster wrote: > >> > >> > I just want to use more than 100 capturing groups. > >> > >> define "mo

Re: more than 100 capturing groups in a regex

2005-10-25 Thread Iain King
Steven D'Aprano wrote: > On Tue, 25 Oct 2005 06:30:35 -0700, Iain King wrote: > > > > > Steven D'Aprano wrote: > >> On Tue, 25 Oct 2005 05:17:52 -0700, Iain King wrote: > >> > >> > > >> > Fredrik Lundh wrote: > >&

Re: more than 100 capturing groups in a regex

2005-10-26 Thread Iain King
Fredrik Lundh wrote: > Iain King wrote: > > > Anyway, back to the OP: in this specific case, the cap of 100 groups in > > a RE seems random to me, so I think the rule applies. > > perhaps in the "indistinguishable from magic" sense. > > if you want to kno

Re: Looping Problem (Generating files - only the last record generates a file)

2005-10-26 Thread Iain King
[EMAIL PROTECTED] wrote: > Hello All, > > I have a problem with the program that should generate x number of txt > files (x is the number of records in the file datafile.txt). > > Once I execute the program (see below) only one file (instead of x > files) is created. The file created is based on t

Re: Microsoft Hatred FAQ

2005-10-26 Thread Iain King
David Blomstrom wrote: > A bit off topic, but it amazes me that people in the > web design/Internet industry don't take a more active > stance against Microsoft. > > Think about it: The health care industry has been > privatized in the U.S. I spent sixteen years in > education, another institution

Double replace or single re.sub?

2005-10-26 Thread Iain King
I have some code that converts html into xhtml. For example, convert all tags into . Right now I need to do to string.replace calls for every tag: html = html.replace('','') html = html.replace('','') I can change this to a single call to re.sub: html = re.sub('<([/]*)i>', r'<\1em>', html) W

Re: Top-quoting defined [was: namespace dictionaries ok?]

2005-10-26 Thread Iain King
Duncan Booth wrote: > James Stroud wrote: > > > On Tuesday 25 October 2005 00:31, Duncan Booth wrote: > >> P.S. James, *please* could you avoid top-quoting > > > > Were it not for Steve Holden's providing me with a link off the list, > > I would have never known to what it is you are referring. I

Re: Double replace or single re.sub?

2005-10-26 Thread Iain King
Mike Meyer wrote: > "Iain King" <[EMAIL PROTECTED]> writes: > > > I have some code that converts html into xhtml. For example, convert > > all tags into . Right now I need to do to string.replace calls > > for every tag: > > > >

Re: Microsoft Hatred FAQ

2005-10-27 Thread Iain King
David Schwartz wrote: > Roedy Green wrote: > > > On Sun, 16 Oct 2005 16:31:41 GMT, Roedy Green > > <[EMAIL PROTECTED]> wrote, quoted or > > indirectly quoted someone who said : > > >> I used to be a retailer of custom computers. MS used a dirty trick > >> to compete with IBM's OS/2. They said to

Re: Microsoft Hatred FAQ

2005-10-27 Thread Iain King
David Schwartz wrote: > Roedy Green wrote: > > > The particular way MS threatened to put me out of business was by > > threatening to arm twist all wholesalers to refuse to sell MS product > > to me, which any retailer needed to survive in those days. > > Right, I get that. You owed your entir

Re: need help extracting data from a text file

2005-11-07 Thread Iain King
[EMAIL PROTECTED] wrote: > Hey there, > i have a text file with a bunch of values scattered throughout it. > i am needing to pull out a value that is in parenthesis right after a > certain word, > like the first time the word 'foo' is found, retrieve the values in the > next set of parenthesis (ba

Re: need help extracting data from a text file

2005-11-07 Thread Iain King
[EMAIL PROTECTED] wrote: > this is cool, it is only going to run about 10 times a day, > > the text is not written out like foo(bar) its more like > foo blah blah blah (bar) > then I guess you worked this out, but just for completeness: keywordPos = textfile.find("foo") start = textfile.find("("

PNG processing with only base python install

2005-11-08 Thread Iain King
My web server supports python CGI scripts, but I can't install anything else there - I can just use what they've provided. I want to process some PNG images - any ideas how I can do this with just the basic modules? Is there an image processing module written purely in Python? Iain -- http://m

Re: How to paste python code on wordpress?

2005-11-22 Thread Iain King
Dan Lowe wrote: > On Nov 22, 2005, at 12:30 AM, could ildg wrote: > > > Thank you~ > > It works! > > but how can paste "<" and ">", please? > > these 2 symbols will also confuse wordpress and I can't publish > > what I want. > > Replace < with < > > Replace > with > > > (where those abbreviations

Re: Documentation suggestions

2005-12-07 Thread Iain King
> The library reference has so many modules that the table of contents > is very large. Again, not really a problem that we can fix; splitting > it up into separate manuals doesn't seem like it would help. I like the Global Module Index in general - it allows quick access to exactly what I want.

Re: Documentation suggestions

2005-12-07 Thread Iain King
[EMAIL PROTECTED] wrote: > >> The library reference has so many modules that the table of contents > >> is very large. Again, not really a problem that we can fix; > >> splitting it up into separate manuals doesn't seem like it would > >> help. > > Iain> I like the Global Module I

Re: Documentation suggestions

2005-12-07 Thread Iain King
[EMAIL PROTECTED] wrote: > Iain> Well, the point of the GMI is to lookup whatever module you are > Iain> currently having to use for the first time (at least it is for > Iain> me). Giving easy access to the modules I've already had to look > Iain> up (because they are common) doesn't

Re: overload builtin operator

2005-08-29 Thread Iain King
Robert Kern wrote: > Shaun wrote: > > Thanks for your replies, obviously this isn't a simple thing to do so > > I'll take a different tack. > > > > The exact problem I am trying to solve here is to avoid the > > ZeroDivisionError in division. > > I have c++ code which delegates to python to calcul

Re: how to join two Dictionary together?

2005-08-30 Thread Iain King
DENG wrote: > dict1={...something...} > > dict2={...somethind else ..} > > dict1 + dict2 > > > that's does works ..:(, it's not like List... > > > anyone can tell me how to get it? > Uh, I'm just learning python too, so there may be a much simpler way to do this, but you could: dict3 = {} for k,

Re: how to join two Dictionary together?

2005-08-30 Thread Iain King
Iain King wrote: > DENG wrote: > > dict1={...something...} > > > > dict2={...somethind else ..} > > > > dict1 + dict2 > > > > > > that's does works ..:(, it's not like List... > > > > > > anyone can tell me how to g

Re: how to join two Dictionary together?

2005-08-30 Thread Iain King
[EMAIL PROTECTED] wrote: > update works like append for lists > > a = {} > a['a']='a' > a['c']='c' > b={} > b['b'] = 'b' > c={} > c.update(a) > c.update(b) > So what do you think is the better way to do it, based on speed or aesthetics? (1) c=a.copy() c.update(b) or (2) c={} c.update(a) c.upd

wxPython, using sizers.

2005-09-16 Thread Iain King
I'm making a program to view log files. The main display is a multi column listbox. I want to add combobox filters above the listbox headers. The filters contain each unique instance in the list column below it, and if any filter has text selected in it then the listbox will only display rows in

Re: question about what lamda does

2006-07-19 Thread Iain King
Steve Holden wrote: > tac-tics wrote: > > [EMAIL PROTECTED] wrote: > > > >>Hey there, > >>i have been learning python for the past few months, but i can seem to > >>get what exactly a lamda is for. What would i use a lamda for that i > >>could not or would not use a def for ? Is there a notable di

Re: using names before they're defined

2006-07-19 Thread Iain King
[EMAIL PROTECTED] wrote: > I have a problem. I'm writing a simulation program with a number of > mechanical components represented as objects. When I create instances > of objects, I need to reference (link) each object to the objects > upstream and downstream of it, i.e. > > supply = supply() > c

Re: using names before they're defined

2006-07-20 Thread Iain King
[EMAIL PROTECTED] wrote: > Iain, thanks - very helpful. > > Really I'm trying to write a simulation program that goes through a > number of objects that are linked to one another and does calculations > at each object. The calculations might be backwards or fowards (i.e. > starting at the supply o

Re: random shuffles

2006-07-21 Thread Iain King
Dustan wrote: > Boris Borcic wrote: > > does > > > > x.sort(cmp = lambda x,y : cmp(random.random(),0.5)) > > > > pick a random shuffle of x with uniform distribution ? > > > > Intuitively, assuming list.sort() does a minimal number of comparisons to > > achieve the sort, I'd say the answer is yes.

Re: FOR LOOPS

2006-08-01 Thread Iain King
OriginalBrownster wrote: > I am using a class called UploadedFile. > I want to create a for loop to itterate through the objects within file > name > > class UploadedFile(SQLObject): > filename = StringCol(alternateID=True) > abspath = StringCol() > uniqueid = IntCol() > > I'll s

Re: The Semicolon Wars as a software industry and human condition

2006-08-17 Thread Iain King
Xah Lee wrote: > Of interest: > > • The Semicolon Wars, by Brian Hayes. 2006. > http://www.americanscientist.org/template/AssetDetail/assetid/51982 > > in conjunction to this article, i recommend: > > • Software Needs Philosophers, by Steve Yegge, 2006 > http://xahlee.org/Periodic_dosage_dir/_p/s

Re: Looking For mp3 ID Tag Module

2006-08-18 Thread Iain King
Tim Daneliuk wrote: > Iñigo Serna wrote: > > On 8/18/06, Tim Daneliuk <[EMAIL PROTECTED]> wrote: > >> > try mutagen. > >> http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen > >> > >> This module is more-or-less exactly what I needed. However, I am running > >> into problems when the fil

Re: edit a torrent file with python

2006-10-13 Thread Iain King
di0rz` wrote: > hi, > I am looking for a python script to edit .torrent files > if anybody know one thx Not sure exactly what you are looking for, but the original bittorrent client is written in Python, so you could grab a copy of it and check the code. Iain -- http://mail.python.org/mailman/

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Iain King
Michele Petrazzo wrote: > Iain King wrote: > > Michele Petrazzo wrote: > > > > I downloaded and installed 0.9.9.3, and it now works. Thanks! > > > > I advice you to don't use that ctypes version... Better is to use the > newest one and update freeima

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Iain King
Michele Petrazzo wrote: > Iain King wrote: > > Michele Petrazzo wrote: > >> Iain King wrote: > >>> Michele Petrazzo wrote: > >>> > >>> I downloaded and installed 0.9.9.3, and it now works. Thanks! > >>> > >> I advice y

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Iain King
Michele Petrazzo wrote: > Iain King wrote: > > However, when I'm do the > > fipy.convertToPil(), it inverts the image? > > No, it not invert the image... It only return the image as is. > > > I've inserted a > > fipy.invert() before the conversion as

Re: Trying to get FreeImagePy to work.

2006-06-02 Thread Iain King
Iain King wrote: > Michele Petrazzo wrote: > > Iain King wrote: > > > However, when I'm do the > > > fipy.convertToPil(), it inverts the image? > > > > No, it not invert the image... It only return the image as is. > > > > > I've ins

Re: shuffling elements of a list

2006-06-02 Thread Iain King
David C. Ullrich wrote: > On 30 May 2006 21:53:32 -0700, "greenflame" <[EMAIL PROTECTED]> > wrote: > > That's DSU for _sorting_ a list. I read about this, thought > it was pretty neat. I thought that the fact that you > could use the same trick for _shuffling_ a list was > my idea, gonna make me r

Re: Trying to get FreeImagePy to work.

2006-06-05 Thread Iain King
Michele Petrazzo wrote: > Iain King wrote: > >> I'll try out FIPY's resizing tomorrow too. OTOH, I have functions > >> to convert between PIL and wxPython, and functions to convert > >> betweem PIL and FIPY, but I don't see a function to convert

Re: Large Dictionaries

2006-06-05 Thread Iain King
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > Scott David Daniels <[EMAIL PROTECTED]> wrote: > > >For example, time timsort (Python's internal sort) on pre-sorted > >data; you'll find it is handled faster than random data. > > But isn't that how a reasonable sorting algorithm sho

Bug in list comprehensions?

2006-06-07 Thread Iain King
I was playing with list comprehensions, to try and work out how doubled up versions work (like this one from another thread: [i for i in range(9) for j in range(i)]). I think I've figured that out, but I found something strange along the way: >>> alpha = ["one", "two", "three"] >>> beta = ["A", "

Re: pyqt show wizard

2006-06-07 Thread Iain King
David Boddie wrote: > Summary of the usual mess made by the Google Groups web interface: > > > I suspect that you really want to call w.exec_loop() instead, since > this will only return control to the method after the user has finished > interacting with the wizard. > > > Take a look at the QWiza

Re: .py and running in Windows:

2006-06-13 Thread Iain King
Andrew Gwozdziewycz wrote: > You'll have better results posting this to it's own thread. > He certainly should have, but since I've read it here anyway: > On Jun 13, 2006, at 9:29 AM, Michael Yanowitz wrote: > > > Hello: > > > > Presently in my Windows 2000 system, when I double-click on a >

Re: Feed wxComboBox with dictionary/hash

2006-06-22 Thread Iain King
Roland Rickborn wrote: > Hi folks, > > I am relatively new to Python. Although I read a lot of howtos, > introductions and wikis, I am still having trouble ;-) > > My querstion: > As the subject says, I'd like to feed a wx.ComboBox with a > dictionary/hash. According to the posting of Stano Paska

Re: String Question

2006-06-28 Thread Iain King
[EMAIL PROTECTED] wrote: > mac_string = '001485e55503' (This is the mac address of a computer.) > > I am using wake on LAN python script to start computer remote.It uses > format like this > > s.sendto('\xff'*6 + '\x00\x014\x85\xe5\x55\x03'*16, ('192.168.1.255', > 80)) > > where '\x00\x14\x8

Re: String Question

2006-06-30 Thread Iain King
Tim Roberts wrote: > "Iain King" <[EMAIL PROTECTED]> wrote: > > > >You probably want: > > > >s.sendto('\xff'*6 + ('\x%s\x%s\x%s\x%s\x%s\x%s' % (str01, str02, str03, > > sttr04, str05, str06))*16, ('192.168.1.255', 80

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread Iain King
luis wrote: > Hi > I'm using activestate python 2.4 on win xp 2 ed. and Ms Access 2002 > (reading first http://starship.python.net/crew/bwilk/access.html) > I have writed the following code > > def append_from_Access(self): >try: > import ... > conn = win32com.client.Dispatch(r'ADO

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread Iain King
luis wrote: > Iain King ha escrito: > > > luis wrote: > > > while not rs.EOF: > > > id=rs.Fields(colName.Value) #colName, valid column name > > > ... > > > rs.MoveNext() > > > rs.Close() > > >

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread Iain King
luis wrote: > Iain King ha escrito: > > > luis wrote: > > > Iain King ha escrito: > > > > > > > luis wrote: > > > > > while not rs.EOF: > > > > > id=rs.Fields(colName.Value) #colName, valid column name >

Re: List Manipulation

2006-07-04 Thread Iain King
Roman wrote: > I would appreciate it if somebody could tell me where I went wrong in > the following snipet: > > When I run I get no result > > cnt = 0 > p=[] > reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel", > quotechar="'", delimiter='\t') > for line i

Re: List Manipulation

2006-07-05 Thread Iain King
Mike Kent wrote: > Roman wrote: > > Thanks for your help > > > > My intention is to create matrix based on parsed csv file. So, I would > > like to have a list of columns (which are also lists). > > > > I have made the following changes and it still doesn't work. > > > > > > cnt = 0 > > p=[[], []

Re: Full splitting of a file's pathname

2006-07-10 Thread Iain King
tac-tics wrote: > I know about os.path.split(), but Is there any standard function for > "fully" splitting a file's pathname? A function that is the opposite of > the os.path.join() function? For example: > > >>> ret = myster_function(./foo/bar/moo/lar/myfile.txt) > >>> print ret > ['.', 'foo', 'b

Re: PIL cannot open TIFF image in Windows

2006-09-11 Thread Iain King
Michele Petrazzo wrote: > Rob Williscroft wrote: > > > I downloaded some test images from: > > > > http://www.remotesensing.org/libtiff/images.html> > > > > I do the same and modified your code for try FreeImagePy and the results > are: > > ok: 41 error: 20 total: 61 > > Better

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Iain King
[EMAIL PROTECTED] wrote: > Hi, > > I have a program which will continue to run for several days. When it is > running, I can't do anything except waiting because it takes over most > of the CUP time. > > Is it possible that the program can save all running data to a file when > I want it to stop,

"wxPython in Action" book

2006-01-24 Thread Iain King
New book on wxPython: http://www.manning.com/books/rappin Release date of this month. Does anyone know if it's out yet / has anyone read it and has an opinion? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Conventions

2006-02-01 Thread Iain King
Jared Russell wrote: > To mess around with it, I decided to create a small app to check my > Gmail. I want something that will just sit in my system tray checking > for new emails every ten minutes or so. How do you gain access to the system tray? Iain -- http://mail.python.org/mailman/listi

Re: Create dict from two lists

2006-02-10 Thread Iain King
py wrote: > Thanks, itertools.izip and just zip work great. However, I should have > mentioned this, is that I need to keep the new dictionary sorted. > > d = {1:'first', -5 : 'negative 5', 6:'six', 99:'ninety-nine', > 3:'three'} > keys = d.keys() > keys.sort() > vals = map(d.get, keys) > > At th

Re: Self-identifying functions and macro-ish behavior

2006-02-15 Thread Iain King
[EMAIL PROTECTED] wrote: > Hi, I was wondering how I may get a python function to know what its > name is without me having to write it manually? For example: > > def func1(): > > print 'func1' > return True > > def func2(): > > print 'func2' > return True > > should be

looping over more than one list

2006-02-16 Thread Iain King
When I loop over one list I use: for item in items: print item but often I want to loop through two lists at once, and I've been doing this like I would in any other language - creating an index counter and incrementing it. For example, (completely arbitrary), I have two strings of the same l

Re: Python CGI not working in Firefox but does in IE

2006-02-22 Thread Iain King
Harlin Seritt wrote: > I have this Python CGI script running: > > [CODE] > print 'Content-type: text/plain\n' > > location = 'http://server1.com' > > page = ''' > > > > > > ''' > > print page > [/CODE] > > It works fine and redirects perfectly when using Internet Explorer but > only shows thi

Re: Python CGI not working in Firefox but does in IE

2006-02-22 Thread Iain King
Iain King wrote: > Harlin Seritt wrote: > > I have this Python CGI script running: > > > > [CODE] > > print 'Content-type: text/plain\n' > > > > location = 'http://server1.com' > > > > page = ''' > > &g

Re: string stripping issues

2006-03-03 Thread Iain King
Ben Cartwright wrote: > Ben Cartwright wrote: > > orangeDinosaur wrote: > > > I am encountering a behavior I can think of reason for. Sometimes, > > > when I use the .strip module for strings, it takes away more than what > > > I've specified. For example: > > > > > > >>> a = 'Hughes. John\r

Re: object's list index

2006-03-03 Thread Iain King
William Meyer wrote: > hi, > > I need to get the index of an object in a list. I know that no two objects > in the list are the same, but objects might evaluate as equal. for example > > list = [obj1, obj2, obj3, obj4, obj5] > for object in list: > objectIndex = list.index(object) > pr

Re: object's list index

2006-03-03 Thread Iain King
Iain King wrote: > William Meyer wrote: > > hi, > > > > I need to get the index of an object in a list. I know that no two > > objects > > in the list are the same, but objects might evaluate as equal. for example > > > > list = [obj1, o

Re: object's list index

2006-03-03 Thread Iain King
Iain King wrote: > Iain King wrote: > > William Meyer wrote: > > > hi, > > > > > > I need to get the index of an object in a list. I know that no two > > > objects > > > in the list are the same, but objects might evaluate as equal.

Re: wxPython and threads

2007-07-19 Thread Iain King
On Jul 18, 3:41 am, Benjamin <[EMAIL PROTECTED]> wrote: > I'm writing a search engine in Python with wxPython as the GUI. I have > the actual searching preformed on a different thread from Gui thread. > It sends it's results through a Queue to the results ListCtrl which > adds a new item. This work

Re: Difference between two times (working ugly code, needs polish)

2007-09-12 Thread Iain King
On Sep 12, 1:31 am, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > I suppose really oneDay should be a global (i.e. outside the function > > definition). Apart from that it would be hard to improve on: obvious, > > easy to read, in short - pythonic. > > > Are you concerned about daylight savings?

Re: Best way to generate alternate toggling values in a loop?

2007-10-18 Thread Iain King
On Oct 18, 2:29 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-10-17, Debajit Adhikary <[EMAIL PROTECTED]> wrote: > > > # Start of Code > > > def evenOdd(): > > values = ["Even", "Odd"] > > state = 0 > > while True: > > yield values[state] > > state = (state + 1)

Re: the annoying, verbose self

2007-11-27 Thread Iain King
On Nov 27, 9:20 am, Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Bruno Desthuilliers <[EMAIL PROTECTED]> > > > > wrote: > > Steven D'Aprano a écrit : > > > On Mon, 26 Nov 2007 21:48:36 +0100, Ton van Vliet wrote: > > > >> On Mon, 26 Nov 2007 20:14:50 +0100, Bruno Desth

Re: the annoying, verbose self

2007-11-27 Thread Iain King
On Nov 27, 12:03 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Iain King <[EMAIL PROTECTED]> wrote: > > FTR, I won't be using this :) I do like this syntax though: > > > class Vector: > > def __init__(self, x, y, z): > > self.x =

Re: threading, how to?

2006-04-21 Thread Iain King
akrapus wrote: > Thanks for reply. > > So would it be implemented as follows: > > Func 1 > Func 2 > Func 3 > > Thread for Func 1 > Thread for Func 2 > Thread for Func 3 > > Cheers > > Stevan Here's how I'm doing it, using the thread module (there's a higher level class-based module: threading, but

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Iain King
Wildemar Wildenburger wrote: > Over the time I've seen lots of remarks about python that read like "a > lot like lists in lisp" or "like the hashtable in java" or any other > form of "like in ". > > Are there any concepts that python has not borrowed, concepts that were > not even inspired by oth

Re: Counting elements in a list wildcard

2006-04-25 Thread Iain King
hawkesed wrote: > If I have a list, say of names. And I want to count all the people > named, say, Susie, but I don't care exactly how they spell it (ie, > Susy, Susi, Susie all work.) how would I do this? Set up a regular > expression inside the count? Is there a wildcard variable I can use? > He

Re: Counting elements in a list wildcard

2006-04-25 Thread Iain King
John Machin wrote: > On 25/04/2006 6:26 PM, Iain King wrote: > > hawkesed wrote: > >> If I have a list, say of names. And I want to count all the people > >> named, say, Susie, but I don't care exactly how they spell it (ie, > >> Susy, Susi, Susie all wor

Re: Counting elements in a list wildcard

2006-04-26 Thread Iain King
Edward Elliott wrote: > John Machin wrote: > > On 25/04/2006 6:26 PM, Iain King wrote: > >> iain = re.compile("(Ia(i)?n|Eoin)") > >> steven = re.compile("Ste(v|ph|f)(e|a)n") > > > > IMHO, the amount of hand-crafting that goes into a *

wxpython warnings

2006-04-26 Thread Iain King
I have a wxpython program that displays TIF images. Sometimes it will encounter a tag the tiff loader cant handle. Rather than silently ignoring it, it pops up a window: Python Warning unknown field with tag blah blah I don't want it to do this, but I can't work out how to turn it off. Anyone k

Re: wxpython warnings

2006-04-26 Thread Iain King
Michele Petrazzo wrote: > Philippe Martin wrote: > > I had a similar but simple problem (the file was missing) and had to > > check by hand before calling wxPython. > > > > Can you check the tag by hand before calling wxPython ? > > > > > > Philippe > > > > > > Hi, > also I have the same problem w

pytiff for windows

2006-04-27 Thread Iain King
Does anyone have a link for a compiled-for-windows version of pytiff? (or alternatively tell me how to get PIL to save a multipage tiff). Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: returning none when it should be returning a list?

2006-05-02 Thread Iain King
John Machin wrote: > > # Doh! Looks like recursion not necessary. Google 'eliminate tail > recursion' :-) > I did, and found this: http://www.biglist.com/lists/dssslist/archives/199907/msg00389.html which explains that the Scheme compiler optimises (obvious) tail recursion into iterative code. I

Web framework comparison video

2006-05-08 Thread Iain King
http://compoundthinking.com/blog/index.php/2006/03/10/framework-comparison-video/ Thought this might be interesting to y'all. (I can't watch it 'cos I'm at work, so any comments about it would be appreciated :) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Iain King
Oh God, I agree with Xah Lee. Someone take me out behind the chemical sheds... Iain Xah Lee wrote: > Tabs versus Spaces in Source Code > > Xah Lee, 2006-05-13 > > In coding a computer program, there's often the choices of tabs or > spaces for code indentation. There is a large amount of confus

Re: Tabs versus Spaces in Source Code

2006-05-17 Thread Iain King
Ant wrote: > I think Duncan has hit the nail on the head here really. I totally > agree that conceptually using tabs for indentation is better than using > spaces. Pragmatically though, you can't tell in an editor where spaces > are used and where tabs are used. > Um, I don't follow this. If you

Re: noob import question

2006-05-19 Thread Iain King
Brian Blazer wrote: > OK, I have a very simple class here: > > class Student: > """Defines the student class""" > > def __init__(self, lName, fName, mi): > self.lName = lName > self.fName = fName > self.mi = mi > > Then I have a small script that I am using as

Trying to get FreeImagePy to work.

2006-05-26 Thread Iain King
I've installed ctypes and FreeImagePy. When I do this: >>> import FreeImagePy >>> f = FreeImagePy.Image() I get: find Traceback (most recent call last): File "", line 1, in ? File "C:\Python\Lib\site-packages\FreeImagePy\FreeImagePy.py", line 1952, in _ _init__ super(Image, self).__init_

Re: Trying to get FreeImagePy to work.

2006-05-26 Thread Iain King
Michele Petrazzo wrote: > Iain King wrote: > > I've installed ctypes and FreeImagePy. When I do this: > > > >>>> import FreeImagePy f = FreeImagePy.Image() > > > > I put a 'print self._name' in the ctypes __init__ file, just before &g

Re: String To List

2008-03-17 Thread Iain King
On Mar 17, 6:56 am, Dan Bishop <[EMAIL PROTECTED]> wrote: > On Mar 17, 1:15 am, Girish <[EMAIL PROTECTED]> wrote: > > > I have a string a = "['xyz', 'abc']".. I would like to convert it to a > > list with elements 'xyz' and 'abc'. Is there any simple solution for > > this?? > > Thanks for the help.

Re: String To List

2008-03-17 Thread Iain King
On Mar 17, 9:27 am, Iain King <[EMAIL PROTECTED]> wrote: > On Mar 17, 6:56 am, Dan Bishop <[EMAIL PROTECTED]> wrote: > > > On Mar 17, 1:15 am, Girish <[EMAIL PROTECTED]> wrote: > > > > I have a string a = "['xyz', 'abc']"..

Re: Multiple equates

2008-11-25 Thread Iain King
On Nov 17, 7:41 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > It doesn't matter as none of this is valid Python. In Python you have to > > write > > > array[x1] = False > > array[x2] = False > > Uh...not so much... > > >>> a = [1,2,3,4,5] > >>> x1, x2 = 1, 3 > >>> a[x1] = a[x2] = False > >>>

Re: Multiple equates

2008-11-25 Thread Iain King
On Nov 25, 11:29 am, Iain King <[EMAIL PROTECTED]> wrote: > On Nov 17, 7:41 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > > > > > It doesn't matter as none of this is valid Python. In Python you have to > > > write > > > > array

Re: Accessing Modification Time of an Outlook Mail in Python

2008-11-25 Thread Iain King
On Nov 25, 5:11 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi all, >I am writing a small application which reads the contents of an > Outlook Mail using python. I am able to read the contents, subject > along with senders and receivers of a mail using MAPI objects. But may > I kno

Re: Obama's Birth Certificate - Demand that US presidential electors investigate Obama's eligibility

2008-12-03 Thread Iain King
On Dec 3, 10:16 am, [EMAIL PROTECTED] wrote: > On Dec 3, 12:53 am, Bryan Olson <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > This message is not about the meaningless computer printout called > > > More importantly, it's not about Python. I'm setting follow-ups to > > talk.pol

Re: RELEASED Python 3.0 final

2008-12-04 Thread Iain King
On Dec 4, 1:51 am, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team and the Python community, I > am happy to announce the release of Python 3.0 final. > > Python 3.0 (a.k.a. "Python 3000" or "Py3k") represents a

Re: Why is lambda allowed as a key in a dict?

2009-03-10 Thread Iain King
On Mar 10, 6:38 am, Daniel Fetchinson wrote: > On 3/9/09, bearophileh...@lycos.com wrote: > > > See here Daniel Fetchinson: > > >http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > > But be quite careful in using that stuff, it has some traps. > > Thanks a lot for all the

Re: Scraping a web page

2009-04-08 Thread Iain King
On Apr 7, 1:44 pm, Tim Chase wrote: > > f = urllib.urlopen("http://www.google.com";) > > s = f.read() > > > It is working, but it's returning the source of the page. Is there anyway I > > can get almost a screen capture of the page? > > This is the job of a browser -- to render the source HTML.  A

  1   2   >