creating a block file for file-like object

2008-11-06 Thread Iain
tried the FIFO thing, but I think I'm getting caught by its blocking behaviour on open so as soon as I try to open the named pipe (whether for reading or writing) my script just hangs. Any help would be appreciated. Cheers Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: creating a block file for file-like object

2008-11-07 Thread Iain
On Nov 7, 4:42 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message > <[EMAIL PROTECTED]>, Iain > wrote: > > > Can someone give me some pointers as to how I might create some sort > > of blocking device file or named pi

Re: creating a block file for file-like object

2008-11-09 Thread Iain
On Nov 8, 10:00 am, Iain <[EMAIL PROTECTED]> wrote: > On Nov 7, 4:42 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] > > central.gen.new_zealand> wrote: > > In message > > <[EMAIL PROTECTED]>, Iain > > wrote: > > > > Can someone give me some

Re: creating a block file for file-like object

2008-11-10 Thread Iain
> Perhaps the parent should open the pipe for reading, before calling > TroublesomeFunction. If the parent then dies, the child will get a "broken > pipe" signal, which by default should kill it. Yeah, that seems to work well, I think. Thanks for the help! I also realised the child process was co

Polling a net address

2009-08-20 Thread Iain
Hi All, I'm writing a system tray application for windows, and the app needs to poll a remote site at a pre-defined interval, and then process any data returned. The GUI needs to remain responsive as this goes on, so the polling needs to be done in the background. I've been looking into Twisted a

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&#

Re: tiny script has memory leak

2012-05-17 Thread Iain King
nge(n): > print >>f, random.randint(0, sys.maxint) > f.close() > > What's using so much memory? > What would be a better way to do this? (aside from checking arg > values and types, I know...) Ran OK for me, python 2.4.1 on Windows 7 Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: use of index (beginner's question)

2011-04-28 Thread Iain King
makes for easier maintenance, especially when you append > array/list elements. > > Chris Angelico I did not know this. Very useful! Iain -- http://mail.python.org/mailman/listinfo/python-list

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
will limit the window to be at least 300x300, and set it straight away to 500x500. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: backreferences

2005-09-28 Thread Iain King
ven't had to use backreferences yet, so I don't know offhand how to go about it. What I do know is that this online book is very useful: http://gnosis.cx/TPiP/ Chapter 3 covers REs: http://gnosis.cx/TPiP/chap3.txt >From what I remember, in python you can use numbered backrefere

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Iain King
e would be a gradient ranging from black (completely dark) to red. So on the HSV scale, grey is represented by a saturation of 0 - meaning none of H is present in the color; the color in question being determined purely by it's brightness (V). So when you pick your HSV triplet for a grey color, you have to set S to 0. You can set H to anything at all - because S is 0, no tint of H will appear in the color at all. Iain http://www.snakebomb.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-24 Thread Iain King
ging hymns about the beauty > > of Scheme... > > +1 QOTW > > > I love this place. > > Someone should really try posting a similar question on c.l.perl and > seeing how they react ... > > tom SSsh! Xah Lee might be listening! Iain -- http://mail.python.org/mailman/listinfo/python-list

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

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
666 > > > > Once executed, the program will create a single file (named Rome.txt) > and it would not create files NYC.txt and Lima.txt as I would expect it > to do. > > I'd appreciate if you can pinpoint my error. > > Best, > > Vasa Did you try indenting the last five lines? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-26 Thread Iain King
Bush, you'll love Bill Gates," could > go a long ways in educating the public. > Or, you know, just code your website to be W3C compliant, which IE will invariably choke on. Iain -- http://mail.python.org/mailman/listinfo/python-list

Double replace or single re.sub?

2005-10-26 Thread Iain King
ml = re.sub('<([/]*)i>', r'<\1em>', html) Would this be a quicker/better way of doing it? Iain -- http://mail.python.org/mailman/listinfo/python-list

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

2005-10-26 Thread Iain King
I've heard top-posting and bottom-posting before (lots). But regardless of however many people use top-quoting and bottom-quoting, surely you're using them the wrong way around? If I top-post, then that means that the quote is at the bottom, no? To quote someone's sig block: "To top-post is human, to bottom-post and snip is sublime." Iain -- http://mail.python.org/mailman/listinfo/python-list

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
ted the advantages of > competing products. (Just as Burger King corporate will not you sell Big > Macs in the same store in which you sell Whoppers.) > > DS Don't you see how your metaphor doesn't work? It would only be fitting if Microsoft OWNED the outle

Re: Microsoft Hatred FAQ

2005-10-27 Thread Iain King
that's better and > cheaper". Oh right. You're actually just a troll. Oh well. *plonk* Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: need help extracting data from a text file

