Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Wayne
On Sat, Sep 5, 2009 at 10:21 AM, kevin parks wrote: > > Then what you would want to do is map the data to the nearest value no? I guess it all depends on your desired level of precision! > For this particular hack, I am mostly getting useful values in the range > 30-85, so I am filtering out

Re: [Tutor] How to iterate through unicode string.

2009-09-05 Thread Lie Ryan
Dirk Wangsadirdja wrote: Hi allen (and perhaps this goes also for others), just a suggestion, maybe when we post a problem, we should also mention the python version that we use. Every new subscribers to the tutor mailing list are sent an email that contains this: """ Finally, when you do

Re: [Tutor] Help deciding between python and ruby

2009-09-05 Thread Luke Paireepinart
> ruby on the other is more 'implicit,' used more in web-apps (via ROR), > emphasizes code-readability/beauty, and is more flexible (i.e. has more than > one way of doing something). You mean people actually like ruby's syntax? I think Python's the prettiest language I've worked with syntacticall

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Mark Tolonen
"Douglas Philips" wrote in message news:9ee00578-6af7-4c6c-9968-af5f25a00...@mac.com... On 2009 Sep 5, at 12:22 PM, Mark Tolonen wrote: As a list comp: L=range(30,41) [{38:34,40:39}.get(n,n) for n in L] [30, 31, 32, 33, 34, 35, 36, 37, 34, 39, 39] True, that is terse, but IMHO has maint

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread kevin parks
Yeah the list seems flaky at the moment. Additionally, my query is an incredibly stupid one. But what you have works and represents an improvement over the unreadable kludge I was doing. Thanks to all who responded. cheers, k On Sep 6, 2009, at 12:26 AM, Douglas Philips wrote: On or ab

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread kevin parks
I can think of about 80 billion reasons why you would encounter data outside your grid, esp. if you aren't the original producer of the data. Imagine you are mapping something to color (RGB values) or you are doing a signification of volcanic activity or the big bang or the earth's magnetic

Re: [Tutor] Help deciding between python and ruby

2009-09-05 Thread kevin parks
1. go to the book store 2. pull a copy of learning ruby by Michael Fitzgerald (ora.com) 3. pull a copy of learning python by Mark Lutz (ora.com) 4. read chapter 1 of each 5. make a decision 6. get to work Alternately check comp.lang.python where this question comes up over and over and over a

[Tutor] working with multiple sets

2009-09-05 Thread bob gailer
1) Please don't hijack a post then change the subject. That screws things up for email clients that track threads. I have started a new thread with this reply. 2) Be sure to reply-all so a copy goes to the list. [SNIP] I want to be able to look at a number/item and see which lists it is in s

Re: [Tutor] working with multiple sets

2009-09-05 Thread Dave Angel
kevin parks wrote: I am doing some simple things with sets and so far have had a lot of success with python's built-in sets, which is such a great new(ish) "batteries included" type python data type. [snip] [snip] -- [snip] [snip] -- #!/usr/bin/env

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Douglas Philips
On 2009 Sep 5, at 12:22 PM, Mark Tolonen wrote: As a list comp: L=range(30,41) [{38:34,40:39}.get(n,n) for n in L] [30, 31, 32, 33, 34, 35, 36, 37, 34, 39, 39] True, that is terse, but IMHO has maintainability issues. The mapping data structure and the method of transformation (.get()) ar

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Mark Tolonen
"Douglas Philips" wrote in message news:6a3250c7-31b6-4958-8e0a-f538989ed...@mac.com... On or about 2009 Sep 5, at 10:45 AM, Martin A. Brown indited: Have you discovered the map() builtin yet? I would imagine that others on this list will have some even more elegant and efficient solutions f

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Douglas Philips
On or about 2009 Sep 5, at 10:45 AM, Martin A. Brown indited: Have you discovered the map() builtin yet? I would imagine that others on this list will have some even more elegant and efficient solutions for you, but here's a possibility: def filt_seq( thing ): if thing == 38: thing = t

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Martin A. Brown
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 : I am doing some data massage, minor mapping and filtering really : and i find that i have a lot of this kind of kludgy code: : : # -- - : def filt_seq(inseq): : out_list = [] : for item in inseq: :

Re: [Tutor] how to read and transmit/send only section of the image (sub-image)

2009-09-05 Thread Jojo Mwebaze
oooh that will be helpful, kindly point me to how i can begin with getting a sub-image that has the same width as the original. That will be my starting point. Regards Johnson On Fri, Sep 4, 2009 at 3:56 PM, Kent Johnson wrote: > On Thu, Sep 3, 2009 at 6:01 PM, Jojo Mwebaze > wrote: > > t

Re: [Tutor] run command

2009-09-05 Thread upasara wulung
To all good friends, Wonderful, within just a short time, I have received many new things about python from this list. Thank you so much for all responses; they are really useful, shorten my learning time. --- Best regards, Upa ___ Tutor maillist -

Re: [Tutor] mapping/filtering a sequence

2009-09-05 Thread Wayne
On Fri, Sep 4, 2009 at 12:31 PM, kevin parks wrote: > I am doing some data massage, minor mapping and filtering really and i find > that i have a lot of this kind of kludgy code: > > To do some basic jiggering of some out of range off grid data. > > There has to be a better, more elegant, more f

Re: [Tutor] run command

2009-09-05 Thread Eike Welk
Hello Upasara! On Saturday 05 September 2009, upasara wulung wrote: > (1) In a certain working folder, I produced simple python file, for > an example, hello.py, which is free of error. > (2) I called python from the same working folder using command > 'python' (3) In the python shell, I executed:

[Tutor] working with multiple sets

2009-09-05 Thread kevin parks
I am doing some simple things with sets and so far have had a lot of success with python's built-in sets, which is such a great new(ish) "batteries included" type python data type. [snip] [snip] -- [snip] [snip] -- #!/usr/bin/env python def test(

[Tutor] mapping/filtering a sequence

2009-09-05 Thread kevin parks
I am doing some data massage, minor mapping and filtering really and i find that i have a lot of this kind of kludgy code: # -- - def filt_seq(inseq): out_list = [] for item in inseq: # 38 needs to be mapped on to 34 as we don't have a 38

Re: [Tutor] Help deciding between python and ruby

2009-09-05 Thread Dan King
> I think you will get at the least a slight bias toward Python. However, > I think you should do your own research and reach your own conclusions. > Simply to get you started I put the following into Google: 'Python or > Ruby: Which to learn' and got more than 1M hits. > Best of luck. > Robert

[Tutor] PyCon 2010 - Call for Tutorials

2009-09-05 Thread Greg Lindstrom
The Tutorial Committee for PyCon 2010 in Atlanta is now accepting proposals for classes. This year will feature 2 days of classes prior to the "official" conference. These classes are 3-hour long sessions concentrating on specific Python packages or techniques and are taught by some of the smarte

Re: [Tutor] run command

2009-09-05 Thread Alan Gauld
"upasara wulung" wrote Wish you would not mind a really beginner question. Thats what we are here for! :-) I am trying to use 'run' command, but didnot success yet. Thats because it does not exist in Python. How I did it: (1) In a certain working folder, I produced simple python file,

[Tutor] Looping quesion [WAS: Re: (no subject)]

2009-09-05 Thread Alan Gauld
Please always put a meaningful subject line in when you post. wrote in message I know, I'm a total noob (started yester day) But when I enter this code: x = 1 if x>0: ??? a = raw_input ("Type something in...I will echo it:") ??? print a ??? x=x+1 it does not loop..am I missing something here

Re: [Tutor] run command

2009-09-05 Thread Michael M Mason
"upasara wulung" wrote: (1) In a certain working folder, I produced simple python file, for an example, hello.py, which is free of error. (2) I called python from the same working folder using command 'python' (3) In the python shell, I executed: >>> run hello.py But I got only an error message