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

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

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

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

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

Re: Default method arguments

2005-11-15 Thread Bill Mill
ust tossed off an answer without thinking much, and we see the result. It could have been a good debugging lesson for him if he'd tried to pass 0; I think I'll use that as my excuse. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Default method arguments

2005-11-15 Thread Bill Mill
e self.data the default argument for self.f(). (I > want to use 'A' class as following : > > myA = A(5) > myA.f() > > and get printed '5' as a result.) > class A: def __init__(self, n): self.data = n def f(self, x=None): if not x:

Re: Python obfuscation

2005-11-10 Thread Bill Mill
x27;re not used in ways you don't intend is to require the user to contact you to use it, and that's a deal with the devil. One you might need to make if security is that important to you, as Microsoft and Valve have decided it is, but it's a deal with the devil nonetheless. Peac

Re: PYTHON LOOSING FOR JAVA???????

2005-11-08 Thread Bill Mill
office web > > based. I sincerely enjoy the idea althoug I'd like to know what will be > > the future of this wonderful language called Python?? > > I think I know???? Although, the future is difficult to predict??? +1 QOTW Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: python server

2005-11-07 Thread Bill Mill
et, over a corporate LAN, on the same computer, on Internet2)? Is there any framework in existance, or is this program being written from scratch? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: A Moronicity of Guido van Rossum

2005-09-29 Thread Bill Mill
+1 QOTW. > > Tim > -1 XLEGQOTW (Xah Lee Ever Getting QOTW'd) Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: python's performance

2005-09-29 Thread Bill Mill
gt; took only .2s or less for one image with the same size. > > Don't know why python and PIL is so slow, any idea to improve the > > performance? Thanks a lot! > > > > James > > > > -- > > http://mail.python.org/mailman/listinfo/python-list > > &

Re: python's performance

2005-09-29 Thread Bill Mill
? Ask something that's answerable, and we'll try to help you.) Peace Bill Mill bill.mill at gmail.com On 9/29/05, James Hu <[EMAIL PROTECTED]> wrote: > Hi, > > I used python and PIL to capture image from a digital camera, > It seems like it took more than 1 second to cap

Re: grouping array

2005-09-29 Thread Bill Mill
of non zero regions..as (x1,y1,x2,y2) > [(0,0,2,1),(0,4,2,5)] which show the top left(x1,y1) and bottom > right(x2,y2) corners of each group.hope i am clear. > I don't understand. Could you give some inputs with expected outputs and some explanation? Peace Bill Mill bill.mill at gma

Re: A Moronicity of Guido van Rossum

2005-09-29 Thread Bill Mill
> But, this post of his shows [Guido's] haughtiness +1 IQOTW (Ironic Quote Of The Week. Thanks for the laughs, Xah) Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-09-29 Thread Bill Mill
Error correction time! > >>> #here's how the crazy hackers subclassing your code can break your super > ... #special private variable! > ... That should be "using your code" not "subclassing your code". D'oh! Peace Bill Mill bill.mill at gmail

Re: Will python never intend to support private, protected and public?

2005-09-29 Thread Bill Mill
x27;] >>> >>> #here's how the crazy hackers subclassing your code can break your super ... #special private variable! ... >>> t._test__i += 6 >>> t.i got i 7 But, if your users can't figure out that they shouldn't be changing the variable called t._test__i without expecting side effects, what do you think of the users of your class? Python is for consenting adults. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] PEP 350: Codetags

2005-09-27 Thread Bill Mill
e a hard time convincing the community > at large to actually use it. You need to actually have a better mousetrap > to present before you ask people to move their cheese. :) > +1 I agree with PJE almost entirely. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How to show percentage

2005-09-22 Thread Bill Mill
You need to convert 1 or 3 to a float. How about: >>> def pct(num, den): return (float(num)/den) * 100 ... >>> pct(1, 3) 33.3333329 Peace Bill Mill bill.mill at gmail.com On 22 Sep 2005 10:51:43 -0700, Sen-Lung Chen <[EMAIL PROTECTED]> wrote: > Dear All: &

Re: C#3.0 and lambdas

2005-09-21 Thread Bill Mill
; > return math.sqrt((p2[0] - p1[0])**2 + (p2[1] - p1[1])**2) > > But not massively nicer than: > > def euclidian_distance(p1, p2): > (x1, y1), (x2, y2) = p1, p2 > return math.sqrt((x2 - x1)**2 + (y2 - y1)**2) > But the question is - why go to the eff

Re: C#3.0 and lambdas

