Re: how to extract columns like awk $1 $5

2005-01-07 Thread Dan Valentine
On Fri, 07 Jan 2005 12:15:48 -0500, Anand S Bisen wrote: > Is there a simple way to extract words speerated by a space in python > the way i do it in awk '{print $4 $5}' . I am sure there should be some > but i dont know it. i guess it depends on how faithfully you want to reproduce awk's behav

Re: What could 'f(this:that=other):' mean?

2005-01-07 Thread Nick Coghlan
If the caller is meant to supply a namespace, get them to supply a namespace. def f(ns1, ns2): print ns1['a'], ns1['b'], ns2['a'], ns2['b'] f(ns1 = dict(a=1, b=2), ns2 = dict(a=3, b=4)) Hey, where's Steve? Maybe his generic objects should be called namespaces instead of bunches. . . def f(ns1,

Re: sorting on keys in a list of dicts

2005-01-07 Thread Nick Coghlan
Jeff Shannon wrote: Agreed. I'd started typing before I realized that it'd provide a stable sort, which pretty much answered my own question, but decided to send it anyhow in case I'd missed anything else... :) And it turns out we both missed the fact that it avoids comparing the dictionaries w

Re: Getting rid of "self."

2005-01-07 Thread Nick Coghlan
Roy Smith wrote: It's actually kind of neat, but boy does it play headgames with me when I switch back and forth between that and Python. Switching back and forth betwen C++ and Python plays headgames *anyway* }:> Cheers, Nick. Hardware control with Python is nice. . . -- Nick Coghlan | [EMAIL

Re: how to extract columns like awk $1 $5

2005-01-07 Thread Roy Smith
Dan Valentine <[EMAIL PROTECTED]> wrote: > On Fri, 07 Jan 2005 12:15:48 -0500, Anand S Bisen wrote: > > > Is there a simple way to extract words speerated by a space in python > > the way i do it in awk '{print $4 $5}' . I am sure there should be some > > but i dont know it. > > i guess it dep

Here is $50 for signing up free

2005-01-07 Thread me to you
Hello, I'm trying out a new auto poster, and dont know how to use it very good, so if this end up in the wrong places, please forgive me, and disreguard, sorry for your incovenience, but everyone else, ENJOY!! KEEP READING TO GET YOUR $50.00 NOW!!! This is not spam, it is a legi

Re: Help uninstalling/installing Python 2.4

