Re: [Tutor] Passing perimeters in dictionary values?

2009-02-25 Thread spir
Le Wed, 25 Feb 2009 00:01:49 -, "Alan Gauld" s'exprima ainsi: > > "nathan virgil" wrote > > > I'm not familiar with lambdas yet, and I don't think this book will > > introduce me to them; they aren't listed in the index, anyway. > > lambda is just a fancy mathematical name for a simple

Re: [Tutor] Passing perimeters in dictionary values?

2009-02-25 Thread Andre Engels
On Wed, Feb 25, 2009 at 2:32 AM, nathan virgil wrote: > Erm, it's still not working... > > Whenever I try to use the talk method (which reports the mood, and doesn't > take parameters), it says I gave it too many parameters. Maybe it might help > if I posted the code in it's entirety > > > # C

Re: [Tutor] Passing perimeters in dictionary values?

2009-02-25 Thread Alan Gauld
"nathan virgil" wrote Whenever I try to use the talk method (which reports the mood, and doesn't take parameters), it says I gave it too many parameters. Sorry, I should have pointed out that you will need to redefine all your functions to accept a parameter. Alan G ___

[Tutor] overwriting input file

2009-02-25 Thread Bala subramanian
Hello all, query 1) How should i overwrite the input file I want to open 5 files one by one, do some operation on the lines and write the modified lines on the same file (overwritting). Can some please tell me how to do it. pat1=" R" pat2="U5" pat3="A3" from sys import argv files=argv[1:] for nam

[Tutor] re Formating

2009-02-25 Thread prasad rao
hi >>> licenseRe = re.compile(r'\(([A-Z]+)\)\s*(No.\d+)?') >>> for license in licenses: m = licenseRe.search(license) print m.group(1, 3) Traceback (most recent call last): File "", line 3, in print m.group(1, 3) IndexError: no such group Something wrong with this code. _

Re: [Tutor] overwriting input file

2009-02-25 Thread A.T.Hofkamp
Bala subramanian wrote: Hello all, query 1) How should i overwrite the input file I want to open 5 files one by one, do some operation on the lines and write the modified lines on the same file (overwritting). Can some please tell me how to do it. You cannot write output to a file if you need

[Tutor] Formatting

2009-02-25 Thread prasad rao
hi for license in licenses: m = licenseRe.search(license) print m.group(1, 2) ('ABTA', 'No.56542') ('ATOL', None) ('IATA', None) ('ITMA', None) Yes It is working Thank you Prasad ___ Tutor maillist - Tutor@python.org http://mail.python.or

Re: [Tutor] overwriting input file

2009-02-25 Thread Noufal Ibrahim
Bala subramanian wrote: Hello all, query 1) How should i overwrite the input file I want to open 5 files one by one, do some operation on the lines and write the modified lines on the same file (overwritting). Can some please tell me how to do it. import fileinput pat1=" R" pat2="U5" pat3="A

Re: [Tutor] overwriting input file

2009-02-25 Thread Noufal Ibrahim
A.T.Hofkamp wrote: write the output to a temporary file while reading the input, then rename the temporary file. This I believe is what the fileinput module does when you use it with the inplace parameter set to 1. -- ~noufal http://nibrahim.net.in/

Re: [Tutor] re Formating

2009-02-25 Thread Kent Johnson
On Wed, Feb 25, 2009 at 7:46 AM, prasad rao wrote: > hi licenseRe = re.compile(r'\(([A-Z]+)\)\s*(No.\d+)?') for license in licenses: >       m = licenseRe.search(license) >       print m.group(1, 3) > > Traceback (most recent call last): >   File "", line 3, in >     print m.group(1, 3)

Re: [Tutor] overwriting input file

2009-02-25 Thread Kent Johnson
On Wed, Feb 25, 2009 at 8:26 AM, Noufal Ibrahim wrote: > Bala subramanian wrote: >> >> Hello all, >> >> query 1) How should i overwrite the input file >> I want to open 5 files one by one, do some operation on the lines and >> write the modified lines on the same file (overwritting). Can some plea

Re: [Tutor] Standardizing on Unicode and utf8

2009-02-25 Thread Thorsten Kampe
* Dinesh B Vadhia (Fri, 20 Feb 2009 02:52:27 -0800) > We want to standardize on unicode and utf8 Very good idea. > and would like to clarify and verify their use to minimize encode > ()/decode()'ing: > > 1. Python source files > Use the header: # -*- coding: utf8 -*- Good idea (although only

Re: [Tutor] Standardizing on Unicode and utf8

2009-02-25 Thread Thorsten Kampe
* spir (Fri, 20 Feb 2009 13:02:59 +0100) > Le Fri, 20 Feb 2009 02:52:27 -0800, > "Dinesh B Vadhia" s'exprima ainsi: > > > We want to standardize on unicode and utf8 and would like to clarify and > > verify their use to minimize encode()/decode()'ing: > > > > 1. Python source files > > Use the

Re: [Tutor] Add readline capabilities to a Python build 2.6 on Ubuntu

