Re: tiny script has memory leak

2012-05-17 Thread Iain King
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: 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

Re: Code Review

2011-05-25 Thread Iain King
On May 25, 2:44 pm, ad adsquai...@gmail.com wrote: On May 25, 4:06 am, Ulrich Eckhardt ulrich.eckha...@dominolaser.com 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

Re: use of index (beginner's question)

2011-04-28 Thread Iain King
. Chris Angelico I did not know this. Very useful! Iain -- http://mail.python.org/mailman/listinfo/python-list

[issue11737] and is not a logical conjugation

2011-04-01 Thread Iain Henderson
New submission from Iain Henderson the_i...@mac.com: The documentation here: http://docs.python.org/library/stdtypes.html indicates that and operates as such {if x: return x else: return y} to be a logical conjugation it should function as {if x: if y: return True return

Re: Using nested lists and tables

2010-10-28 Thread Iain King
: dostuff() i.e. check columns is not empty and then check if the last item startswith 's'. (a) I don't know if the order of resolution is predicated left-to- right in the language spec of if it's an implementation detail (b) columns[-1].startswith('s') would be better Iain -- http://mail.python.org

Re: Using nested lists and tables

2010-10-28 Thread Iain King
On Oct 28, 2:35 pm, Iain King iaink...@gmail.com wrote: ... (a) I don't know if the order of resolution is predicated left-to- right in the language spec of if it's an implementation detail (b) columns[-1].startswith('s') would be better ... Ignore (b), I didn't read the original message

Re: replacing words in HTML file

2010-04-29 Thread Iain King
On Apr 29, 10:38 am, Daniel Fetchinson fetchin...@googlemail.com wrote: | Any idea how I can replace words in a html file? Meaning only the | content will get replace while the html tags, javascript, css are | remain untouch. | | I'm not sure what you tried and what you haven't but

Re: Usable street address parser in Python?

2010-04-20 Thread Iain King
string (smallest Levenshtein distance?). Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Code redundancy

2010-04-20 Thread Iain King
), ('attr4', 4)): class1.__setattr__(attr, value) and to get a bit crunchy, with this your specific example can be written: for i in xrange(1, 5): class1.__setattr__('attr%d' % i, i) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: why (1, 2, 3) [1, 2, 3] is true?

2010-02-25 Thread Iain King
()) is type(list()). Or, to let the interpreter tell you why (1,2,3) [1,2,3]: tuple list True Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Ad hoc lists vs ad hoc tuples

2010-01-27 Thread Iain King
. For example: if foo in ('some', 'random', 'strings'): draw.text((10,30), WHICH IS WHITE, font=font) draw.line([(70,25), (85,25), (105,45)]) I've no idea what the performance difference is; I've always assumed it's negligible. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Symbols as parameters?

2010-01-21 Thread Iain King
+= direction.vy Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: substitution

2010-01-21 Thread Iain King
or fobarbazyyyquuux? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: installing psycopg2-2.0.13 with python3.1

2010-01-21 Thread Iain Barnett
On 21 Jan 2010, at 00:11, Gabriel Genellina wrote: En Wed, 20 Jan 2010 19:45:44 -0300, Iain Barnett iainsp...@gmail.com escribió: Would anyone know if it's possible to install psycopg2-2.0.13 with python3.1.1 (or similar)?I can install it with python2.6 with no problems, but obviously

installing psycopg2-2.0.13 with python3.1

2010-01-20 Thread Iain Barnett
: ^ SyntaxError: invalid syntax I can install it with python2.6 with no problems, but obviously I'd prefer to use the latest version. My system is OSX10.6, and I'm new to Python. Any help is much appreciated. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: substitution

2010-01-18 Thread Iain King
) else: output.append(subs[tokens[piece]]) return ''.join(output) token_replace(fooxxxbazyyyquuux, [(quuux, foo), (foo, bar), (baz, quux)]) 'barxxxquuxyyyfoo' I'm sure someone could whittle that down to a handful of list comps... Iain -- http

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 12:41 pm, Iain King iaink...@gmail.com wrote: On Jan 18, 10:21 am, superpollo ute...@esempio.net wrote: superpollo ha scritto: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo -- bar baz -- quux quuux -- foo so

Re: substitution