2005-01-07 Thread Craig Ringer
On Sat, 2005-01-08 at 08:08, Baggs wrote: > Tk calls did not work, the output from Python when running a program > stated that I probably did not have TK installed. I got and installed > TK 8.4 and the problem persisted (I know I should have written down the > exact error, but I didn't... but

Re: how to extract columns like awk $1 $5

2005-01-07 Thread Carl Banks
Roy Smith wrote: > Hmmm. There's something going on here I don't understand. The ref > manual (3.3.5 Emulating container types) says for __getitem__(), "Note: > for loops expect that an IndexError will be raised for illegal indexes > to allow proper detection of the end of the sequence." I expec

Re: python3: 'where' keyword

2005-01-07 Thread Nick Coghlan
Andrey Tatarinov wrote: Hi. It would be great to be able to reverse usage/definition parts in haskell-way with "where" keyword. Since Python 3 would miss lambda, that would be extremly useful for creating readable sources. Usage could be something like: >>> res = [ f(i) for i in objects ] where

Re: sorting on keys in a list of dicts

2005-01-07 Thread Carl Banks
Jeff Shannon wrote: > Jp Calderone wrote: > > > L2 = [(d[key], i, d) for (i, d) in enumerate(L)] > > L2.sort() > > L = [d for (v, i, d) in L2] > > Out of curiosity, any reason that you're including the index? I'd > have expected to just do > > L2 = [(d[key], d) for d in L] >

_tkinter problem

2005-01-07 Thread Jatinder Singh
Hi I am running a script which is importing tkinter  from "/usr/local/lib/python2.3/lib-tk/Tkinter.py" and generating an error " import _tkinter ImportError: No module named _tkinter "   can anybody tell me what is it? and how to get away with it?   -- http://mail.python.org/mailman/listin

Re: python3: 'where' keyword

2005-01-07 Thread Paul Rubin
Nick Coghlan <[EMAIL PROTECTED]> writes: > > Usage could be something like: > > >>> res = [ f(i) for i in objects ] where: > > >>> def f(x): > > >>> #do something > > Hmm, this is actually a really interesting idea. Avoiding accidental > namespace conflicts is certainly one of the a

Re: switching an instance variable between a property and a normal value

2005-01-07 Thread Nick Coghlan
Steven Bethard wrote: I'd like to be able to have an instance variable that can sometimes be accessed as a property, and sometimes as a regular value, e.g. something like: If you want the behaviour to be switchable per-instance, you have to go the route of always running through the property mac

Re: python3: 'where' keyword

2005-01-07 Thread Nick Coghlan
Nick Coghlan wrote: It also allows the necessary but uninteresting setup for an expression to be moved "out of the way", bringing the expression that does the real work to prominence. Killer app for this keyword: class C(object): x = property(get, set) where: def get(self): return "Si

Re: python3: 'where' keyword

2005-01-07 Thread Nick Coghlan
Paul Rubin wrote: the suite has its own scope so any variable created there is local to the suite plus the following statement. The scope vanishes after the statement. The second part of the idea is to give the statement greater prominence and 'hide' the uninteresting setup (the contents of the w

Re: switching an instance variable between a property and a normal value

2005-01-07 Thread Nick Coghlan
Steven Bethard wrote: where I also accept *args and **kwds when the default value is to be called. It's certainly doable with a flag, but note that I have to check the flag every time in both __getitem__ and setdefault. Alternatively, always use a function for the default value, and set _func to

Re: python3: 'where' keyword

2005-01-07 Thread michele . simionato
> But we're talking about the mythical/hypothetical Python 3, so maybe > there's a chance of fixing the scoping rules, which it seems to me are > currently pretty badly broken. I don't think the current scoping rules will be changed in Python 3.0. I can't give you the link right now, but there ar

Re: _tkinter problem

2005-01-07 Thread Craig Ringer
On Sat, 2005-01-08 at 14:30, Jatinder Singh wrote: > Hi > I am running a script which is importing tkinter from > "/usr/local/lib/python2.3/lib-tk/Tkinter.py" and generating an error > " import _tkinter > ImportError: No module named _tkinter " > > can anybody tell me what is it? and how to get

How to read/write blobs with mysqldb?

2005-01-07 Thread Christopher J. Bottaro
First off, writing the blob. From what I gather on the internet, I'm suppose to read the entire file into memory (a Python string), then create a dbiRaw object with that string and use the dbiRaw object in an insert statement? That doesn't sound very efficient to me. What if my computer only has

Re: Raw Sockets vs. What?

2005-01-07 Thread Matt
Just thought I'd follow up to say that I'm using XML-RPC after all. Not that I was intimidated when I finally learned that Fredrik had written the thing. No, it was more the issue that we want to write a php debugger next and XML-RPC plays well with php, too. Thanks again, --Matt -- http://mail.p

vi and python

2005-01-07 Thread km
Hi all, Is there a way to display inbuilt function syntax as the user starts typing a function name with 'Vi' editor in console mode? tia, KM -- http://mail.python.org/mailman/listinfo/python-list

Re: Software archeology (was Re: Developing Commercial Applications in Python)

2005-01-07 Thread Stephen Waterbury
Aahz wrote: In article <[EMAIL PROTECTED]>, Stephen Waterbury <[EMAIL PROTECTED]> wrote: Aahz wrote: In article <[EMAIL PROTECTED]>, Stephen Waterbury <[EMAIL PROTECTED]> wrote: Also see Python Success Stories: http://pythonology.org/success A notable example is Verity's search engine -- see htt

<    1   2   3