2005-11-07 Thread Iain King
depend on how many times you're searching compared to the overhead of setting up an re. start = textfile.find("foo(") + 4 # 4 being how long 'foo(' is end = textfile.find(")", start) value = textfile[start:end] Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: need help extracting data from a text file

2005-11-07 Thread Iain King
t;) start = textfile.find("(", keywordPos) end = textfile.find(")", start) value = textfile[start:end] Iain -- http://mail.python.org/mailman/listinfo/python-list

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

Re: How to paste python code on wordpress?

2005-11-22 Thread Iain King
However, you will need to replace any ampersands with & ( <, >, and & are characters with intrinsic qualities in html). You need to replace & before you replace anything else: if you do it after repalcing < and > you'll catch your < and >, ending up with &lt; and &gt; which is not what you want. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Documentation suggestions

2005-12-07 Thread Iain King
ly what I want. I would like a minor change to it though - stop words starting with a given letter rolling over to another column (for example, os.path is at the foot of one column, while ossaudiodev is at the head of the next), and provide links to each initial letter at the top of the page.

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 > >> hel

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 (bec

Re: overload builtin operator

2005-08-29 Thread Iain King
t some users want an expression like '(100/x)+ 3' > > where x=0 to return 3. So that dividing a number by zero results in 0. > > You have silly users. You mean you don't? Damn. Can I have some of yours? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: how to join two Dictionary together?

2005-08-30 Thread Iain King
er way to do this, but you could: dict3 = {} for k,i in dict1.iteritems(): dict3[k] = i for k,i in dict2.iteritems(): dict3[k] = i Think this should work. Obviously, if the same key appears in both dict1 and dict2 then dict2's value will overwrite dict1's. Iain -- http://mail.python.org/mailman/listinfo/python-list

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
to do it, based on speed or aesthetics? (1) c=a.copy() c.update(b) or (2) c={} c.update(a) c.update(b) Iain -- http://mail.python.org/mailman/listinfo/python-list

wxPython, using sizers.

2005-09-16 Thread Iain King
y (as I imagine it is supposed to). Any tips? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: question about what lamda does

2006-07-19 Thread Iain King
uess TKinter would be next). List comprehensions replace map and filter, so... I wouldn't put it as explosively as he has, but I find a lambda less clear than a def too. Iain > regards > Steve > -- > Steve Holden +44 150 684 7255 +1 800 494 3119 > Holden We

Re: using names before they're defined

2006-07-19 Thread Iain King
if c.upstream != self: c.setUpstream(self) class Supply(Component): pass etc. Iain -- http://mail.python.org/mailman/listinfo/python-list

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. >

Re: random shuffles

2006-07-21 Thread Iain King
://groups.google.com/group/comp.lang.python/browse_thread/thread/766f4dcc92ff6545?tvc=2&q=shuffle Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: FOR LOOPS

2006-08-01 Thread Iain King
txt" using the str function. Meaning that the FOR > LOOP is not working correctly. After your 'file_path =' line, try adding a 'print file_path', and see if it's creating it correctly. Your for loop looks fine, assuming that file_path is a list of filenames. Iain -- http://mail.python.org/mailman/listinfo/python-list

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

2006-08-17 Thread Iain King
.org/Periodic_dosage_dir/_p/software_phil.html > > • What Languages to Hate, Xah Lee, 2002 > http://xahlee.org/UnixResource_dir/writ/language_to_hate.html > > Xah > [EMAIL PROTECTED] > ∑ http://xahlee.org/ I'm confused - I thought Xah Lee loved Perl? Now he's

Re: Looking For mp3 ID Tag Module

2006-08-18 Thread Iain King
e > end of things, so any kind suggestions would be most welcome. > > By the way, I believe the offending string contains a German umlaut, at least > in one > of the cases. > > To get the MP3's name, use os.path.basename (I'm guessing that's what your split() is for?) Looking at the mutagen tutorial, most of the tags are lists of unicode strings, so you might want to try audio["title"] = [unicode(name)], instead of audio["title"] = unicode(name). This might be your problem when reading the tags, too. Iain -- http://mail.python.org/mailman/listinfo/python-list

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.or

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
t still when you're mysitified by map and lambda (like me): def shuffle(data): decorated = [(random(), x) for x in data] decorated.sort() return [x[1] for x in decorated] or shorter but possible less readable (and only in 2.4+): def shuffle(data): return [y[1] for y in sorted([(random(), x) for x in data])] Iain -- http://mail.python.org/mailman/listinfo/python-list

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
> But isn't that how a reasonable sorting algorithm should behave? Less > work to do if the data is already sorted? An already sorted list can be pathological for Quicksort, depending on how you code it. Iain -- http://mail.python.org/mailman/listinfo/python-list

Bug in list comprehensions?