2010-01-18 Thread Iain King
= fooxxxbazyyyquuux re.subn(pattern, repl, s) Winner! :) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 4:26 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: On Jan 18, 2:17 pm, Adi Eyal a...@digitaltrowel.com wrote: [...] Using regular expressions the answer is short (and sweet) mapping = {         foo : bar

Re: Writing a string.ishex function

2010-01-14 Thread Iain King
            break     return ishex ---cut--- Can someone help me get further along please? Thanks. better would be: def ishex(s): for c in s: if c not in string.hexdigits: return False return True Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Different number of matches from re.findall and re.split

2010-01-11 Thread Iain King
', 'a', 'list', 'containing', 'the', 'resulting', 'substrings.\n'] Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against while True: loops

2009-10-20 Thread Iain King
else: d[key] = value or try: d[key] += value except KeyError: d[key] = value I find both to be easily readable (and the similarity between the two blocks is obvious and, to me at least, pleasing). Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple if-else question

2009-09-30 Thread Iain King
construct a plausible situation where it wouldn't be that bad... Anyway, I'm ambivalently on the fence. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-24 Thread Iain King
. You're not just yanking the OP's chain??? That would be cruel. I mean the guy has enough problems already... Sorry, there is no 'twice' builtin. I think what you are looking for is: def twice(n): return return n Iain -- http://mail.python.org/mailman/listinfo/python-list

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

Re: remove last 76 letters from string

2009-08-06 Thread Iain King
print nucleotides, seq[-76]      last_part = line.rstrip()[-76 : ] You all mean: seq[:-76] , right? (assuming you've already stripped any junk off the end of the string) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: remove last 76 letters from string

2009-08-06 Thread Iain King
On Aug 6, 11:34 am, MRAB pyt...@mrabarnett.plus.com wrote: Iain King wrote:      print nucleotides, seq[-76]      last_part = line.rstrip()[-76 : ] You all mean:   seq[:-76]   , right? (assuming you've already stripped any junk off the end of the string) The OP said cut out the last

Re: Confessions of a Python fanboy

2009-07-31 Thread Iain King
itself, or the output of factory_function? Not only that - does 'return inner' return the function inner or the result of function inner? How does ruby pass a function as an object? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Confessions of a Python fanboy

2009-07-31 Thread Iain King
what you can't have, can you? [Holds breath while awaiting counter-example... :] ~Ethan~ The convention being detailed in PEP8: http://www.python.org/dev/peps/pep-0008/ basically, anything in ALL_CAPS is a constant, assuming you follow those style guidelines. Iain -- http://mail.python.org

[issue6473] hmac sha384/sha512 fails test vectors

2009-07-17 Thread Iain Wade
Iain Wade iw...@optusnet.com.au added the comment: d'oh, I should have checked HEAD before submitting the bug. I am running 2.5.1 on OSX, the fix seems to be in 2.5.2 and above. Thanks, and sorry for wasting your time. -- status: open - closed

[issue6473] hmac sha384/sha512 fails test vectors

2009-07-12 Thread Iain Wade
New submission from Iain Wade iw...@optusnet.com.au: Test vectors are in the following draft rfc: http://tools.ietf.org/html/draft-nystrom-smime-hmac-sha The problem is that hmac.py has a hard-coded block size of 64, while SHA-384 and SHA-512 have a 128-byte block size. Suggested fix

Re: string character count

2009-07-01 Thread Iain King
(assuming you've imported os): print len(os.path.splitext(x)[0]) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: do replacement evenly

2009-06-02 Thread Iain King
but not efficient. Better: s = .join((x for x in s.split( ) if x)) Note that this will strip leading and trailing spaces. Or you can use regexps: import re s = re.sub( {2,}, , s) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a Par construct to Python?

2009-05-20 Thread Iain King
and stop iteration when it's done, and rename it to par to keep the OP happy and you should get something like what he initially requests (I think): total = 0 for score in par(f, data): total += score Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Any idea to emulate tail -f

2009-05-05 Thread Iain King
, but I'd read the whole thing if you can. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Scraping a web page

2009-04-08 Thread Iain King
On Apr 7, 1:44 pm, Tim Chase python.l...@tim.thechases.com 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

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

2009-03-10 Thread Iain King
following pieces of code? a = lambda x: x+2 def a(x): return x+2 Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 3.0 final

2008-12-04 Thread Iain King
log, but I couldn't find the answer to something: has any change been made to how tabs and spaces are used as indentation? Can they still be (inadvisably) mixed in one file? Or, more extremely, has one or the other been abolished? Iain -- http://mail.python.org/mailman/listinfo/python-list

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

Re: Multiple equates

2008-11-25 Thread Iain King
] = [] array[x1].append(Hi) array[x2] ['Hi'] Iain -- http://mail.python.org/mailman/listinfo/python-list

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[x1] = False array[x2] = False Uh...not so much... a = [1,2,3,4,5] x1

Re: Accessing Modification Time of an Outlook Mail in Python

2008-11-25 Thread Iain King
://msdn.microsoft.com/en-us/library/ms526130(EXCHG.10).aspx Looks like you want TimeLastModified Iain -- http://mail.python.org/mailman/listinfo/python-list

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

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 pointers as to how I might create some sort of blocking device file or named

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 pipe ...     mkfifo /path/to/named/pipe Thanks. I did

creating a block file for file-like object

2008-11-06 Thread Iain
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

urllib.urlopen fails in Emacs

2008-09-26 Thread Iain Dalton
In Emacs, using run-python, import urllib urllib.urlopen('http://www.google.com/') results in this traceback: Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/urllib.py, line 82, in urlopen return opener.open(url)

[issue1441530] socket read() can cause MemoryError in Windows

2008-09-02 Thread Iain MacKay
Iain MacKay [EMAIL PROTECTED] added the comment: Knowing that the large read provokes the problem enables one to write this simple workaround by subclassing IMAP4 without patching the library: maxRead = 100 class MySSL (imaplib.IMAP4_SSL): def read (self, n): #print ..Attempting

Re: How to update value in dictionary?

2008-08-27 Thread Iain King
On Aug 27, 2:40 pm, ssecorp [EMAIL PROTECTED] wrote: dict.update({a:1}) SETS the dict item a 's value to 1. i want to increase it by 1. isnt that possible in an easy way? I should use a tuple for this? dict[a] += 1 Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: use of Queue

2008-08-27 Thread Iain King
, and the consumer exit before the producer makes item 2. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: gridSizer inside a panel element

2008-08-22 Thread Iain King
= wx.BoxSizer(wx.VERTICAL) sz.Add(grid, 0, wx.ALL|wx.EXPAND, 5) panel.SetSizer(sz) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Limits of Metaprogramming

2008-08-08 Thread Iain King
of Programming: Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Iain King
the situation just doesn't work? Just checking... Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Attack a sacred Python Cow

2008-07-29 Thread Iain King
it into the language get smaller every time you fire up your keyboard. Nice work. Iain p.s. am looking forward to your post whining about the invalid reasons your PEP got rejected, in the slim hope you actually write one. -- http://mail.python.org/mailman/listinfo/python-list

Re: Execution speed question

2008-07-25 Thread Iain King
: new_off_list.append(x) off_list = new_off_list generation += 1 Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Execution speed question

2008-07-25 Thread Iain King
On Jul 25, 1:46 pm, Iain King [EMAIL PROTECTED] wrote: On Jul 25, 10:57 am, Suresh Pillai [EMAIL PROTECTED] wrote: I am performing simulations on networks (graphs). I have a question on speed of execution (assuming very ample memory for now). I simplify the details of my simulation

Re: Execution speed question

2008-07-25 Thread Iain King
at the 'for') as a second loop, with the goes_on function now returning a value based on the calculation (rather than the calculation itself as I had it). Performance should be similar. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Execution speed question

2008-07-25 Thread Iain King
of times you have to loop over the list increases. (1) always loops over the full list, but with each successive iteration (2) and (3) are looping over smaller and smaller lists. In the end this adds up, with (1) becoming slower than (2), even though it starts out quicker. Iain -- http

Re: Python Written in C?

2008-07-21 Thread Iain King
/mel.html Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Best Python packages?

2008-07-19 Thread Iain King
On Jul 19, 8:56 am, Stefan Behnel [EMAIL PROTECTED] wrote: Iain King wrote: Well, if you're looking for a list of excellent 3rd party Python libraries, then I can give you the ones I like and use a lot: [...] BeautifulSoup : for real-world (i.e. not-at-all-recommendation- compliant) HTML

Re: Best Python packages?

2008-07-18 Thread Iain King
the ones I like and use a lot: wxPython : powerful GUI library which generates native look feel PIL : Imaging Library - if you need to manipulate bitmaps pyGame :SDL for python BeautifulSoup : for real-world (i.e. not-at-all-recommendation- compliant) HTML processing Iain

Re: start reading from certain line

2008-07-10 Thread Iain King
On Jul 10, 2:45 pm, jstrick [EMAIL PROTECTED] wrote: Here's a simple way to do it with a minimum amount of loopiness (don't forget to use 'try-except' or 'with' in real life): f = open(item1.txt) for preline in f:     if Item 1 in preline:         print preline,         for goodline in f:

Re: start reading from certain line

2008-07-10 Thread Iain King
On Jul 10, 4:54 pm, Iain King [EMAIL PROTECTED] wrote: On Jul 10, 2:45 pm, jstrick [EMAIL PROTECTED] wrote: Here's a simple way to do it with a minimum amount of loopiness (don't forget to use 'try-except' or 'with' in real life): f = open(item1.txt) for preline in f:     if Item 1

