Re: A curious bit of code...

2014-02-14 Thread forman . simon
On Thursday, February 13, 2014 7:26:48 PM UTC-8, Ned Batchelder wrote: > On 2/13/14 9:45 PM, forman.si...@gmail.com wrote: > > > For the record I wasn't worried about the performance. ;-) > > > > > > It was for Tkinter event strings not markup tags. > > > > > > I'm glad this was the time winn

Re: A curious bit of code...

2014-02-13 Thread forman . simon
For the record I wasn't worried about the performance. ;-) It was for Tkinter event strings not markup tags. I'm glad this was the time winner! "key and key[0] == '<' and key[-1] == '>'" Cheers to the folks who did the timings (and saved me from the trouble!) Last but not least... s[::len(s

A curious bit of code...

2014-02-13 Thread forman . simon
I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '<>': ... Some possibilities that occurred to me: if key.startswith('<') and key.endswith('>'): ... and: if (key[:1], key[-1:]) == ('<

"Laws of Form" are a notation for the SK calculus, demo in Python.

2013-03-31 Thread forman . simon
I was investigating G. Spencer-Brown's Laws of Form[1] by implementing it in Python. You can represent the "marks" of LoF as datastructures in Python composed entirely of tuples. For example: A mark: () A mark next to a mark: (), () A mark within a mark: ((),) and so on... It is known that the

Re: str.isspace()

2006-09-03 Thread forman . simon
[EMAIL PROTECTED] wrote: > Are you using the str.isspace() method? I don't use it, so if most > people don't uses it, then it may be removed from Py 3.0. > > I usually need to know if a string contains some non-spaces (not space > class chars). To do it I use something like: > > if aline.strip(): .

Re: returning index of minimum in a list of lists

2006-06-21 Thread forman . simon
[EMAIL PROTECTED] wrote: > Hi all, > Is there a simple python function to return the list index of the > minimum entry in a list of lists? > ie, for [[3,3,3,3], [3,3,3,1], [3,3,3,3]] to return 2,4. > Or, same question but just for a list of numbers, not a list of lists. > Thanks, > Josh One way

Re: Function definition

2006-06-19 Thread forman . simon
aarondesk wrote: ... > > Now I've tried putting the function declaration after the call but the > program wouldn't work. Is there anyway to put function declarations at > the end of the program, rather than putting them at the beginning, > which is rather clunky? > > Thanks. > Aaron A function can