2006-06-07 Thread Iain King
7;three']] >>> [x for x in y for y in beta] ['C', 'C', 'C'] >>> [y for y in beta] [['one', 'two', 'three'], ['one', 'two', 'three'], ['one', 'two', 'three']] >>> [x for x in y for y in beta] ['one', 'one', 'one', 'two', 'two', 'two', 'three', 'three', 'three'] Shoudn't both lines '[x for x in y for y in beta]' produce the same list? I'm guessing I'm the one confused here... but I'm confused! What's going on? Iain -- http://mail.python.org/mailman/listinfo/python-list

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
e, I changed mine to: "C:\Python\python.exe" -i "%1" %* The exact line will depend on where your python.exe is. OK all the dialogs you've opened, then double click a .py file to test it. *I'm using WinXP, so the exact name of some of the buttons may be different for you. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Feed wxComboBox with dictionary/hash

2006-06-22 Thread Iain King
> > read manual for more details... > > Ok, I'd like to. But which one? > I was reading http://www.wxpython.org/docs/api/wx.ComboBox-class.html > and didn't even find the above mentioned append method :-( > > TIA, > Roland R. wxComboBox inherits from wxControlWi

Re: String Question

2006-06-28 Thread Iain King
> s.sendto('\xff'*6 + 'mac_string'*16, ('192.168.1.255', 80)) > > Thiis also didnt work. > > > Since the MAC adddress are hexadecimal, how should I go about it here. > > Please help, every help is appreciated. Thanks See http://docs.python.org/li

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
ets with Ms Access are not void). > Some help is welcome, > Thanks in advance > Luis I don't know if it's the problem your asking about, but your rs.MoveNext() should be inside the while loop, no? Iain -- http://mail.python.org/mailman/listinfo/python-list

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
of course the empty list), which is then appended to, but is not stored anywhere. If you want to insert str(col) then use p.insert Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: List Manipulation

2006-07-05 Thread Iain King
lement inside p. It gives > you a new sublist containing one element from p. You then append a > column to that sublist. Then, since you do nothing more with that > sublist, YOU THROW IT AWAY. > > Try doing: > > p[j] = p[j].append(col) > No, this doesn't work. append is an in-place operation, and you'll end up setting p[j] to it's return, which is None. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Full splitting of a file's pathname

2006-07-10 Thread Iain King
s.path.split (so it should be fairly compatible): def split(path): h,t = os.path.split(path) if h == path: return [h] else: return split(h) + [t] You could throw in os.path.splitdrive and os.path.splitunc, if you wanted to be really complete. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL cannot open TIFF image in Windows

2006-09-11 Thread Iain King
open image with wxPython except: fail Right now my program to compile multipage tiffs no longer does any of the image work itself - it processes the index file, and then generates a batch file. The batch file is a lot of calls to irfanview /append. I've yet to find a tiff irfanview can't open. Iain -- http://mail.python.org/mailman/listinfo/python-list

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

2006-09-21 Thread Iain King
f wake_up_key_pressed: paused = False or with a gui: paused = False def pause(): global paused paused = True while paused: time.sleep(1) def onWakeUpButton(): #bind this to button global paused paused = False Iain -- http://mail.python.org/mailman/listinfo/python-list

"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.or

Re: Create dict from two lists

2006-02-10 Thread Iain King
ary sorted in this order. > new_d = dict(zip(keys, vals)) > > How can I use the two lists, keys and vals to create a dictionary such > that the items keep their order? > > Thanks. Short answer - you can't. Dictionaries aren't sequential structures, so they have no

Re: Self-identifying functions and macro-ish behavior

2006-02-15 Thread Iain King
again, but which is also not neatly rolled up into a function, > such as combining the return statements with a printing of ? I think I've answered this too? Iain -- http://mail.python.org/mailman/listinfo/python-list

looping over more than one list

2006-02-16 Thread Iain King
s = "" for c1,c2 in [x for x in zip(s1,s2)]: s += lowerChar(c1,c2) return s but it's hardly any more elegant than using a loop counter, and I'm guessing it's performance is a lot worse - I assume that the zip operation is extra work? Iain -- http://mail.python.org/mailman/listinfo/python-list

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

2006-02-22 Thread Iain King
here a redirect command somewhere within Python CGI that can > get this done instead as I would actually prefer to have the CGI code > execute this rather than depend on the HTML to do it. > > Thanks, > > Harlin Seritt this snippet works (from code I wrote to implement a shoutbox): print ''' Please wait... ''' I assume your version doesn't work because of the uppercase 'R'. Iain -- http://mail.python.org/mailman/listinfo/python-list

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
r more info, see the string method docs: > > http://docs.python.org/lib/string-methods.html > > To do what you're trying to do, try this: > > > > >>> prefix = 'hello ' > > >>> bar = 'hello world!' > > >>> if bar.startswith(prefix): bar = bar[:len(prefix)] > > ... > > >>> bar > > 'world!' > > > Apologies, that should be: >>>> prefix = 'hello ' >>>> bar = 'hello world!' >>>> if bar.startswith(prefix): bar = bar[len(prefix):] >... >>>> bar >'world!' > or instead of: a.strip('') use: a.replace('','') Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: object's list index

