Re: Most elegant way to generate 3-char sequence

2006-06-10 Thread James Stroud
Steve Holden wrote: > James Stroud wrote: > >> SuperHik wrote: >> >>> and the winner is... :D >>> David Isaac wrote: >>> >>> >>>> alpha = string.lowercase >>>> x=(a+b+c for a in alpha for b in alpha for c in alpha) &

Re: Most elegant way to generate 3-char sequence

2006-06-10 Thread James Stroud
James Stroud wrote: > SuperHik wrote: > >> James Stroud wrote: >> >>> SuperHik wrote: >>> >>>> and the winner is... :D >>>> David Isaac wrote: >>>> >>>>> alpha = string.lowercase >>>>> x=(a+b+

Re: Most elegant way to generate 3-char sequence

2006-06-10 Thread James Stroud
Steve Holden wrote: > James Stroud wrote: > >> SuperHik wrote: >> >>> and the winner is... :D >>> David Isaac wrote: >>> >>> >>>> alpha = string.lowercase >>>> x=(a+b+c for a in alpha for b in alpha for c in alpha) &

Re: Most elegant way to generate 3-char sequence

2006-06-11 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: > >> See the actual question: >> >> >How would you construct a generator to acheive this? > > > if you don't think the context provided by the subject line and the > sentence before the question is impo

Re: learning python idioms

2006-06-11 Thread James Stroud
ient and which aren't? > > Thanks in advance, > Ben > As an experiment, I googled 'python idioms' and got a few good hits right at the top. I probably should have done this a long time ago. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Bo

Re: Tuple Syntax and ()

2006-06-13 Thread James Stroud
in relation to tuples at all, do they? > Aside from grouping, they are special to construct an empty tuple. py> () == tuple() True Also, don't underestimate their relationship with tuples when it comes to grouping: py> a, b, c = 1, 2, 3 py> py> a == a, b, c (True, 2, 3) py&g

Re: "groupby" is brilliant!

2006-06-13 Thread James Stroud
ly your question (which you didn't really have). I'm sure I will regret this becuase, as you will find, suggesting code on this list with additional utility is somewhat discouraged by the vociferous few who make a religion out of 'import this'. Also, I still have no idea what 'groupby' does. It looks interesting thgough, thanks for pointing it out. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: "groupby" is brilliant!

2006-06-13 Thread James Stroud
James Stroud wrote: > Frank Millman wrote: > >> Hi all >> >> This is probably old hat to most of you, but for me it was a >> revelation, so I thought I would share it in case someone has a similar >> requirement. >> >> I had to convert an ol

Re: "groupby" is brilliant!

2006-06-14 Thread James Stroud
Alex Martelli wrote: > James Stroud <[EMAIL PROTECTED]> wrote: >... > >>def doit(rows, doers, i=0): >> for r, alist in groupby(rows, itemgetter(i)): >> if len(doers) > 1: >> doit(alist, doers[1:], i+1) >> doers[0](r) > >

Re: "groupby" is brilliant!

2006-06-14 Thread James Stroud
Alex Martelli wrote: > James Stroud <[EMAIL PROTECTED]> wrote: >... > >>def doit(rows, doers, i=0): >> for r, alist in groupby(rows, itemgetter(i)): >> if len(doers) > 1: >> doit(alist, doers[1:], i+1) >> doers[0](r) > >

Re: Negative hex to int

2006-06-14 Thread James Stroud
7', 16) > > 231 > --- > > Does anyone have a clue a to what I need to do? > > Thanks! > > Andreas Lydersen > py> t = lambda x: int(x, 16) - ((int(x, 16) >> 7) * 256) py> t('e7') -25 -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: a good programming text editor (not IDE)

2006-06-15 Thread James Stroud
e fun kind of memory) and all of those mind boggling keystrokes begin to feel like an artistic expression reminiscent of playing the piano. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for examples related to advanced python string, list and map operations

2006-06-15 Thread James Stroud
108, 111, 44, 32, 119, 111, 114, 108, 100, 33] > > print filter(lambda n: n % 2 == 0, numbers) > > > > numbers = [72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33] > > print reduce(lambda x, y: x+y, numbers) > > > > Thank you, > > Alan

Re: a good programming text editor (not IDE)

