Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Bill Mill
On Apr 7, 2005 1:15 AM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Scott David Daniels wrote: > > Aahz wrote: > > > >> You just can't have your cake and eat it, too. > > > > I've always wondered about this turn of phrase. I seldom > > eat a cake at one sitting. > > You need to recursively subdivide

Re: sorting a list and counting interchanges

2005-04-07 Thread Bill Mill
my CS classes (I graduated last May) While I'm at it though, I want to thank Tim for that post. It was one of those posts where afterwards you say "of course!" but beforehand I was totally thinking of it the wrong way. Brought me right back to Abstract. Peace Bill Mill bill.mill a

Re: sorting a list and counting interchanges

2005-04-07 Thread Bill Mill
n or #by implication assert j not in seen just to really frustrate the guy reading your code. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: some sort of permutations...

2005-04-12 Thread Bill Mill
like its recursion really slows it down (but I haven't been profiled it). Does anyone know of a non-recursive algorithm to do the same thing? And, while I'm asking that question, is there a good reference for finding such algorithms? Do most people keep an algorithms book handy? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: preallocate list

2005-04-13 Thread Bill Mill
lst.append(math.sin(i) * i) t1 = timeit.Timer('test1()', 'from __main__ import test1') t2 = timeit.Timer('test2()', 'from __main__ import test2') print "time1: %f" % t1.timeit(100) print "time2: %f" % t2.timeit(100) 09:09 AM ~$ py

Re: preallocate list

2005-04-13 Thread Bill Mill
print "time2: %f" % t2.timeit(100) > The results change slightly when I actually insert an integer, instead of a float, with lst[i] = i and lst.append(i): 09:14 AM ~$ python test.py time1: 3.352000 time2: 3.672000 The preallocated list is slightly faster in most of my tests, but I still

Re: Codig style: " or """

2005-04-13 Thread Bill Mill
ocument on python > coding style. > the authoritative coding style guide is pep 8: http://www.python.org/peps/pep-0008.html Of course, there are style points that are debatable, but for comments, you should definitely be using triple-quotes. Pep 8 points you to pep 257, which is all about docstrings: http://www.python.org/peps/pep-0257.html Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Bill Mill
noted that running the win32 bc from cygwin messed up my terminal, so I recommend running it from a cmd window (which worked fine). Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: A little request about spam

2005-04-14 Thread Bill Mill
On 4/14/05, César Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote: > Yeah that is happening to me too! Almost all my python-list e-mails go > to the Spam box. > Maybe we should contact the gmail admins? > I've already contacted the gmail admins. There was no response. Pe

Re: A little request about spam

2005-04-14 Thread Bill Mill
On 4/14/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > > > Maybe we should contact the gmail admins? > > > > I've already contacted the gmail admins. There was no response. > > have you tried reading the newsgroup via

Re: A little request about spam

2005-04-15 Thread Bill Mill
ning. Here's to b*tching on c.l.p actually solving something ! Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Strings and Lists

2005-04-18 Thread Bill Mill
e bit-twiddling operators to get at your data. These should be *very* fast, as well as memory efficient. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python regex Doc (was: Python documentation moronicities)

2005-04-19 Thread Bill Mill
eractive > sessions, complete with ">>>" and "..."), but nits can always be picked > and I'm not the gatekeeper to Python's documentation. > I'd suggest that he actually make an effort at improving the docs before submitting them. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Bill Mill
think this is more intuitive, since most people (including > > mathematicians) start counting at "1". The reason for starting at > > "0" is easier memory address calculation, so nothing for really high > > level languages. > > Personnaly I would like to ha

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Bill Mill
On 20 Apr 2005 13:39:42 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Op 2005-04-20, Bill Mill schreef <[EMAIL PROTECTED]>: > > On 20 Apr 2005 12:52:19 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> Op 2005-04-20, Torsten Bronger schreef &

Re: Troll? was: Re: goto statement