Re: How to make python scripts .py executable, not bring up editor

2008-07-08 Thread Iain King
a .py file in windows explorer. Right click it-Open With- Choose Program... Now find your python.exe file (should be in c:\python24), select it, and tick the box that says Always use the selected program Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: How to bypass Windows 'cooking' the I/O? (One more time, please) II

2008-07-07 Thread Iain King
On Jul 7, 10:18 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Mon, 07 Jul 2008 01:03:10 -0700, norseman [EMAIL PROTECTED] declaimed the following in comp.lang.python:   Normal file I/O sequence:   fp = open(target, 'wb')   fp.seek(-1, 2)   fp.write(record)    Except it

Re: Win32.client, DAO.DBEngine and exceeding the file sharing count lock

2008-07-03 Thread Iain King
._connection.Properties(Jet OLEDB:Max Locks Per File).Value = MAX_LOCKS rs = win32com.client.Dispatch(r'ADODB.Recordset') N.B. I'm writing tools software for a 3rd party app which uses an Access db as it's output format, so I'm locked in. No way to switch to SQL server. Thanks both! Iain -- http

Win32.client, DAO.DBEngine and exceeding the file sharing count lock

2008-07-02 Thread Iain King
dbmaxlocksperfile,15000 Can I do this in win32com? I've been using ADO, not DAO, but I have to confess to not knowing exactly what the difference is. I set up my recordset thusly: rs = win32com.client.Dispatch(r'ADODB.Recordset') can I jigger it to increase it's max locks? Iain -- http