2006-06-16 Thread James Stroud
ue...maybe personality #2 should be > arguing for brown instead). > > My best friend is an emacs user, and I'm a vimmer...it doesn't > come between us. :) > > -tkc Yes, heartwarming, but if you are thinking marriage... -- James Stroud UCLA-DOE Institute for G

Re: Pycrypto

2006-06-16 Thread James Stroud
) > ECB cipher. Why we have this limitation? > > Laszlo > > CBC mode is cipher block chaining, so it still works as a block cipher, which means that it must be that len(text) % block_size == 0. In other words, CBC does not shift by one byte but by block_size bytes. See: http://e

Re: interactive multi-file search and replace

2006-06-19 Thread James Stroud
common task and I don't want to re-invent the > wheel. > > Ryan Most people probably use something like vim rather than re-inventing the wheel themselves. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud

Re: Absolute noob to Linux programming needs language choice help

2006-06-20 Thread James Stroud
s. I'm not so sure C is better suited. Definitely resist "shell scripting". Several chapters in Mark Lutz's _Programming Python_ will help with networking (after you have read through _Learning Python_ or equivalent). NewRiders publishes _Python Web Programming_ authored by Ste

Re: tkMessagebox.askyesno always returns False

2006-06-21 Thread James Stroud
> This problem seems to be beyond the code you provide. Is this part of a larger program? Is it possible to show the entire script? James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate all permutations of a string?

2006-06-22 Thread James Stroud
7;.join(t)) > return l > > This gives me a syntax error! > I need to output a list that has all the permutations of the input string. > > > > >>-- >>http://mail.python.org/mailman/listinfo/python-list >> > > p = ["".join(s) for s in permute('abcdefg')] -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate all permutations of a string?

2006-06-22 Thread James Stroud
Girish Sahani wrote: >>>thanks lawrence...however this func doesnt return the permuted strings, >>>so >>>i added some code as follows to generate a list of all the permutations: >>> >>>def permute(seq): >>>l = [] >>>if len(seq) == 0: >>>yield [] >>>else: >>>for i in rang

Re: Looking for Python code to obsfucate mailto links on web site

2006-06-26 Thread James Stroud
Dan Sommers wrote: > On Sun, 25 Jun 2006 21:10:31 +0100, > Andrew McLean <[EMAIL PROTECTED]> wrote: > > >>I'm looking at putting some e-mail contact addresses on a web site, >>and wanted to make it difficult for spammers to harvest them. > > > [ ... ] > > >>Searching the web it looks like the

Re: Having problems with strings in HTML

2006-06-26 Thread James Stroud
LITE_FILE_NAME': > HI_LITE_FILE_NAME} > > I wonder if this has something to do with HTML's % character. > > KT > Yes it does. Have a look at urllib.quote and unquote. These may help. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question: use function to read text file

2006-06-26 Thread James Stroud
;=== You have assigned open (which, by the way, is a builtin!) in a function *after* you have referenced it. You have over-ridden the open name with the assignment, but you have referenced it 'before assignment', as your error mesage says. This is a favorite trip-up of newer pytho

curiosity about the nature of identity (in python)

2006-06-28 Thread James Stroud
+2) 149679044 py> id(7*6) 149679044 So, I guess my question is to what extent is this equivalency implementation dependent? Is this equivalency a requirement for a legitimate python implementation? Won't these checks slow down evaluation of 'is' considerably? Does '==

Re: Maximize main window with code

2006-06-30 Thread James Stroud
lHello = Label(F, text="Hello") > lHello.pack() > bQuit = Button(F, text="Quit", command=F.quit) > bQuit.pack() > # set the loop running > top.mainloop() > This gets pretty close: top.geometry('%sx%s+0+0' % top.maxsize()) James -- James Stroud U

Building Python Based Web Application

2006-09-08 Thread James Stroud
oriented web development with a focus on applying my python skills. Any suggestions will be greatly appreciated. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: best split tokens?

2006-09-08 Thread James Stroud
ho', 'art', 'in', 'heaven', 'hallowed', 'be', 'their', 'names', 'did', 'forthwith', 'declare', 'that', 'all', 'men', 'are', 'created', 'to

Re: Looking for a regexp generator based on a set of known string representative of a string set