2009-02-25 Thread Thorsten Kampe
* Eric Dorsey (Thu, 19 Feb 2009 12:24:07 -0700) > Still doesnt work.. I just get this when I hit the up arrow:>>> ^[[A > > Bah. It works in the 2.5 version that came packaged with it. Thanks for > trying :) There's a log for the ./configure. See if the configure script can find readline. Thorst

Re: [Tutor] overwriting input file

2009-02-25 Thread Alan Gauld
"Bala subramanian" wrote query 1) How should i overwrite the input file I want to open 5 files one by one, do some operation on the lines and write the modified lines on the same file (overwritting). Can some please tell me how to do it. You don't really want to do that! Too risky. Better

Re: [Tutor] Standardizing on Unicode and utf8

2009-02-25 Thread Kent Johnson
On Wed, Feb 25, 2009 at 12:46 PM, Thorsten Kampe wrote: > * spir (Fri, 20 Feb 2009 13:02:59 +0100) >> > Use the header: # -*- coding: utf8 -*- >> >> You don't even need fancy decoration: >> >> # coding: utf-8 >> >> is enough. > > Sure? Never heard of that. Interesting... >From PEP 263 (http://ww

Re: [Tutor] overwriting input file

2009-02-25 Thread Kent Johnson
On Wed, Feb 25, 2009 at 1:53 PM, Alan Gauld wrote: > > "Bala subramanian" wrote > >> query 1) How should i overwrite the input file >> I want to open 5 files one by one, do some operation on the lines and >> write >> the modified lines on the same file (overwritting). Can some please tell >> me >

Re: [Tutor] Accessing callers context from callee method

2009-02-25 Thread mobiledreamers
i found the solution This is my first attempt at memcaching html page using cheetah since cheetah render needs locals() i use getCallerInfo() to get the locals() and send to memcached let me know if it is possible to better do this *notice getCallerInfo * *utils.py* @log_time_func def renderpage(k

Re: [Tutor] Accessing callers context from callee method

2009-02-25 Thread mobiledreamers
i found the solution This is my first attempt at memcaching html page using cheetah since cheetah render needs locals() i use getCallerInfo() to get the locals() and send to memcached let me know if it is possible to better do this *notice getCallerInfo * *utils.py* @log_time_func def renderpage(k

Re: [Tutor] Add readline capabilities to a Python build 2.6 on Ubuntu

2009-02-25 Thread Lie Ryan
On Thu, 19 Feb 2009 09:27:34 +0300, زياد بن عبدالعزيز الباتلي wrote: > On Wed, 18 Feb 2009 20:19:56 -0700 > Eric Dorsey wrote: >> I did an aptitute install of ibreadline5-dev and then did ./configure >> and make again, and still don't have any functionality to be able to >>

Re: [Tutor] Add readline capabilities to a Python build 2.6 on Ubuntu

2009-02-25 Thread Eric Dorsey
Thanks for all your continued insights on this. I'm going to investigate the .configure log, as well as look around at other readline packages.. But, noob question, did you just go into something like synaptic to find out what readline type packages are installed? (Sorry if this is annoying anyone

Re: [Tutor] Add readline capabilities to a Python build 2.6 on Ubuntu

2009-02-25 Thread Lie Ryan
On Wed, 2009-02-25 at 22:23 -0700, Eric Dorsey wrote: > Thanks for all your continued insights on this. I'm going to > investigate the .configure log, as well as look around at other > readline packages.. But, noob question, did you just go into something > like synaptic to find out what readline t

[Tutor] how to instantiate a class

2009-02-25 Thread Abhishek Kumar
hello list, Below is the sample code of a class. import Class ABC: def __init__(self,a,b,c): statement 1 statement 2 def func(x,y): statement 1 state

Re: [Tutor] how to instantiate a class

2009-02-25 Thread Lie Ryan
On Thu, 26 Feb 2009 12:38:27 +0530, Abhishek Kumar wrote: > hello list, > You need to read through the tutorial first: http://docs.python.org/ tutorial/ If there are still things you don't understand, please ask again. As for your question, here is a sample useless python code: class MyClass(

Re: [Tutor] how to instantiate a class

2009-02-25 Thread Lie Ryan
On Thu, 26 Feb 2009 12:38:27 +0530, Abhishek Kumar wrote: > hello list, > You need to read through the tutorial first: http://docs.python.org/ tutorial/ If there are still things you don't understand, please ask again. As for your question, here is a sample useless python code: class MyClass(

Re: [Tutor] how to instantiate a class

2009-02-25 Thread Arun Tomar
@Abhishek, On 2/26/09, Abhishek Kumar wrote: > hello list, > > Below is the sample code of a class. > > > import > > Class ABC: > def __init__(self,a,b,c): > statement 1 > statement 2 > def func(x,y): >

Re: [Tutor] how to instantiate a class

2009-02-25 Thread Moos Heintzen
Here is a good book if you are already familiar with other languages. http://diveintopython.org/object_oriented_framework/instantiating_classes.html ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor