Re: [Tutor] Replying to the tutor-list

2007-02-16 Thread Tim Golden
Alan Gauld wrote: > But its obvious there are two views at work here. (The one which sees an apostrophe in "it's" and the one which doesn't? ;) But, joking aside, I think you've summarised the situation quite well, and I suspect that -- given the what must be thousands of mailing lists and newsgr

Re: [Tutor] Replying to the tutor-list

2007-02-16 Thread Alan Gauld
"Luke Paireepinart" <[EMAIL PROTECTED]> wrote > It's not the inconvenience but the fact that it's nonstandard, as > far as > every mailing list i've been on except this. It is interesting to see this thread because its a hot button of mine that many new mailing lists implement this non standard

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Terry Carroll
On Thu, 15 Feb 2007, Bill Campbell wrote: > Having the Reply-To: to the original poster minimizes the probability of > somebody sending mail to a list that was intended for the original poster > (which may be private). Well, no. It minimizes the probability of someone sending mail to a list.

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Bill Campbell
On Thu, Feb 15, 2007, Luke Paireepinart wrote: >Bill Campbell wrote: >> The major reason for not setting Reply-To: thelist is that it makes it >> *SLIGHTLY* more difficult to post something to the list and replys should >> go to the sender. IHMO, one should have to go to a little bit of effort >>

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Luke Paireepinart
Bill Campbell wrote: > The major reason for not setting Reply-To: thelist is that it makes it > *SLIGHTLY* more difficult to post something to the list and replys should > go to the sender. IHMO, one should have to go to a little bit of effort > before posting a message that may go to thousands of

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Bill Campbell
The major reason for not setting Reply-To: thelist is that it makes it *SLIGHTLY* more difficult to post something to the list and replys should go to the sender. IHMO, one should have to go to a little bit of effort before posting a message that may go to thousands of recipients. Using the ``mut

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Andre Engels
2007/2/15, ALAN GAULD <[EMAIL PROTECTED]>: > realize I sent it to the sender instead of the list, > so I send a second message after it. So do you find it odd when dealing with normal email and you hit reply and it only goes to the sender? No, because it is sent by the sender to me, not to

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Richard Querin
On 2/15/07, Alan Gauld <[EMAIL PROTECTED]> wrote: I dunno about you but 95% of my email is private, only about 5% comes from mailing lists. Yeah, me too, but I guess it seems easier to just hit 'reply' 100% of the time and have it go to the right recipient. My point really was that 95% of t

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Alan Gauld
"Richard Querin" <[EMAIL PROTECTED]> wrote >> >> > The following tutor faq has an explanation: >> > >> > http://www.python.org/infogami-faq/tutor/tutor-why-do-my-replies-go-to-t >> > he-person-who-sent-the-message-and-not-to-the-list/ > > It seems like this is designed for the 5% case when it makes

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Richard Querin
On 2/14/07, Mike Hansen <[EMAIL PROTECTED]> wrote: > The following tutor faq has an explanation: > > http://www.python.org/infogami-faq/tutor/tutor-why-do-my-replies-go-to-t > he-person-who-sent-the-message-and-not-to-the-list/ It seems like this is designed for the 5% case when it makes th

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Rikard Bosnjakovic
On 2/14/07, Mike Hansen <[EMAIL PROTECTED]> wrote: > The following tutor faq has an explanation: > > http://www.python.org/infogami-faq/tutor/tutor-why-do-my-replies-go-to-t > he-person-who-sent-the-message-and-not-to-the-list/ I think the argument in that "explanation" sucks. A asks something,

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Rikard Bosnjakovic
On 2/15/07, Andre Engels <[EMAIL PROTECTED]> wrote: > It's getting to be the majority of mailing lists that do it the other way, > and I find it quite irritating that this list does not - I have had several > times that I sent a mail, and after sending it, sometimes long after sending > it, I real

Re: [Tutor] Replying to the tutor-list

2007-02-15 Thread Andre Engels
2007/2/14, Alan Gauld <[EMAIL PROTECTED]>: Because hitting Reply and sending to a list would only be consistent if the list was the originator of the message. Some mailing lists do implement this bizarre and non-standard email behaviour but thankfully the Python community doesn't! This behaviour

Re: [Tutor] Replying to the tutor-list

2007-02-14 Thread Terry Carroll
> recipient at all times? I also prefer that, but it's a matter of taste, and this lists tastes don't run that way. I use procmail to add a Reply-To: header, and then dump the email into my separate Python in-box: # Python tutor list :0: * [EMAIL PROTECTED] { :0hf | $

Re: [Tutor] Replying to the tutor-list

2007-02-14 Thread Alan Gauld
"Rikard Bosnjakovic" <[EMAIL PROTECTED]> wrote > All texts that I reply to this list are automatically sent to the > author, or - by selecting "Reply all" in my mail client - the > tutorlist gets a CC. Yep, that makes sense. It's how mail tools work in a sane world. You Reply and it goes to the

Re: [Tutor] Replying to the tutor-list

2007-02-14 Thread J or M Montgomery
7 in a Linux box. There are 'Reply' and 'Reply all' options. when I send a message using 'Reply" it goes only to the Tutor List. Using the 'Reply all" choice it goes to the prior poster with a copy to the list. John Montgomery _

Re: [Tutor] Replying to the tutor-list

2007-02-14 Thread Dave Kuhlman
On Wed, Feb 14, 2007 at 05:20:44PM +0100, Rikard Bosnjakovic wrote: > Why is there no reply-to-tag in all the posts, making the list > recipient at all times? Believe it or not -- The email reader that I use (mutt on a FreeBSD machine that I telnet/ssh into) has a reply-to-list operation. That's

Re: [Tutor] Replying to the tutor-list

2007-02-14 Thread Mike Hansen
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Rikard Bosnjakovic > Sent: Wednesday, February 14, 2007 9:21 AM > To: tutor@python.org > Subject: [Tutor] Replying to the tutor-list > > All texts that I reply to this lis

[Tutor] Replying to the tutor-list

2007-02-14 Thread Rikard Bosnjakovic
All texts that I reply to this list are automatically sent to the author, or - by selecting "Reply all" in my mail client - the tutorlist gets a CC. Why is there no reply-to-tag in all the posts, making the list recipient at all times? -- - Rikard. __

Re: [Tutor] List to dictionary

2006-12-07 Thread Kent Johnson
Luke Paireepinart wrote: > How about this :D > > # Remove duplicates from a list: L = [1,2,2,3,3,3] [x for x in L if x not in locals()['_[1]'].__self__] > [1,2,3] > > [accessed at > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204297 ] The problems with this are, it is not

Re: [Tutor] List to dictionary

2006-12-07 Thread Luke Paireepinart
Dick Moores wrote: > At 09:53 PM 12/6/2006, Luke Paireepinart wrote: >> # Remove duplicates from a list: >> >>> L = [1,2,2,3,3,3] >> >>> [x for x in L if x not in locals()['_[1]'].__self__] >> [1,2,3] > > Why not > >>> L = [1,2,2,3,3,3] > >>> list(set(L)) > [1, 2, 3] Because the other methods (via

Re: [Tutor] List to dictionary

2006-12-06 Thread Dick Moores
At 09:53 PM 12/6/2006, Luke Paireepinart wrote: > >> I have a list of names (Names[]) and want to remove duplicate names in > >> the list. [snip] > >> > > > > The way I usually do this is something like: > > > > outDict = dict(map(lambda x: (x, 1), inList)) > > names = outDict.keys() > > names.so

[Tutor] List to dictionary

2006-12-06 Thread Morpheus
I'm new to programming, and trying to learn the Python language. The following code does what I want it to do, but I have not idea how it works. def scanList(names,temp): for i in names: temp[i] = 0 print temp Names = [] temp = {} I have a list of names (Names[]) and want to

Re: [Tutor] List to dictionary question

2006-12-06 Thread Mike Hansen
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Morpheus > Sent: Wednesday, December 06, 2006 9:00 AM > To: tutor@python.org > Subject: [Tutor] List to dictionary question > > I'm new to programming, and trying

[Tutor] List to dictionary question

2006-12-06 Thread Morpheus
I'm new to programming, and trying to learn the Python language. The following code does what I want it to do, but I have not idea how it works. def scanList(names,temp): for i in names: temp[i] = 0 print temp Names = [] temp = {} I have a list of names (Names[]) and want to

Re: [Tutor] List manipulation

2006-09-15 Thread Srinivas Iyyer
Dear Kent and Bob, thank you for your solutions. It helped, however, based on your suggestions, I intended to solve a chromosome walking problem. I posted my question on subject name: 'Limitation of range() function in Walking problem'. Thanks again. Sri --- Kent Johnson <[EMAIL PROTECTED]> wro

Re: [Tutor] List manipulation

2006-09-14 Thread Kent Johnson
Srinivas Iyyer wrote: > Thank you Bob for your email. > Sorry for the confusion. > here is what I ment: > > test = ['10\t15', '16\t20', '25\t35', '45\t50', > '55\t60', '61\t65', '75\t80'] >>> I would get: >>> 10 20 >>> 25 35 >>> 45 50 >>> 55 65 >>> 75 80 Here is my take

Re: [Tutor] List manipulation

2006-09-13 Thread Bob Gailer
try this: >>> test = ['10\t15', '16\t20', '25\t35', '45\t50','55\t60', '61\t65', '75\t80'] >>> t='\t'.join(test).split('\t') >>> t ['10', '15', '16', '20', '25', '35', '45', '50', '55', '60', '61', '65', '75', '80'] >>> t2=[int(i) for i in t] >>> t2 [10, 15, 16, 20, 25, 35, 45, 50, 55, 60,

Re: [Tutor] List manipulation

2006-09-13 Thread Srinivas Iyyer
Thank you Bob for your email. Sorry for the confusion. here is what I ment: test = ['10\t15', '16\t20', '25\t35', '45\t50', '55\t60', '61\t65', '75\t80'] >>> x = [] >>> y = [] >>> for m in test: ... cols = m.split('\t') ... x.append(cols[0]) ... y.append(cols[1]) ... >>> x ['10', '

Re: [Tutor] List manipulation

2006-09-13 Thread Bob Gailer
Srinivas Iyyer wrote: > Dear group: > > I have a data like this: > 10 15 > 16 20 > 25 35 > 45 50 > 55 60 > 61 65 > 75 80 > > Since 15 precedes 16, I want to consider 10:20 as one > unit. If I repeat completely for data > > I would get: > 10 20 > 25 35 >

[Tutor] List manipulation

2006-09-13 Thread Srinivas Iyyer
Dear group: I have a data like this: 10 15 16 20 25 35 45 50 55 60 61 65 75 80 Since 15 precedes 16, I want to consider 10:20 as one unit. If I repeat completely for data I would get: 10 20 25 35 45 50 55 65 75 80 test = ['10\t15', '1

Re: [Tutor] List Box binding

2006-07-19 Thread Michael Lange
On Wed, 19 Jul 2006 06:45:36 -0400 Kent Johnson <[EMAIL PROTECTED]> wrote: > Joe Cox wrote: > > I am using Tk and have a series of Radio buttons that I want to bind > > to it's own listbox for further selection. > > I just don't get the point how to click the button and select the > > proper lis

Re: [Tutor] List Box binding

2006-07-19 Thread Kent Johnson
Joe Cox wrote: > I am using Tk and have a series of Radio buttons that I want to bind > to it's own listbox for further selection. > I just don't get the point how to click the button and select the > proper listbox I want it tied too. Do you mean you want clicking on the radio button to enable a

[Tutor] List Box binding

2006-07-19 Thread Joe Cox
I am using Tk and have a series of Radio buttons that I want to bind to it's own listbox for further selection. I just don't get the point how to click the button and select the proper listbox I want it tied too. Joe Cox513-293-4830 mobile[EMAIL PROTECTED]   ___

Re: [Tutor] List methods/comps Best Practices

2006-04-03 Thread stv
> So don't write: > [adds.add_changes('foo', path) for path in filelist] > but: > for path in filelist: adds.add_changes('foo', path) Excellent point; new toy, got carrid away :) I feel silly on that one. And now that I've made the return list.extend(foo) mistake, I'll surely neve- ... er, wa

Re: [Tutor] List methods/comps Best Practices

2006-04-03 Thread Kent Johnson
stv wrote: > # return all changes, deletes first > return dels.extend(adds) > > Since extend returns None, I ran into a lot of not-iterable errors > when calling this code. So I fixed this with > > dels.extend(adds) > return dels > > And all is good, although it took way more head scratc

Re: [Tutor] List methods/comps Best Practices

2006-04-03 Thread Karl Pflästerer
On 3 Apr 2006, [EMAIL PROTECTED] wrote: > I had several list comprehensions that I was mucking with; these lists > are working on a simple subclass of the built-in list object. They > looked liked this: > > filelist = getFilesToAdd() > filelist2 = getFilesToDel() > > adds = MyList('foo') >

[Tutor] List methods/comps Best Practices

2006-04-03 Thread stv
I just thumped my head against the wall for a few hours on something, and I was wondering if it's just my green-ness in Python, or if I'm doing something unsavory. I had several list comprehensions that I was mucking with; these lists are working on a simple subclass of the built-in list object. T

Re: [Tutor] list packing

2006-02-27 Thread Kent Johnson
kevin parks wrote: > John, > > Thanks... i am liking this variation a tad more since it means i only > have to type the path in one place but it is akin to your second > one... i was (still am really) having a hard time understanding > how to apply path.join _and_ listdir sometimes list

Re: [Tutor] list packing

2006-02-27 Thread Kent Johnson
Sean Perry wrote: > os.path.join() is self-documenting. I find this to be a better reason to > use it than anything else. But then my code only ever runs on Unix of > some flavor. I'm not sure why you put in the comment about Unix - os.path.join() is the recommended way of joining paths portabl

Re: [Tutor] list packing

2006-02-27 Thread kevin parks
John, Thanks... i am liking this variation a tad more since it means i only have to type the path in one place but it is akin to your second one... i was (still am really) having a hard time understanding how to apply path.join _and_ listdir sometimes list comprehensions twist my brain b

Re: [Tutor] list packing

2006-02-26 Thread Sean Perry
John Fouhy wrote: > On 27/02/06, kevin parks <[EMAIL PROTECTED]> wrote: > >>snd = [f for f in os.listdir('/Users/kevin/snd/') if f.endswith('.aif')] > > > If this is all you need, then you could do something like: > > snd = ['/Users/kevin/snd/%s' % f for f in > os.listdir('/Users/kevin/snd/') i

Re: [Tutor] list packing

2006-02-26 Thread John Fouhy
On 27/02/06, kevin parks <[EMAIL PROTECTED]> wrote: > snd = [f for f in os.listdir('/Users/kevin/snd/') if f.endswith('.aif')] If this is all you need, then you could do something like: snd = ['/Users/kevin/snd/%s' % f for f in os.listdir('/Users/kevin/snd/') if f.endswith('.aif')] Or, slightly

[Tutor] list packing

2006-02-26 Thread kevin parks
howdy, I am using the os module to do some of my heavy lifting for me. I am tried of building lists by hand so i decided that i would get python to look in a bunch of directories and stuff all the things it find there into a list depending on it's extension. Works great ... one problem sometime

Re: [Tutor] list method help

2006-02-03 Thread Alan Gauld
> > You definitely have to stop thinking of variables as containers. They > > are pointers or references to values. Another way to think of this is > > that variables are names for things. > Kent that's a perfectly understandable and easy to grasp analogy. But it > stays just an analogy ;-) Nope.

Re: [Tutor] list method help

2006-02-03 Thread Danny Yoo
> > But this assignment sort of puzzles me to why it's done like this > > (maybe cuz I am not used to it and can not see beyond my own > > experience in coding (having a blind spot or something like that)). If we have a snippet of code like: ### def test(): x = [] f(x) print

Re: [Tutor] list method help

2006-02-03 Thread Kent Johnson
Rinzwind wrote: > On 2/3/06, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > You definitely have to stop thinking of variables as containers. They > are pointers or references to values. Another way to think of this is > that variables are names for things. You

Re: [Tutor] list method help

2006-02-03 Thread Rinzwind
On 2/3/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > On 2/3/06, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote:>>Others could give you a really good answer. I am a BASIC/FORTRAN writer >>myself, and getting used to the *object* orientation of python took a little >>while, but after you get the ha

Re: [Tutor] list method help

2006-02-03 Thread Kent Johnson
> On 2/3/06, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote: >>Others could give you a really good answer. I am a BASIC/FORTRAN writer >>myself, and getting used to the *object* orientation of python took a little >>while, but after you get the hang of it, it's not bad. In BASIC you think of >>var

Re: [Tutor] list method help

2006-02-03 Thread Rinzwind
On 2/3/06, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote: > Rinzwind wrote: > | Well Chris or Leslie Smith. > | > | This bit l[:]=l[-1:]+l[0:-1] I think is VERY elegant. When I saw this > | in your post I tought: DUH. > | I did the same with 1 line more but I am still new to python ;) > | > You'r

Re: [Tutor] list method help

2006-02-02 Thread Chris or Leslie Smith
| Hello, | was just trying to do something and tried the following code: | | list = ["1", "test", "1.5"] | | for x in list: | print list.pop(x) | | I get the following error: | | print list.pop(x) | TypeError: an integer is required | | Does this mean i can't use a for loop to po

Re: [Tutor] list method help

2006-02-02 Thread Danny Yoo
On Thu, 2 Feb 2006, Michael Haft wrote: > was just trying to do something and tried the following code: > > list = ["1", "test", "1.5"] > > for x in list: > print list.pop(x) > > I get the following error: > > print list.pop(x) > TypeError: an integer is required Hi Michael, Th

Re: [Tutor] list method help

2006-02-02 Thread Alan Gauld
> list = ["1", "test", "1.5"] > for x in list: > print list.pop(x) > > I get the following error: > > print list.pop(x) > TypeError: an integer is required > > Does this mean i can't use a for loop to pop things from a list? No it means pop takes an optional *index* as an argument. > list

[Tutor] list method help

2006-02-02 Thread Michael Haft
Hello, was just trying to do something and tried the following code: list = ["1", "test", "1.5"] for x in list: print list.pop(x) I get the following error: print list.pop(x) TypeError: an integer is required Does this mean i can't use a for loop to pop things from a list? or

Re: [Tutor] list.__init__()

2006-01-26 Thread Kent Johnson
Christopher Spears wrote: > What purpose does list.__init__() play in the piece of > code below? It's an incorrect call to the base class __init__() function. This does base class initialization on the current list. The correct call is list.__init__(self) By the way this list seems to be doin

[Tutor] list.__init__()

2006-01-26 Thread Christopher Spears
What purpose does list.__init__() play in the piece of code below? class Mylist(list): def __init__(self, value = []): list.__init__([]) self.concat(value) def concat(self, value): for x in value: if not x in s

Re: [Tutor] List-question

2005-12-19 Thread Terry Carroll
On Mon, 19 Dec 2005, Ed Singleton wrote: > On 19/12/05, Ed Singleton <[EMAIL PROTECTED]> wrote: > > > > list2 = list.copy() > > > > Slices create a copy, so a shortcut is: > > > > list2 = list[:] > > Sorry, you need to: > > from copy import copy > > before you can use copy. It should also be,

Re: [Tutor] List-question

2005-12-19 Thread Ed Singleton
On 19/12/05, Ed Singleton <[EMAIL PROTECTED]> wrote: > On 19/12/05, Øyvind <[EMAIL PROTECTED]> wrote: > > I have one function that finds some values. Then I want that function to > > find new values based on the values it found first. However, by just > > looping, it starts on an eternal job. > > >

Re: [Tutor] List-question

2005-12-19 Thread Ed Singleton
On 19/12/05, Øyvind <[EMAIL PROTECTED]> wrote: > I have one function that finds some values. Then I want that function to > find new values based on the values it found first. However, by just > looping, it starts on an eternal job. > > As illustrated in: > >>> list = [1,2,3] > >>> list2 = list > >

[Tutor] List-question

2005-12-19 Thread Øyvind
I have one function that finds some values. Then I want that function to find new values based on the values it found first. However, by just looping, it starts on an eternal job. As illustrated in: >>> list = [1,2,3] >>> list2 = list >>> list2 [1, 2, 3] >>> for i in list: ... print i ...

Re: [Tutor] List of class instances

2005-09-20 Thread Jan Eden
Hi, Orri Ganel wrote on 20.09.2005: >As a side-note, unless you're okay with only being able to access >those instance variables through the fields list (ie fields[0], >fields[1], fields[2]), you may want to actually name them first. Yes, I am fine with that - I actually prefer to have a sorted

Re: [Tutor] List of class instances

2005-09-20 Thread Orri Ganel
As a side-note, unless you're okay with only being able to access those instance variables through the fields list (ie fields[0], fields[1], fields[2]), you may want to actually name them first. Jan Eden wrote: >Hi, > >Jan Eden wrote on 20.09.2005: > > > >>Hi, >> >>I'd like to form a list of

Re: [Tutor] List of class instances

2005-09-20 Thread Kent Johnson
Jan Eden wrote: >>I'd like to form a list of class instances. The following does not work >>(TextfieldLong, Textarea, TextfieldShort etc being class names): >> >> fields = [ >> TextfieldLong(name='title', label='Seitentitel', value=''), >> Textarea(name='content', label='Inhalt', val

Re: [Tutor] List of class instances

2005-09-20 Thread Jan Eden
Hi, Jan Eden wrote on 20.09.2005: >Hi, > >I'd like to form a list of class instances. The following does not work >(TextfieldLong, Textarea, TextfieldShort etc being class names): > >fields = [ >TextfieldLong(name='title', label='Seitentitel', value=''), >Textarea(name='conte

[Tutor] List of class instances

2005-09-20 Thread Jan Eden
Hi, I'd like to form a list of class instances. The following does not work (TextfieldLong, Textarea, TextfieldShort etc being class names): fields = [ TextfieldLong(name='title', label='Seitentitel', value=''), Textarea(name='content', label='Inhalt', value=''), Shor

Re: [Tutor] New entry in the Tutor list - Question: Python and dbf files

2005-07-08 Thread Terry Carroll
On Fri, 8 Jul 2005, Alessandro Brollo wrote: > 1. Does a Python dbf reader/writer module exist > somewhere? A google on "python dbf" led me to a few promising leads: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715 http://www.fiby.at/dbfpy/ http://www.garshol.priv.no/download/so

[Tutor] New entry in the Tutor list - Question: Python and dbf files

2005-07-08 Thread Alessandro Brollo
I'm using Python 2.3 in Win32/WinXP context. I'm new at all to newsgroups and discussion lists; the first help I need, is how to learn "good-manner" use of such very effective, but time-consuming tools. My approach will be a "try-and-error" one; I encourage all of you to send me any suggestion/obs

Re: [Tutor] List of regular expressions

2005-06-22 Thread Danny Yoo
On Wed, 22 Jun 2005, Shidan wrote: > Hi I have a list of regular expression patterns like such: > > thelist = ['^594694.*','^689.*','^241.*', >'^241(0[3-9]|1[0145]|2[0-9]|3[0-9]|41|5[1-37]|6[138]|75|8[014579]).*'] > > > Now I want to iterate thru each of these like: > > for pattern in thelis

Re: [Tutor] List of regular expressions

2005-06-22 Thread Alan G
> for pattern in thelist: >regex=re.compile(pattern) >if regex.match('24110'): >the_pattern = pattern >. >. >sys.exit(0) > > but in this case it will pick thelist[2] and not the list[3] as I wanted to, > how can I have it pick the pattern that describes it be

Re: [Tutor] List of regular expressions

2005-06-22 Thread Ewald Ertl
Hi Shidan! on Wed, 22 Jun 2005 00:28:44 -0400 Shidan <[EMAIL PROTECTED]> wrote : - Shidan > Hi I have a list of regular expression patterns like such: Shidan > Shidan > thelist = ['^594694.*','^689.*','

[Tutor] List of regular expressions

2005-06-21 Thread Shidan
Hi I have a list of regular expression patterns like such: thelist = ['^594694.*','^689.*','^241.*','^241(0[3-9]|1[0145]|2[0-9]|3[0-9]|41|5[1-37]|6[138]|75|8[014579]).*'] Now I want to iterate thru each of these like: for pattern in thelist: regex=re.compile(pattern) if regex.match('24

Re: [Tutor] List processing

2005-06-01 Thread Alan G
> I have a load of files I need to process. Each line of a file looks > something like this: > > eYAL001C1 Spar 81 3419 4518 4519 2 1 > > So basically its a table, separated with tabs. What I need to do is make a > new file where all the entries in the table are those where the values in > columns

Re: [Tutor] List processing

2005-06-01 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi, > > I have a load of files I need to process. Each line of a file looks > something like this: > > eYAL001C1 Spar81 3419451845192 1 > > So basically its a table, separated with tabs. What I need to do is make a > new file whe

Re: [Tutor] List processing

2005-06-01 Thread Terry Carroll
On 1 Jun 2005 [EMAIL PROTECTED] wrote: > eYAL001C1 Spar81 3419451845192 1 > > So basically its a table, separated with tabs. What I need to do is make > a new file where all the entries in the table are those where the values > in columns 1 and 5 were present

Re: [Tutor] List processing

2005-06-01 Thread Danny Yoo
On 1 Jun 2005 [EMAIL PROTECTED] wrote: > I have a load of files I need to process. [text cut] > So basically its a table, separated with tabs. What I need to do is make > a new file where all the entries in the table are those where the values > in columns 1 and 5 were present as a pair more t

[Tutor] List processing

2005-06-01 Thread cgw501
Hi, I have a load of files I need to process. Each line of a file looks something like this: eYAL001C1 Spar81 3419451845192 1 So basically its a table, separated with tabs. What I need to do is make a new file where all the entries in the table are those

Re: [Tutor] List comprehensions

2005-03-24 Thread Karl Pflästerer
On 23 Mrz 2005, [EMAIL PROTECTED] wrote: > map is (probably) going to be removed in Python3000 :-( So it's > probably better to not get into the habit of using it. Au contraire. If enough people use it and are used using it the risk for `map' getting removed will be a lot lower. Furthermore t

Re: [Tutor] List comprehensions

2005-03-23 Thread Liam Clarke
Geez, that's pretty bad. I've got to stop playing with code when I'm tired. Thanks all. On Wed, 23 Mar 2005 20:24:32 -, Alan Gauld <[EMAIL PROTECTED]> wrote: > > Is there a way to apply multiple actions within one list > comprehension? > > Write a function? > > def foo(i): ># do stuf

Re: [Tutor] List comprehensions

2005-03-23 Thread Alan Gauld
> Is there a way to apply multiple actions within one list comprehension? Write a function? def foo(i): # do stuff to i return i [foo(i) for i in alist] Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tut

Re: [Tutor] List comprehensions

2005-03-23 Thread John Fouhy
Ryan Davis wrote: I think map is a little cleaner is some cases. Not sure if its more Pythonic, I'm still trying to figure out exactly what that means. map is (probably) going to be removed in Python3000 :-( So it's probably better to not get into the habit of using it. -- John. __

Re: [Tutor] List comprehensions

2005-03-23 Thread Kent Johnson
Liam Clarke wrote: Is there any guides to this (possibly obtuse) tool? http://docs.python.org/tut/node7.html#SECTION00714 http://www.amk.ca/python/2.0/index.html#SECTION00060 Kent ___ Tutor maillist - Tutor@python.org htt

Re: [Tutor] List comprehensions

2005-03-23 Thread Sean Perry
Liam Clarke wrote: Is there any guides to this (possibly obtuse) tool? Think of it this way. A list comprehension generates a new list. So, you should think about list comps whenever you have old_list -> new_list style behavior. There are two advantages to list comps over map: 1) a list comp can

RE: [Tutor] List comprehensions

2005-03-23 Thread Ryan Davis
lf Of Liam Clarke Sent: Wednesday, March 23, 2005 5:44 AM To: Tutor Tutor Subject: [Tutor] List comprehensions Hi, Is there a way to apply multiple actions within one list comprehension? i.e. instead of a = [] for i in x: i.pop(3) g = [ int(item) for item in i] a.append(g) Is there

Re: [Tutor] List comprehensions

2005-03-23 Thread Kent Johnson
Liam Clarke wrote: Hi, Is there a way to apply multiple actions within one list comprehension? i.e. instead of a = [] for i in x: i.pop(3) g = [ int(item) for item in i] a.append(g) You can nest list comps. Except for the pop, the above can be written a = [ [ int(item) for item in

[Tutor] List comprehensions

2005-03-23 Thread Liam Clarke
Hi, Is there a way to apply multiple actions within one list comprehension? i.e. instead of a = [] for i in x: i.pop(3) g = [ int(item) for item in i] a.append(g) Is there any guides to this (possibly obtuse) tool? Regards, Liam Clarke PS I can see how nested list comprehensio

[Tutor] Seek advise to code Re: Fw: Please submit to tutor list: dictionary update prob

2005-01-24 Thread Eri Mendz
Kent Johnson tds.net> writes: [snip] > You still aren't doing anything with newdic. The absence of 'newdic' in the > code > after 'read.close()' should be a clue > > I think you want to overwrite the saved dict, but with the new dict instead > of > with a filename string... Hi Kent, Firs

Re: [Tutor] Re: Fw: Please submit to tutor list: dictionary update prob

2005-01-21 Thread Jacob S.
Just one question... Why are you off the list? I see no point. If you want to stop getting the mail, you can change the options of your list account online... That's the only reason I see... Let's see -- reasons 1. Cost -- No, it's free 2. Security -- If you were subscribed to it once, it's too l

Re: [Tutor] Re: Fw: Please submit to tutor list: dictionary update prob

2005-01-20 Thread Kent Johnson
Eri Mendz wrote: Kent Johnson tds.net> writes: Jacob S. wrote: sorry to send this to you but if you may, kindly send to tutor list as im no longer subscribed. my problem is in the update dict portion: it just doesnt update regardless how many contacts i add. kindly advise where my mistake

[Tutor] Re: Fw: Please submit to tutor list: dictionary update prob

2005-01-20 Thread Eri Mendz
Kent Johnson tds.net> writes: > > Jacob S. wrote: > >> sorry to send this to you but if you may, kindly send to tutor list as im > >> no longer subscribed. my problem is in the update dict portion: it just > >> doesnt update regardless how many contact

[Tutor] OT: list as newsgroup (was: Please submit to tutor list: dictionary update prob)

2005-01-20 Thread Wolfram Kraus
Jacob S. wrote: Hi everyone, sent this on to the list as told to. cc to eri to verify my sending to list... ;-) Jacob dear jacob, sorry to send this to you but if you may, kindly send to tutor list as im no longer subscribed. my problem is in the update dict portion: it just doesnt update

Re: [Tutor] Fw: Please submit to tutor list: dictionary update prob

2005-01-19 Thread Kent Johnson
Jacob S. wrote: sorry to send this to you but if you may, kindly send to tutor list as im no longer subscribed. my problem is in the update dict portion: it just doesnt update regardless how many contacts i add. kindly advise where my mistake is or code gone wrong. the rest of the options i will

Re: [Tutor] Fw: Please submit to tutor list: dictionary update prob

2005-01-19 Thread Liam Clarke
nital if: There's a place to start, right there. On Wed, 19 Jan 2005 21:27:24 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > Hi everyone, sent this on to the list as told to. > cc to eri to verify my sending to list... > ;-) Jacob > > > dear jacob, > > > >

[Tutor] Fw: Please submit to tutor list: dictionary update prob

2005-01-19 Thread Jacob S.
Hi everyone, sent this on to the list as told to. cc to eri to verify my sending to list... ;-) Jacob dear jacob, sorry to send this to you but if you may, kindly send to tutor list as im no longer subscribed. my problem is in the update dict portion: it just doesnt update regardless how many

Re: [Tutor] List comprehensions

2005-01-13 Thread Bob Gailer
At 07:03 AM 1/13/2005, Blake Winton wrote: What about "x === item" Perhaps we should propose an extension to Python: Assignment Statement: name = [[name] = ] ... expression-list. The absence of a name would create an anonymous variable just as lambda creates anonymous functions. Reminds me of a

Re: [Tutor] List comprehensions

2005-01-13 Thread Kent Johnson
Blake Winton wrote: Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Does that mean that there are invalid expressions? I'd enjoy seeing an example. I suppose if it's an expressio

Re: [Tutor] List comprehensions

2005-01-13 Thread Blake Winton
Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Does that mean that there are invalid expressions? I'd enjoy seeing an example. I suppose if it's an expression, it must be valid,

Re: [Tutor] List comprehensions

2005-01-13 Thread Max Noel
On Jan 13, 2005, at 04:13, Bob Gailer wrote: I like Kent's response. foobar(item)/0 is a "valid" expression. It fits the grammar of expressions. The fact that it raises an exception does not make it an invalid expression. Consider foobar(item)/xyz. It is valid. If xyz == 0 then it will also rai

Re: [Tutor] List comprehensions

2005-01-12 Thread Bob Gailer
At 07:05 PM 1/12/2005, Kent Johnson wrote: I suppose if it's an expression, it must be valid, eh? Otherwise it's something else. At 06:41 PM 1/12/2005, Max Noel wrote: On Jan 13, 2005, at 01:13, Bob Gailer wrote: At 04:48 PM 1/12/2005, Kent Johnson wrote: If you mean for j to be a list of foobar(i

Re: [Tutor] List comprehensions

2005-01-12 Thread Kent Johnson
I suppose if it's an expression, it must be valid, eh? Otherwise it's something else. Bob Gailer wrote: At 04:48 PM 1/12/2005, Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Do

Re: [Tutor] List comprehensions

2005-01-12 Thread Max Noel
On Jan 13, 2005, at 01:13, Bob Gailer wrote: At 04:48 PM 1/12/2005, Kent Johnson wrote: If you mean for j to be a list of foobar(item) then use j=[foobar(item) for item in x] The first part of the list comp can be any valid expression. Does that mean that there are invalid expressions? I'd enjoy se

<    2   3   4   5   6   7   8   >