2006-09-08 Thread James Stroud
n Eddy and colleagues: http://hmmer.janelia.org/ http://selab.janelia.org/people/eddys/ James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a regexp generator based on a set of known string representative of a string set

2006-09-09 Thread James Stroud
#x27;(?:c|n)(?:p|s)(?:k|u|d)g-3(?:1|0)0(?:A|0)(?:A|B|1|0|3|2|6|8)' print rgx_str But, if you get much more complicated that this, you will definitely want to check out hmmer, especially if you can align your sequences. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics

Re: Simple regex with whitespaces

2006-09-10 Thread James Stroud
27; object has no attribute 'group' py> patt_3plus.search(s1).group(0) Traceback (most recent call last): File "", line 1, in ? AttributeError: 'NoneType' object has no attribute 'group' py> patt_2plus.search(s1).group(0) Traceback (most recent call la

Re: Simple regex with whitespaces

2006-09-11 Thread James Stroud
ing one of the most accessible modules (to me, anyways)--and well worth learning. However, in complicated applications, regex is usually still fun and valuable as an intellectual exercise. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: table (ascii text) lin ayout recognition

2006-09-12 Thread James Stroud
he columns. Zeros will indicate high probability of between-column. Code tomorrow if no one else posts. Must run... -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: table (ascii text) lin ayout recognition

2006-09-13 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hello, > > I am looking for python code useful to process > tables that are in ASCII text. The code must > determine where are the columns (fields). > Concerned tables for my application are various, > but their columns are not very complicated > to locate for a human, b

Re: table (ascii text) lin ayout recognition

2006-09-13 Thread James Stroud
James Stroud wrote: > indices = [t for t in zip(indices[::2],indices[1::2])] (Artefact of cut-and-paste.) Make that: indices = zip(indices[::2],indices[1::2]) James -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter.Button(... command) lambda and argument problem

2006-09-15 Thread James Stroud
;, x return highliter class Test: def __init__(self, parent): buttons = [tk.Button(parent, text=str(x+1), command=make_it(x)) for x in range(5)] for button in buttons: button.pack(side=tk.LEFT) root = tk.Tk() d = Test(root) root.mainloop() -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: find class where method was defined ?

2006-09-19 Thread James Stroud
Simon Burton wrote: >>>>class A(object): > > ... def foo(self): pass > ... > >>>>class B(A): > > ... pass > ... > >>>>b=B() >>>>b.foo > > > > > How can I work out what class b.foo was defined in

Re: Pythonic way to condese my array

2006-09-19 Thread James Stroud
k this is, but I would do it thus: dicts = [{'column':1}, {'column':2}, {'column': 4}, {'column': 8}, {'column':4}] vals = list(set(d['column'] for d in dicts)) vals.sort() amap = dict((b,a) for (a,b) in enumerate(vals)) for d in dic

Re: naming objects from string

2006-09-20 Thread James Stroud
is this possible? > Depends on your namespace, but for the local namespace, you can use this: py> a = object() py> a py> locals()['bob'] = a py> bob A similar approach can be used for the global namespace. James -- James Stroud UCLA-DOE Institute for Genomics

Re: view page source or save after load

2006-09-20 Thread James Stroud
uot;?".join([baseurl, fetchparams])) afile = open(filename, "w") afile.write(wwwf.read()) afile.close() James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Evaluation of Truth Curiosity

2006-09-21 Thread James Stroud
Hello All, I'm curious, in py> 0 | (1 == 1) 1 py> False | (1 == 1) True What is the logic of the former expression not evaluating to True (or why the latter not 1?)? Is there some logic that necessitates the first operand's dictating the result of the evaluation? Or is this an artefact of the

Re: Evaluation of Truth Curiosity

2006-09-21 Thread James Stroud
Everyone wrote: > [something intelligent] Ah, clarity. My confusion can undoubtedly be traced to a non-existent formal training in computer programming. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: view page source or save after load

2006-09-21 Thread James Stroud
Gabriel Genellina wrote: > At Thursday 21/9/2006 02:26, alex23 wrote: > >> page = urllib.urlopen('http://some.address') > > add .read() at the end > >> open('saved_page.txt','w').write(page).close() > > write() does not return the file object, so this won't work; you have to > bind the file to

Re: Retrieve HTML from site using cookies

2006-09-21 Thread James Stroud
at %s' % COOKIEFILE) print "<===cookies" for map_id in xrange(1001, 1507): try: download_map(map_id) wait = 7.5 + random.randint(0,5) print "=> waiting %s seconds..." % wait time.sleep(wait) except urllib2.HTTPError, e: # except DummyError, e: print "%s: failed to download" % map_id print " HTTP ERROR:", e else: print "# Downloaded map %s successfully." % map_id signout = urllib.urlopen(pda + ("?%s" % signout_params)) afile = open("signout.html", "w") afile.write(signout.read()) afile.close() -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to use timer in python

2006-09-21 Thread James Stroud
yxh wrote: > how to use timer in python. > the functionnality is like the MFC SetTimer() > > Try this (a little more flexible than Timer): http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/464959 -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los

Re: Tkinter button not working as expected

2006-09-21 Thread James Stroud
;red") # note change here self.button["command"] = functools.partial(self.getPath, t) self.button.pack(side=LEFT) def getPath(self, t): dirPath = tkFileDialog.askdirectory(initialdir="c:\\") print dirPath t.set(dirPath) root = Tk() app = App(root) root.mainloop() -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Building things with setup.py

2006-09-21 Thread James Stroud
e special in this regard? I'm running Linux FC4 on a dual intel p4 (~3.2 GHz) with sundry libraries in non-standard places. Is this non-standard part what's killing me? James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jam

Re: Building things with setup.py

2006-09-21 Thread James Stroud
James Stroud wrote: > Hello All, > > This is annoying. I am trying to build scipy right now but every .so > file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared" > to the ld flags. > > Main Question: When building with "setup.py", whe

Re: Building things with setup.py

2006-09-21 Thread James Stroud
Robert Kern wrote: > James Stroud wrote: > >> Hello All, >> >> This is annoying. I am trying to build scipy right now but every .so >> file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl >> -shared" to the ld flags. > > >>

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Robert Kern wrote: > James Stroud wrote: >> I did build my own python 2.5, yesterday, requiring me to rebuild all >> extensions. > > Do other extensions build correctly? If so, it's beginning to look like > a problem in numpy.distutils . It seems that every thi

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Martin v. Löwis wrote: > James Stroud schrieb: >> This is annoying. I am trying to build scipy right now but every .so >> file requires my adding "-lpython2.5 -lpthread -lm -lutil -ldl -shared" >> to the ld flags. > > That shouldn't be necessary.

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Robert Kern wrote: > James Stroud wrote: >> I did build my own python 2.5, yesterday, requiring me to rebuild all >> extensions. > > Do other extensions build correctly? If so, it's beginning to look like > a problem in numpy.distutils . Actually, I just fou

Re: Building things with setup.py

2006-09-22 Thread James Stroud
lude/pgsql Again, see the above rant for an explanation about any needless paths or flags--though advice and knowledge is welcome. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: +1 QOTW

2006-09-22 Thread James Stroud
>> >>In the state of the onion address? >> >>http://www.perl.com/pub/a/2006/09/21/onion.html > > > There is also this: > 'But I think the basic Perl paradigm is "Whatever-oriented programming."' This reminds me of when I realized I could become m

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Robert Kern wrote: > James Stroud wrote: > >> Well I added those arguments to $LDFLAGS, but it seemed like a pretty >> miserable hack, especially the "-shared" part. > > > Hmmm. Did you have $LDFLAGS set to anything (or more likely, nothing) > befor

Re: Building things with setup.py

2006-09-22 Thread James Stroud
Martin v. Löwis wrote: > James Stroud schrieb: > >>>What happens if you omit these flags? >> >>Please see my last message to Robert Kern. > > > If you don't want me to help you, that's fine, then I won't. > > I couldn't find an an

Re: License / Registration key enabled software

2006-09-22 Thread James Stroud
or devising this system for you. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Building things with setup.py

2006-09-23 Thread James Stroud
Ben Finney wrote: > James Stroud <[EMAIL PROTECTED]> writes: > >> I try things until a build works. I consider everything I do >> until acquiring a working build as necessary. Going back to see >> exactly what I did to make things work is not a viable option > &

Re: Building things with setup.py

2006-09-23 Thread James Stroud
Martin v. Löwis wrote: > James Stroud schrieb: >> I think I would like to know how to avoid or correct these sort of >> issues in the future, which seem to be limited, for me at least, to >> scipy and numpy, with the possible exception of MySQLdb and its >> dependenc

Re: Building things with setup.py

2006-09-23 Thread James Stroud
Robert Kern wrote: > Okay, this is possibly part of the problem. numpy.distutils handles > FORTRAN code differently than other extension modules; this is why pure > C extension modules both inside numpy and elsewehere were linking fine. > Try unsetenving $CPPFLAGS and $LDFLAGS and adding those a

Ideal python idle

2006-09-24 Thread James Stroud
Hello, I decided that the ultimate python IDE would basically be a vim editor with a hotkey or button that ran the currently edited module as "__main__", allowing gui (tkinter, wx) windows to spawn etc. That's it. I tried the "runscript.vim" plugin which basically promises this, but it seems

Re: does anybody earn a living programming in python?

2006-09-25 Thread James Stroud
walterbyrd wrote: > If so, I doubt there are many. > > I wonder why that is? > If you know German, there was just a job posting on this list for a python programmer. That would be at least one person. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Bo

Re: IDLE - Customizing output format

2006-09-26 Thread James Stroud
Ilias Lazaridis wrote: > Ilias Lazaridis wrote: >> IDLE has an output format like this: >> >> >>> object >> >> >>> type >> >> >>> object.__class__ >> >> >>> object.__bases__ >> >> How can I customize it to become like that: >> >> >>> object >> >> >>> type >> >> >>> object.__cl

Re: Survival of the fittest

2006-09-26 Thread James Stroud
has anything to teach me that say python, C, and Java don't (LISP/Scheme is on my short-list to learn.) James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

What's up with site.Quitter?

2006-09-26 Thread James Stroud
ed inside of the setquit() function in the site.py module. Would moving this class definition to module level be something that would meet with great resistance? I was thinking of posting to python-dev, but that list looked pretty high-level. James -- James Stroud UCLA-DOE Institute for Gen

Re: IDLE - Customizing output format

2006-09-26 Thread James Stroud
Ilias Lazaridis wrote: > James Stroud wrote: >>Ilias Lazaridis wrote: >>>I am wondering that other users are not annoyed by this reduced >>>readability. >> >>I'm sure its quite unpopular to agree with you, but I do. I am >>tremendously annoyed

Re: What's up with site.Quitter?

2006-09-26 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: > >> It seems I can find a reference to just about every type except those >> for "exit" and "quit" in the standard library somewhere. E.g.: >> >> py> type(__builtins__.Ellipsis) is types.EllipsisT

Re: What's up with site.Quitter?

2006-09-27 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: > >> Yes, but I was speaking more consistency than convenience (see above >> for what I mean by consistency). > > why would having access to a type object for exit/quit help you do > proper syntax coloring, btw? if you want

Re: What's up with site.Quitter?

2006-09-27 Thread James Stroud
Georg Brandl wrote: > James Stroud wrote: >> Hello All, >> >> Still jubilantly configuring my work environment for python 2.5, I >> came accross a curiosity when writing an automatic vim syntax file >> creator (so I can automatically update my syntax colorin

Re: Computer Language Popularity Trend

2006-09-27 Thread James Stroud
[EMAIL PROTECTED] wrote: > Xah Lee wrote: >> Computer Language Popularity Trend >> >> This page gives a visual report of computer languages's popularity, as >> indicated by their traffic level in newsgroups. This is not a >> comprehensive or fair survey, but does give some indications of >> popular

Re: What's up with site.Quitter?

2006-09-27 Thread James Stroud
[EMAIL PROTECTED] wrote: > James> But then again, maybe the consistency I perceive for the rest of > James> __builtins__ is more or less illusory. This might have been the > James> point of Fredrik's question. > > As I implied in my note, there is a difference between fundamental built

Re: Computer Language Popularity Trend

2006-09-27 Thread James Stroud
lls. > > sherm-- > While Xah does have a reputation for trolling, and the crossposting borders on pathological, you must admit that he presents here a bit of nice and illuminating research. We probably should encourage him when he does worthwhile things, and perhaps, in the future, he

Re: generator with subfunction calling yield

2006-09-27 Thread James Stroud
gt; > andy > In the commented line, you are only creating a generator. This is not equivalent to calling its "next" function, i.e., nothing will be "yielded" the way you have written it. def nn(): def _nn(): print 'inside' yield 1

Re: best way to get data into a new instance?

2006-09-28 Thread James Stroud
ot field in self._fields: raise ValueError, 'Field "%s" not supported.' % field else: self.__setattr__(field, value) def get_value(field): if not field in self._fields: raise ValueError, 'Field "%s" not supported.' % field

Re: best way to get data into a new instance?

2006-09-28 Thread James Stroud
James Stroud wrote: > John Salerno wrote: > >> Let's pretend I'm creating an Employee class, which I will later >> subclass for more specific jobs. Each instance will have stuff like a >> name, title, degrees held, etc. etc. >> >> So I'm won

Using vim in server mode with ipython

2006-09-28 Thread James Stroud
5. I called %edit from ipython At which point ipython took me to a new gvi window (and process). What am I not doing that doesn't seem to be in the instructions? James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.

Re: DAT file compilation

2006-09-29 Thread James Stroud
only to be downloaded when needed. This way, the user would at least have to reverse engineer your program to see where the resources were coming from so they could plug the appropriate query in their web browser. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570

Re: DAT file compilation

2006-09-29 Thread James Stroud
are using your program so much, that you'll probably be able to go ahead and buy your own hosting company. One python hosting company offers 50GB/mo bandwidth for $7.50/mo. Google "python hosting" and you'll find them. That's hella usage of a program. James -- James S

Re: MySQLdb for Python 2.5

2006-09-30 Thread James Stroud
Harold Trammel wrote: > Hi everyone, > > Does anyone know the status of a version of MySQLdb that will work with > Python 2.5? I will accept a workaround if you know one. Thanks in > advance. > > Harold Trammel I could not find a way around this requirement, but you will want to manually ad

Re: ruby %w equivalent

2006-09-30 Thread James Stroud
hg wrote: > But today ? what is the cost of replacing %w("blah blah") by > Hi_I_Want_To_Split_The_String_That_Follows( "blah blah") The latter is beginning to look like the Cocoa/NextStep framework. Perhaps we should give up scripting languages for ObjC? James -- http://mail.python.org/mailman/

Re: loop over list and modify in place

2006-09-30 Thread James Stroud
b,'value',v+5) for (v,b) in enumerate(alist)] [None, None, None, None, None] py> alist [: 5, : 6, : 7, : 8, : 9] py> map(setattr, alist, ['value']*5, xrange(5)) [None, None, None, None, None] py> alist [: 0, : 1, : 2, : 3, : 4] -- James Stroud UCLA-DOE Institute for