2005-04-20 Thread Bill Mill
ve he meant obfuscating bytecode for a commercial product, to try and avoid decompilation, which is often a desirable function for commercial entities. (Not that I have the technical knowledge to agree or disagree with what he said, I'm just trying to help clear up what's become a fairly

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-22 Thread Bill Mill
t; t = 2 >>> [(lambda n: t**n)(n) for n in range(4)] [1, 2, 4, 8] >>> t = 3 >>> [(lambda n: t**n)(n) for n in range(4)] [1, 3, 9, 27] I just thought that was kinda neat. If you wanted to obfuscate some python, this would be an awesome trick - hide the value of t somewhere early in the function then pull a variation of this out later. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: What is situation with threads in Python

2005-04-25 Thread Bill Mill
On 4/25/05, Leonard J. Reder <[EMAIL PROTECTED]> wrote: > Hello Mark, > > I took your three day course here at JPL and recall that you said > something was wrong with the implementation of threads within Python > but I cannot recall what. So what is wrong with threads in Python? I'm going to gue

Re: What's do list comprehensions do that generator expressions don't?

2005-04-25 Thread Bill Mill
ar. Once that happens, we can tell people who ask the OP's question that [genexp] is just another way to spell list(genexp), and he should use it if he wants the entire list constructed in memory. > Jeremy> should be relatively simple), it's not worth breaking that > J

Re: Do I need a nested lambda to do this?

2005-04-25 Thread Bill Mill
v, t[1]) for t in tab]) for v, tab in zip(vals, tabs)] [((1.0, 1), (1.0, 3), (1.0, 4)), ((2.3439, 2), (2.3439, 0), (2.3439, 9)), ((4.23420004, 4), (4.23420004, 3), (4.23420004, 1))] Peace Bill Mill bill.mill at gmail.com > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: Which IDE is recommended?

2005-04-27 Thread Bill Mill
wing+komodo&rnum=3#3a118074c68f1f35 http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/2225676eb7e1b4e/cdee764dfa2b5391?q=best+IDe&rnum=1#cdee764dfa2b5391 Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: python website

2005-12-16 Thread Bill Mill
rch?q=python%20web%20framework . Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

iTunes Search Algorithm/Data Structure?

2006-08-17 Thread Bill Mill
" in it. Typing "am" leaves only row 1, since "gamma" has the substring "am" in it. The key here is that this works instantaneously as you type, even with very large lists with many elements per row. I'd like the employee list in my current application to be s

Re: trouble with lists

2005-05-03 Thread Bill Mill
for i in range(3)] >>> y [[], [], []] >>> [id(b) for b in y] [168611980, 168612300, 168611916] Or, replace x[0] with a new list, instead of modifying the one already there: >>> x[0] = [2] >>> x [[2], [], []] Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary comparison