Re: Win32.client, DAO.DBEngine and exceeding the file sharing count lock

2008-07-02 Thread Iain King
On Jul 2, 3:29 pm, Tim Golden [EMAIL PROTECTED] wrote: Iain King wrote: Hi.  I'm using the win32 module to access an Access database, but I'm running into the File Sharing lock count as inhttp://support.microsoft.com/kb/815281 The solution I'd like to use is the one where you can

Newbie help (TypeError: int argument required)

2008-06-08 Thread Iain Adams
Hi, I am new to python. I have been having trouble using the MysqlDB. I get an error pointing from the line cursor.execute(UPDATE article SET title = %s, text = %s WHERE id = %u, (self.title, self.text, self.id)) Here is the error: line 56, in save cursor.execute(UPDATE article SET title

Re: Interesting Math Problem

2008-06-05 Thread Iain King
(i.e. 0 = no stars, 1 = half a star, 2 = 1 star, etc). Then you just need to divide by 2 at the end. stars = round(star_sum/num_raters, 0) / 2.0 Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating A Tuple From A List, Adding To Tuple As You Do

2008-06-05 Thread Iain King
('vcdcflx006\\Flex \\Sites\\*\\')] I tend to use / instead of \\ as a folder seperator, it should work for you (I think): cities = [(os.path.basename(x), '') for x in glob('//vcdcflx006/Flex/ Sites/*')] Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Flaming Thunder

2008-05-23 Thread Iain King
On May 23, 3:35 am, Charles Hixson [EMAIL PROTECTED] wrote: On Thursday 22 May 2008 13:30:07 Nick Craig-Wood wrote: ... From Armstrong's book: The expression Pattern = Expression causes Expression to be evaluated and the result matched against Pattern. The match either succeeds or

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-22 Thread Iain King
On May 22, 1:14 am, bukzor [EMAIL PROTECTED] wrote: On May 21, 3:28 pm, Dave Parker [EMAIL PROTECTED] wrote: On May 21, 4:21 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Which is exactly what the python decimal module does. Thank you (and Jerry Hill) for pointing that out. If I want