Re: loop over list and modify in place

2006-09-30 Thread James Stroud
John Machin wrote: > James Stroud wrote: > >>Daniel Nogradi wrote: >> >>>Is looping over a list of objects and modifying (adding an attribute >>>to) each item only possible like this? >>> >>>mylist = [ obj1, obj2, obj3 ] >>> >>&

Re: How to Catch 2 Exceptions at once?

2006-09-30 Thread James Stroud
ut the error? > py> try: ... raise ValueError, 'Illegal value for your shoe size!' ... except (IndexError, ValueError), e: ... print e ... Illegal value for your shoe size! -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 900

Re: question about scope

2006-09-30 Thread James Stroud
k(self, some_value): ... self.value = some_value ... py> C.value 42 py> c1 = C() py> c1.value 42 py> c2 = C() py> c2.value 42 py> c2.separate_from_pack(88) py> c2.value 88 py> C.value 42 py> c3 = C() py> c3.value 42 James -- James Stroud UCLA-DOE Institu

Re: how to reuse class deinitions?

2006-10-01 Thread James Stroud
path/to/Code" in it. 5. Open a new shell so the $PYTHONPATH gets set correctly for your rc file. 6. Now, start python in that shell and import your packages. Congratulations! You have now setup an environment where all the code you write becomes packages and re-usable. Why a similar