2005-09-19 Thread Bill Mill
not one of the most important ones - but if I > can write > > a, (b ,c) = 1, (2,3) > > I'd like to write > > def foo(a, (b,c)): > ... > > foo(1, (2,3)) > Agreed. I discovered them when I wondered "wouldn't it be neat if functions unpacked tuples j

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread Bill Mill
at 0x00969710>) (3, <__main__.LLentry object at 0x00969710>) (3, <__main__.LLentry object at 0x00969710>) (2, <__main__.LLentry object at 0x00969710>) Although they appear in order here, they don't always. Often, multiple objects have a value of 1, and he's going to ge

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread Bill Mill
On 8/25/05, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > > Unlikely; 2 people have confirmed these results already. > > > > I did find, though, that if I remove all print statements from the > > program, the dummy and non-dummy variable ve

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread Bill Mill
On 8/25/05, Jack Diederich <[EMAIL PROTECTED]> wrote: > On Thu, Aug 25, 2005 at 01:35:04PM -0400, Bill Mill wrote: > > On 8/25/05, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > > Mark Dickinson wrote: > > > > > > > Questions: > > > >

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread Bill Mill
Bill Mill wrote: > > Pentium M 1.8 GHz Windows 2k. Here's the top of the profile results > for fast and slow on my machine (these won't look decent except in a > fixed-width font): > > > Interestingly, the test.py:36 line, which takes 45 seconds (!!) in the >

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread Bill Mill
es. > Unlikely; 2 people have confirmed these results already. I did find, though, that if I remove all print statements from the program, the dummy and non-dummy variable versions take indentical time. Can others reproduce this? I'm Investigating further... Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread Bill Mill
uot; It seems to work (>19x speedup on my machine), I'm just curious what path you followed to get there. And, finally, you should forward this to the python-dev list, if somebody hasn't already. There are more people who know a ton about python internals there. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: loop in python

2005-08-22 Thread Bill Mill
> If you want a fast language, try Holden. I've just invented it. > Unfortunately it gets the answer to every problem wrong unless the > answer is 42, but boy it runs quickly. +1 QOTW (sometimes the zen master has to whack the student on the head) Peace Bill Mill bill.mill at gmai

Re: loop in python

2005-08-22 Thread Bill Mill
They come out even in the computer language shootout: http://shootout.alioth.debian.org/benchmark.php?test=all&lang=python&sort=fullcpu (tied 8-8 in execution time, although perl wins 4-12 on memory consumption) Peace Bill Mill On 8/23/05, km <[EMAIL PROTECTED]> wrote: > Hi

Re: help in algorithm

2005-08-11 Thread Bill Mill
#x27;s using LSI for his clustering. I ask because I've done some LSI [1], and could help him out with that if he is doing it. While I'm on the subject, is there any general interest in my python LSI code? [1] http://llimllib.f2o.org/files/lsi_paper.pdf Peace Bill Mill -- http://mail.

Re: The ONLY thing that prevents me from using Python