Re: wxpython dialog - do something after ShowModal()?

2008-05-15 Thread Iain King
On May 14, 9:37 pm, David C. Ullrich [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Iain King [EMAIL PROTECTED] wrote: Hi. I have a modal dialog whcih has a Browse... button which pops up a file selector. This all works fine, but the first thing the user has to do when

Re: Rename field in Access DB

2008-05-15 Thread Iain King
On May 14, 4:29 pm, Tim Golden [EMAIL PROTECTED] wrote: Iain King wrote: I'm manipulating an MS Access db via ADODB with win32com.client. I want to rename a field within a table, but I don't know how to. I assume there is a line of SQL which will do it, but nothing I've tried (from

Rename field in Access DB

2008-05-14 Thread Iain King
= win32com.client.Dispatch(r'ADODB.Connection') DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=dbfile.mdb;' connection.Open(DSN) connection.Execute(ALTER TABLE tablename CHANGE from to) #this sql doesn't work connection.Close() Anyone know how to get this to work? Iain -- http://mail.python.org/mailman

wxpython dialog - do something after ShowModal()?

2008-05-13 Thread Iain King
? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython dialog - do something after ShowModal()?

2008-05-13 Thread Iain King
On May 13, 2:20 pm, Larry Bates [EMAIL PROTECTED] wrote: Iain King wrote: Hi. I have a modal dialog whcih has a Browse... button which pops up a file selector. This all works fine, but the first thing the user has to do when they open the dialog is select a file, so I would like

Re: wxpython dialog - do something after ShowModal()?

2008-05-13 Thread Iain King
On May 13, 2:43 pm, Iain King [EMAIL PROTECTED] wrote: On May 13, 2:20 pm, Larry Bates [EMAIL PROTECTED] wrote: Iain King wrote: Hi. I have a modal dialog whcih has a Browse... button which pops up a file selector. This all works fine, but the first thing the user has to do when

Splitting MainWindow Class over several modules.

2008-04-16 Thread Iain King
is? And is there anything about doing it this way which could be detrimental? Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: Wxpython. Is it possible to change layout in a running application? Selfmade listbox

2008-04-07 Thread Iain King
to the sizer has the listbox as a parent. Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: String To List

2008-03-17 Thread Iain King
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

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'].. I would like to convert it to a list with elements 'xyz' and 'abc'. Is there any simple

Sine Wave Curve Fit Question

2008-01-30 Thread Iain Mackay
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: the annoying, verbose self

2007-11-27 Thread Iain King
() 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

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 = x self.y = y self.z = z def abs(self

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

2007-10-18 Thread Iain King
pythonic though :) 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
): lastUpdate = time.mktime(time.strptime(lastUpdate, %Y-%m-%d_%H: %M)) runTimeStamp = time.mktime(time.strptime(runTimeStamp, %Y-%m-%d_ %H:%M)) return (runTimeStamp - lastUpdate) / ONEDAY = OLDNESS_THRESHOLD if not isOld(auctionDate, currentTime): checkForBid() Iain -- http

Re: wxPython and threads

2007-07-19 Thread Iain King
. 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.org/mailman

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

2006-09-21 Thread Iain King
= 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

Re: PIL cannot open TIFF image in Windows

2006-09-11 Thread Iain King
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: Looking For mp3 ID Tag Module

2006-08-18 Thread Iain King
). This might be your problem when reading the tags, too. 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
/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 bashing it? Huh? Iain -- http://mail.python.org/mailman/listinfo/python

Re: FOR LOOPS

2006-08-01 Thread Iain King
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: random shuffles

2006-07-21 Thread Iain King
feel quite confortable with the intuition... can anyone think of a more solid argumentation ? Why not use the supplied shuffle method? random.shuffle(x) or check out this thread: http://groups.google.com/group/comp.lang.python/browse_thread/thread/766f4dcc92ff6545?tvc=2q=shuffle Iain

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

Re: question about what lamda does

2006-07-19 Thread Iain King
was for passing simple functions as arguments, and of these map and filter must have made up a majority (and then I'd guess 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

  1   2   >