Re: strange append

2006-10-01 Thread James Stroud
x[1] += 1# shorthand print "newx = %s" % newx# basic formatting print "res = %s" % res # should be what you expect James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: strange append

2006-10-02 Thread James Stroud
sense: res = [] for i in xrange(1,7): res.append([1,i]) James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with an array problem.

2006-10-02 Thread James Stroud
hich gives an overflow message > So can't I truncate the long by discaring the upper bits .. > Like b[0] = 0x & a[0] > > How does one normally cast an object from long to short? Take the modulo 65536? py> array.array('H', (array.array('L&#x

py2app console

2006-10-03 Thread James Stroud
Hello, Does anyone know of the most straightforward way to get rid of the intensely annoying "console" window that py2app feels so compelled to create? On a related but less important note, why would anyone want that stupid window in the first place? James -- http://mail.python.org/mailman/l

Re: py2app console

2006-10-03 Thread James Stroud
James Stroud wrote: > Hello, > > Does anyone know of the most straightforward way to get rid of the > intensely annoying "console" window that py2app feels so compelled to > create? > > On a related but less important note, why would anyone want that stup

Re: py2app console

2006-10-04 Thread James Stroud
Dave Opstad wrote: > In article <[EMAIL PROTECTED]>, > James Stroud <[EMAIL PROTECTED]> wrote: > >> Does anyone know of the most straightforward way to get rid of the >> intensely annoying "console" window that py2app feels so compelled to >