2005-05-05 Thread Bill Mill
key(patch): print "Sun recommends patch %s" % patch for patch in serverx: if not sun.has_key(patch): print "Serverx has unnecessary patch %s" % patch def diff_revs(sun, serverx): for patch, rev in sun.iteritems(): if serverx.has_key(

Re: hard memory limits

2005-05-06 Thread Bill Mill
n the system is > heavily loaded. Otherwise, you're going to hit per-process limits. In > the latter case, adding RAM or swap won't help at all. Raising the > per-process limits is the solution. > A quick google shows it to be mac os X, and a pretty frequent error messa

Re: Getting number of iteration

2005-05-06 Thread Bill Mill
element %s" % (n, x) Earlier: n = 0 for x in lst: print "iteration %d on element %s" % (n, x) n += 1 And you shouldn't use list as a variable name; list() is a built-in function which you'll clobber if you do. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting number of iteration

2005-05-06 Thread Bill Mill
On 5/6/05, Bill Mill <[EMAIL PROTECTED]> wrote: > On 5/6/05, Florian Lindner <[EMAIL PROTECTED]> wrote: > > Hello, > > when I'm iterating through a list with: > > > > for x in list: > > > > how can I get the number of the current iteratio

replace string patern with different value

2005-05-09 Thread Bill Mill
got xyzzy text xyzzy yeah yeah yeah" >>> token 'xyzzy' >>> for rep in L: ... source = source.replace(token, rep, 1) ... >>> source "11 text we've got 22 text 33 yeah yeah yeah" And, if I may, I recommend the Python Tutorial at http://docs.python.org/tut/tut.html . Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Listing of declared variables and functions

2005-05-09 Thread Bill Mill
t; import re >>> locals() {'__builtins__': , 're': , 'x': 12, '__name__': '__main__', 'z': 13, '__doc__': N one} >>> locals().keys() ['__builtins__', 're', 'x', '__nam

Does anybody know the status of PyCon recordings?

2005-05-09 Thread Bill Mill
w if these recordings exist and, if so, where they are? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: A Faster Way...

2005-05-10 Thread Bill Mill
y different format: >>> zip(range(10), range(20, 30)) [(0, 20), (1, 21), (2, 22), (3, 23), (4, 24), (5, 25), (6, 26), (7, 27), (8, 28) , (9, 29)] > Sorry if it seems an homework assignment. It'd be one heck of a short homework assignment. I hope you've read the python

Re: Python Graphing Utilities.

2005-05-10 Thread Bill Mill
form to at least linux and windows. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Graphing Utilities.

2005-05-11 Thread Bill Mill
willl recursively search any directory in AFMPATH, so you only need to specify a base directory if multiple subdirectories contaning '*.afm' files. Peace Bill Mill bill.mill at gmail.com > > Tschö, > Torsten. > > [*] because of the "pslatex" backend, which means t

Re: Python Graphing Utilities.

2005-05-11 Thread Bill Mill
On 5/11/05, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hallöchen! > > Bill Mill <[EMAIL PROTECTED]> writes: > > > On 5/11/05, Torsten Bronger <[EMAIL PROTECTED]> wrote: > > > >> Fernando Perez <[EMAIL PROTECTED]> writes: > >&

Re: Python Documentation (should be better?)

2005-05-12 Thread Bill Mill
uiltin types, so that you'd find "float (builtin)", "string > > (builtin)", "dict (builtin)", etc. in the appropriate alphabetical > > positions. > > +1 > > TJR > +1 Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How "return" no return ?

2005-05-12 Thread Bill Mill
re writing your own interpreter, it should still be syntactically invalid. Could you perhaps repeat your question with an example of what behavior is surprising you? Peace Bill Mill bill.mill at gmail.com > > "Fredrik Lundh" <[EMAIL PROTECTED]> escribió en el mensaje > ne

Re: increment bits

2005-05-12 Thread Bill Mill
x27;, '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0xe8', '0xe9', '0xea', '0xeb', '0xec', '0xed', '0xee', '0xef', '0xf0', '0xf1', '0xf2', '0xf3', '0xf4', '0xf5', '0xf6', '0xf7', '0xf8', '0xf9', '0xfa', '0xfb', '0xfc', '0xfd', '0xfe', '0xff'] Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 19 May 2005 06:56:45 -0700, rh0dium <[EMAIL PROTECTED]> wrote: > Hi All, > > While I know there is a zillion ways to do this.. What is the most > efficient ( in terms of lines of code ) do simply do this. > > a=1, b=2, c=3 ... z=26 > > Now if we really want some bonus points.. > > a=1, b=2,

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
hon. > for i, digraph in enumerate(sorted([''.join((x, y)) for x in alpha for > y in [''] + [z for z in alpha]], key=len)): >globals()[digraph]=i+1 > > How do you implement this sucker?? Works just fine for me. Let me know what error you're getting

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
ord2tuple('ZZ14') (13, 701) >>> coord2tuple('ZZ175') (174, 701) >>> coord2tuple('A2') (1, 0) Are there cols greater than ZZ? I seem to remember that there are not, but I could be wrong. Hope this helps. Peace Bill Mill [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
7;key'] l2.sort(lambda a,b: cmp(f(a), f(b))) return l2 l2.sort() return l2 And from your other email: > I need to go the other way! tuple2coord Sorry, I only go one way. It should be transparent how to do it backwards. Peace Bill Mill [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 5/19/05, Peter Otten <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > >> Traceback (most recent call last): > >>File"",line1,in? > >> NameError: name 'sorted' is not defined > >> > >> I think you're probably usi

Re: Convert from numbers to letters

2005-05-20 Thread Bill Mill
rly used. I like it especially for signatures like "def change_coord((x, y))". It was one of those features, for me, where I just tried it without knowing of its existence, assuming it would work, and I was pleasantly surprised that it did. Peace Bill Mill bill.mill at gmail.com [1] htt

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread Bill Mill
ome things you might not expect, including changing /r/n to /n. Try: >>> f = file('d:/deleteme.txt', 'rb') >>> f.read() 'testing\r\n1\r\n2\r\n3' >>> f = file('d:/deleteme.txt', 'r') >>> f.read() 'testing\n1\n2\n3' Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: computer algebra packages

2005-06-08 Thread Bill Mill
rivate > contract. But it's doable. > What about http://library.wolfram.com/infocenter/MathSource/585/ ? Seems to be non-proprietary, or something different, but does it work? I don't have Mathematica, so I don't know. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ? (OT I guess)

2005-06-14 Thread Bill Mill
ists working like this, and I believe that they need to recognize themselves as a separate discipline with separate rules. I'd like to see them open source their code when they publish papers as a matter of standard procedure. I'd like to see them publish reports much more like biolo

Re: windows blinds

2007-03-14 Thread Bill Mill
going to need to use the Win32 API. As for how to use the win32 API, you could try asking on comp.os.ms- windows.programmer.win32 ( http://groups.google.com/group/comp.os.ms-windows.programmer.win32/topics?lnk=srg ), because that's some fiendish stuff. -Bill Mill bill.mill at gmail.com -

Re: Compiler-AST-Walk-Visitor: Any Examples or Documentation?

2007-03-23 Thread Bill Mill
nd walk would be helpful? http://www.google.com/codesearch?q=compiler+walk+lang%3Apython&hl=en&btnG=Search+Code It seems from a superficial look that some of those files would be helpful as examples. -Bill Mill bill.mill at gmail.com http://billmill.org -- http://mail.python.org/mailman/listinfo/python-list

Regex Question

2007-01-10 Thread Bill Mill
*?)\.)") ('beta',) Failed In [132]: test_re(r"(?:item2: (.*?)\.)?") (None,) (None,) Shouldn't the '?' greedily grab the group match? Thanks Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Regex Question

2007-01-16 Thread Bill Mill
James Stroud wrote: > Bill Mill wrote: > > Hello all, > > > > I've got a test script: > > > > start python code = > > > > tests2 = ["item1: alpha; item2: beta. item3 - gamma--", > > "item1: alpha; item3 - gamma--&

Re: Regex Question

2007-01-18 Thread Bill Mill
Gabriel Genellina wrote: > At Tuesday 16/1/2007 16:36, Bill Mill wrote: > > > > py> import re > > > py> rgx = re.compile('1?') > > > py> rgx.search('a1').groups() > > > (None,) > > > py> rgx = re.compile('(

Re: Klik2 Project, Python apps on linux

2008-01-27 Thread Bill Mill
Jason, Can you give a little more detail on the problem? What's the directory structure of a Klik package that's failing look like? What program is trying to import what module from where that's failing? -Bill Mill On Jan 27, 2008 1:49 AM, Jason Taylor <[EMAIL PROTECTED]>

Re: Pycon disappointment

2008-03-16 Thread Bill Mill
, I'm just posting it because I found it thought-provoking.) -Bill Mill http://billmill.org -- http://mail.python.org/mailman/listinfo/python-list

<    1   2