2005-08-05 Thread Bill Mill
> I really wish Python could be more widely available on web server > machines. This is just my own experience and I would like to hear your > comments. > I would like a pony... no, wait, even better, a unicorn! Peace Bill Mill bill.mill at gmail.com PS (the gist is, why don'

Re: sample code for parsing html file to get contents of td fields

2005-08-04 Thread Bill Mill
e this? In [1]: x = "something something else and\nanother thing in a td and again else" In [2]: import re In [3]: r = re.compile('(.*?)', re.S) In [4]: r.findall(x) Out[4]: ['something else', 'in a td'] If not, you'll have to explain more clearly

Re: Ten Essential Development Practices

2005-07-29 Thread Bill Mill
> although, as some argue, it's > possible [GvR] thinks in base 9.5, that just doesn't seem Pythonic to me. +1 QOTW Peace Bill Mill [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Bill Mill
func_name): ... for e in lst: ... getattr(e, func_name)() ... >>> call_this_func(x, 'func1') func1 called other func1 func1 called >>> Note that the getattr raises an AttributeError if func_name doesn't exist in the object; you should probably wrap it in a try/except. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Bill Mill
t; >>> def foo(): print "foobarred" ... >>> foo() foobarred >>> eval("foo()") foobarred >>> Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread Bill Mill
On 7/21/05, Bill Mill <[EMAIL PROTECTED]> wrote: > On 7/21/05, Jan Danielsson <[EMAIL PROTECTED]> wrote: > > Hello all, > > > >How do I make a python script actually a _python_ in unix:ish > > environments? > > > > I know about adding: >

Re: Stupid question: Making scripts python-scripts

2005-07-21 Thread Bill Mill
program? I bet there's an equivalent you could symlink to it. Unfortunately, I've never BSDed, so I can't help you find it. To get a workable subset of the normal env functionality, you could try (assuming you use bash): /home/llimllib $ echo "$@" > /usr/bin/env /home/

Re: is this pythonic?

2005-07-21 Thread Bill Mill
On 7/21/05, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 20 Jul 2005 16:30:10 -0400, Bill Mill wrote: > > > On 7/20/05, Simon Brunning <[EMAIL PROTECTED]> wrote: > >> On 7/20/05, Mage <[EMAIL PROTECTED]> wrote: > >> > Or is there bet

Re: is this pythonic?

2005-07-20 Thread Bill Mill
On 7/20/05, Bill Mill <[EMAIL PROTECTED]> wrote: > On 7/20/05, Simon Brunning <[EMAIL PROTECTED]> wrote: > > On 7/20/05, Mage <[EMAIL PROTECTED]> wrote: > > > Or is there better way? > > > > > > for (i, url) in [(i,links[i]) for i in ran

Re: is this pythonic?

2005-07-20 Thread Bill Mill
yield (i, elt) i += 1 for i, url in my_enumerate(links): but it's not too bad as it is. Also, my function is completely untested - it's close to right though.) Peace Bill Mill -- http://mail.python.org/mailman/listinfo/python-list

Re: smtplib

2005-07-18 Thread Bill Mill
the last release. > > Do you know any idea about this change? check out the CVS changelog to see what's changed with it: http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Lib/smtplib.py?rev=1.70&view=log Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: odd python/linux/cherrypy behavior

2005-07-16 Thread Bill Mill
On 7/16/05, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sat, 16 Jul 2005 19:54:31 -0400, Bill Mill <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > The FAT dirs are mounted with the following options: > > defaults,user,umask=000

Re: odd python/linux/cherrypy behavior

2005-07-16 Thread Bill Mill
On 7/16/05, Neil Hodgson <[EMAIL PROTECTED]> wrote: > Bill Mill: > > > ... a FAT partition for data as a dmz which both linux and NT can > > access ... > > Yesterday, I downloaded the new release of cherrypy, and stuck it on > > the dmz drive. ... > > Ev

odd python/linux/cherrypy behavior

2005-07-16 Thread Bill Mill
all problem, I figure out that if I move it to my ext3 drive, it again works perfectly. Prints out the same information, says it's waiting on 8080, but this time, I can access it. Can anybody posit a guess as to why it would behave this way? Peace Bill Mill bill.mill at gmail.com -- http

Re: Python Programming Contest

2005-07-15 Thread Bill Mill
ers, > Brian > -- > http://mail.python.org/mailman/listinfo/python-list > Questions: Will that random test generator (included in the download) be used to perform the actual testing? How many tests will be run on each program? What is the penalty for a wrong answer? Peace Bill Mill PS -

Re: String Manipulation

2005-07-13 Thread Bill Mill
string.maketrans('.,-', ' ')) #read the docs at # http://docs.python.org/lib/node109.html # for more details #End program 3 Hope this helps; you should be able to put the pieces together to do what you want to do. If you can't, feel free to

Re: question on "input"

2005-07-12 Thread Bill Mill
;) y or n?y >>> answer 'y' Check out the documentation of both functions at http://docs.python.org/lib/built-in-funcs.html for more details. Peace Bill Mill -- http://mail.python.org/mailman/listinfo/python-list

Re: Yet Another Python Web Programming Question

2005-07-11 Thread Bill Mill
#x27;t know, but it causes a lot of errors for windows folks. I'm a frequent linux/windows switcher, and it's caused me no end of troubles - if you're getting "premature end of script headers" in your apache error logs, this may be your problem. Peace Bill Mill bill.mil

Re: Scipy - Latex Annotations in plots

2005-07-06 Thread Bill Mill
u know another one with 3D-capabilities as well? > That would be very nice, > Perhaps gnuplot.py (http://gnuplot-py.sourceforge.net/) will work for you? It is a thin wrapper around Gnuplot, which is very good at producing ps format images, and is capable of producing 3 dimensional graphs. Pe

Re: Folding in vim

2005-07-06 Thread Bill Mill
vely, zc and zC close it non- and recursively. zr opens all folds one level, zR opens them all recursively, zm closes them all one level, and zM closes them all recursively. It's pretty sweet. Maybe we should have a big Vim-python tip-a-thon thread? Peace Bill Mill [EMAIL PROTECTED] -- 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: 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: \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: 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: 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-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
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
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
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: 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: 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: 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: 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 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-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: 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

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

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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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: 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: 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: 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: 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: 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: 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: 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: 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: shebang in cross platform scripts

2005-04-06 Thread Bill Mill
ll available for > Windows. Google is your friend. > > Symbolic links also work under uwin (don't know for sure about the > others). That means you can install a link in /usr/bin to whereever > python lives, and expect #!/usr/bin/python to work just fine. This works in cygwin

  1   2   >