py2app semi-standalone semi-works

2006-10-04 Thread James Stroud
Hello All, I am trying to create a semi-standalone with the vendor python on OS X 10.4 (python 2.3.5). I tried to include some packages with both --packages from the command and the 'packages' option in setup.py. While the packages were nicely included in the application bundle in both cases (

Re: Python/Tkinter crash.

2006-10-04 Thread James Stroud
Hendrik van Rooyen wrote: > Hi, > > I get the following: > > [EMAIL PROTECTED]:~/Controller/lib> python display.py > UpdateStringProc should not be invoked for type font > Aborted > > and I am back at the bash prompt - this is most frustrating, as there is no > friendly traceback to help me gues

Re: Why not just show the out-of-range index?

2006-12-03 Thread James Stroud
rmine that information for yourself when it could save you a step > and just tell you? This seems like a "no-brainer" to me. Am I missing > something? > I think you have a point. I am curious to see how far people are willing to go to defend this omission. It promises to be en

Re: A mail from Steve Ballmer. See what Microsoft will do and follow.

2006-12-03 Thread James Stroud
JustStand wrote: > For detail, view http://www.homeoftester.com/viewtopic.php?t=281 > __ > I have a dream, I hope I can be as strong as Enter key. Does this pointless blogvertisement in anyway compensate for the fact that windows sucks so hard? James

Re: Why not just show the out-of-range index?

2006-12-04 Thread James Stroud
Russ wrote: > Fredrik Lundh wrote: > > >>>Sorry I haven't thought this through 100% >> >>obviously not. > > > > And you didn't like the "tone" of some of my earlier posts? > Some people consider themselves above a sensi

Re: skip last line in loops

2006-12-14 Thread James Stroud
[EMAIL PROTECTED] wrote: > hi, > how can i skip printing the last line using loops (for /while) > > eg > > for line in open("file): > print line. > > I want to skip printing last line of the file.thanks > afile = open(filename) xlines = afile.xreadlines() aline = xlines.next for nextlin

Re: skip last line in loops

2006-12-14 Thread James Stroud
James Stroud wrote: > [EMAIL PROTECTED] wrote: >> hi, >> how can i skip printing the last line using loops (for /while) >> >> eg >> >> for line in open("file): >> print line. >> >> I want to skip printing last line

Re: skip last line in loops

2006-12-15 Thread James Stroud
[EMAIL PROTECTED] wrote: > Fredrik Lundh wrote: >> [EMAIL PROTECTED] wrote: >> >>> how can i skip printing the last line using loops (for /while) >>> >>> eg >>> >>> for line in open("file): >>> print line. >>> >>> I want to skip printing last line of the file. >> do it lazily: >> >> last_

Re: skip last line in loops

2006-12-15 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: > >> See the documentation for xreadlines. > > why? > > > > > 5.16 xreadlines -- Efficient iteration over a file -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple.index()

2006-12-15 Thread James Stroud
ng from its position and make inferences about the tuple object searched, /philosophically/ speaking? Or is the logic conveniently one-way? James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.

<    1   2   3   4   5   6   7   8   9   10   >