2006-03-03 Thread Iain King
, one of us is being really really dense today :) I hope it's not me... what's wrong with: i = 0 for object in list: objectIndex = i print objectIndex i += 1 Iain -- http://mail.python.org/mailman/listinfo/python-list

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
and set a status bar to the total found, or whatever else you want to do. Iain -- http://mail.python.org/mailman/listinfo/python-list

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

2007-09-12 Thread Iain King
imeStamp, "%Y-%m-%d_ %H:%M")) return (runTimeStamp - lastUpdate) / ONEDAY >= OLDNESS_THRESHOLD if not isOld(auctionDate, currentTime): checkForBid() Iain -- http://mail.python.org/mailman/listinfo/python-list

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

2007-10-18 Thread Iain King
the > KHz. > > There are probably other more Pythonic ways... > I always use: state = 1 - state for toggles. I doubt it's much more pythonic though :) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-27 Thread Iain King
rgs, **kwargs) for varname in delete: del(g[varname]) return t class Test(object): x = 1 @noself def test(self): print x >>> foo = Test() >>> foo.test() 1 -- FTR, I won't be using this :) I do like this syntax though: class Vector: def __init__(self, x, y, z): self.x = x self.y = y self.z = z def abs(self): using self: return math.sqrt(.x*.x + .y*.y + .z*.z) Iain -- http://mail.python.org/mailman/listinfo/python-list

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
ction (in this case Process) finishes. The ugly (None,) tuple in the start_new_thread / dummy=None Process parameter are because the start_new_thread function demands a tuple of arguments, even when none are required. see http://www.python.org/doc/current/lib/module-thread.html for more info. Iain -- http://mail.python.org/mailman/listinfo/python-list

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

2006-04-21 Thread Iain King
r I find slice notation consistent and elegant - did it come form another language? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting elements in a list wildcard

2006-04-25 Thread Iain King
ort re def countMatches(names, namePattern): count = 0 for name in names: if namePattern.match(name): count += 1 return count susie = re.compile("Su(s|z)(i|ie|y)") print countMatches(["John", "Suzy", "Peter", "Steven", "Susie

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
ff. Anyone know? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython warnings

2006-04-26 Thread Iain King
ly exactly what I did. (well, I converted to jpg, because they're going to end up as jpg anyway). bah Iain -- http://mail.python.org/mailman/listinfo/python-list

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
on into iterative code. I'm wondering if the python compiler does the same? Iain -- http://mail.python.org/mailman/listinfo/python-list

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. The

Re: Tabs versus Spaces in Source Code

2006-05-17 Thread Iain King
not actually allow a mix of tabs and spaces for > indentation there would be no problem - the compiler could throw out an > exception for mixed characters. python -tt > In reality, neither of these are likely > to be implemented any time soon! um Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: noob import question

2006-05-19 Thread Iain King
error on the line s1 = Student("Brian", "Smith", "N") This is because when you use 'import Student', it loads the file Student.py into a namespace called Student (unlike the 'from' statement, which loads it into the main namespace). to access anythin

Re: John Bokma harassment

2006-05-25 Thread Iain Chalmers
In article <[EMAIL PROTECTED]>, Tim X <[EMAIL PROTECTED]> wrote: > I also seem to remember a page on his website from a couple of years > back in which he admits enjoying trolling and starting flame wars - > but I can't find it now, so maybe I'm mistaken. http://web.archive.org/web/200502041726

Trying to get FreeImagePy to work.

2006-05-26 Thread Iain King
d not be found I put a 'print self._name' in the ctypes __init__ file, just before line 296 - it's printing out the 'find' just before the error. So, in what specific way have I screwed up the install? Iain -- http://mail.python.org/mailman/listinfo/python-list

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

Sine Wave Curve Fit Question

2008-01-30 Thread Iain Mackay
(they seem to be strong on polynomial fitting, but not, apparently, on trig functions) and I wondered if any one here had recommendations? Something that implemented IEEE 1057 , or similar, would be perfect. TIA Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Sine Wave Curve Fit Question

2008-01-30 Thread Iain Mackay
Thanks folks - I'll have a think about both of these options. -- http://mail.python.org/mailman/listinfo/python-list

Re: String To List

2008-03-17 Thread Iain King
', ')] This will fall over if xyz or abc include any of the characters your stripping/splitting on (e.g if xyz is actually "To be or not to be, that is the question"). Unless you can guarantee they won't, you'll need to write (or rather use) a parser that understands the syntax. Iain -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >