Re: [Tutor] question concerning Boolean operators

2008-03-20 Thread jim stockford
i'm guessing assignment, which actually associates a reference, will skip referencing an identifier to a null and will make the association (assignment) to the first non-null value in the expression, which is string2 in this case. that the identifier is non_null is immaterial; you could write

Re: [Tutor] self-learning Python

2008-03-08 Thread jim stockford
i'm working (gratefully) with a small python study group and preparing an intro to python class. if you like, i'll send you my lessons and hope for your questions and feedback.mine is certainly not the best python material (i think it's not bad), but it comes with the ability for you t

Re: [Tutor] Python oddity

2008-02-28 Thread jim stockford
i'd like to know, too. my take so far is * don't make any copies if you can avoid doing so, * make shallow copies if need be, * make deep copies only if you can't think of any other way to accomplish what you're up to. what's the truth? I'm hoping there's an OTW answer (OTW ~> "One True Way").

Re: [Tutor] Python oddity

2008-02-27 Thread jim stockford
i'm guessing this is the "post-it effect". aa = range(0,10) print aa [0,1,2,3,4,5,6,7,8,9] # what you've done is to use the range function to # create the list of 0 to 9, then you associated the # name aa to the list. a popular teaching analogy # is that of putting a post-it that says aa on the l

Re: [Tutor] Indentation Issue and Blind People

2007-11-30 Thread jim stockford
you might consider keeping your code at two spaces and when/if the need arises to share your code, write a little filter program that translates the two-space indents to four. very interesting idea to play piano notes. how'd you do that? On Nov 30, 2007, at 10:58 AM, [EMAIL PROTECTED] wr

Re: [Tutor] lstrip removes '/' unexpectedly

2007-11-30 Thread jim stockford
it might work just to strip 'home' and leave print s1 //test/ the '/' character is a separator, so /this//that/andmore/ is, at least at the shell level, the same as /this/that/andmore/ i.e. any number of '/' characters adjacent has the effect of a single '/' character (again, at the shell level)

Re: [Tutor] Python CMS advice wanted

2007-11-27 Thread jim stockford
I'd love to know scott's definition of "framework", especially contrasting with full-blown CMS. Frameworks for Python: CherryPy · Django · Karrigell · Nevow · Porcupine · Pylons · Spyce · TurboGears · TwistedWeb · Webware · Zope per http://en.wikipedia.org/wiki/Django_(web_framework)

Re: [Tutor] Python CMS advice wanted

2007-11-27 Thread jim stockford
On Nov 27, 2007, at 9:40 AM, Scott SA wrote: > On 11/27/07, jim stockford ([EMAIL PROTECTED]) wrote: > >> IMO: >> my experience with cms systems is that there's a big >> learning curve. you might have more fun (and be more >> productive and maybe more cr

Re: [Tutor] Python CMS advice wanted

2007-11-27 Thread jim stockford
IMO: my experience with cms systems is that there's a big learning curve. you might have more fun (and be more productive and maybe more creative) if you use the available appropriate python modules and cobble together your own site. maintenance, especially by some one else, would be an area t

Re: [Tutor] global is bad but ...

2007-11-13 Thread jim stockford
On Nov 13, 2007, at 3:11 PM, Alan Gauld wrote: > Rather than answer your question directly can I ask, do > you know *why* wiser heads say global is bad? What > problems does using global introduce? What problems > does it solve? i'll try: globals are good because they provide common data to

Re: [Tutor] 2 problems in a small script

2007-10-12 Thread jim stockford
On Oct 12, 2007, at 11:48 AM, Kent Johnson wrote: > If all you want to do is copy the list, then >lstB = lstA[:] > is fine, or you can use >lstB = list(lstA) why choose one over the other? is there a performance or other difference? ___ Tutor

[Tutor] about modules, classes, methods, functions

2007-09-02 Thread jim stockford
I've gotten red-eyed looking through google pages to find answers. I've read the python.org docs and tutorials entirely (some parts very quickly). If I write a little .py file, its name is __main__ assuming no big nit-picks in the claim above, is __main__ a class? What exactly does it mean "mod

Re: [Tutor] Is there any logic in this?

2007-09-01 Thread jim stockford
Thanks for your explenation, so essentialy a = b, copys the pointer of > a > to b rather than the actual content. This explains why a[:] does work. > > Do you have an explenation why this is not the case with integers ie. > >>>> a, b = 10, a >>>> b = b

Re: [Tutor] Is there any logic in this?

2007-09-01 Thread jim stockford
seems to me this is an artifact of the language. reading right to left: "make a list that contains 10,40,30,20, then create a name 'a' to be used as a label to identify that list, then (next line) create a label 'b' to attach to whatever is the thing 'a' refers to, then (next line) modify

Re: [Tutor] Simple way to compare Two lists

2007-08-16 Thread jim stockford
Why is a dict lookup constant time. I.e. if there's a loop that walks a (shorter) list and compares each element with each element of a dict, what's going on to make this faster than an outer loop walking a list and an inner loop walking a second list? On Aug 16, 2007, at 5:01 PM, Stephen McIne

Re: [Tutor] IDLE Usage - was Interpreter Restarts

2007-07-19 Thread jim stockford
here's a link to the very brief vi get-started web page: http://www.sf-lug.com/How2vi.html On Jul 17, 2007, at 11:01 AM, Sara Johnson wrote: > Sure, sounds good.  Should I assume that 'any' Unix version allows Vim? >   > Thanks, > Sara > > ----- Original M

Re: [Tutor] IDLE Usage - was Interpreter Restarts

2007-07-17 Thread jim stockford
you want a very brief set of vi(m) commands-- a get-you-started tutorial that's nearly painless? I'll send if "yes". jim On Jul 16, 2007, at 9:26 PM, Sara Johnson wrote: > First off, yes, I was referring to (I guess you could say) a > non-python editor.  I use an SSH editor set up by my school.

Re: [Tutor] IDLE Usage - was Interpreter Restarts

2007-07-17 Thread jim stockford
change "small" to "large" and you're right. Vim is Vi improved. Any tutorial or reference on Vi ought to work for Vim. On Jul 17, 2007, at 10:09 AM, Sara Johnson wrote: > I initially thought Vim was sort of the same as Vi, just a few small > differences or upgrades.  Or have I got that confused

Re: [Tutor] interpreter restarts

2007-07-17 Thread jim stockford
$ who am i unohoo $ which python /usr/bin/python $ python Python 2.3.4 (#1, Mar 20 2006, 00:23:47) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print 1 1 >>> help() help> quit >>> $ $ vi doit.py $ ls doit.py $

Re: [Tutor] Good writeup on Python assignment semantics

2007-07-17 Thread jim stockford
as I understand things... there's a writeup somewhere that uses the term "bind" instead of "assign" for the operation a = b for example, in Python a = 1 the value 1 now has a name of a associated with it. b = a the value 1 now has two names, a and b, associated with it the value 1 exists as an o

Re: [Tutor] Key Error

2007-07-08 Thread jim stockford
On Jul 8, 2007, at 9:45 AM, Alan Gauld wrote: > (The tests at the end > are poorly written too. If one of my team produced code like > this I'd be having strong words with them!) If you'd be willing to share your strong words, I'd be grateful to learn better alternatives. __

Re: [Tutor] Command Line Promps

2007-06-03 Thread jim stockford
sounds like threading is a solution. On Jun 3, 2007, at 2:05 PM, Jason Coggins wrote: > I am using Linux and yes I am wanting the program to run another > program. I > have tried these before but, if I remember correctly, these methods > caused > the original program to "freeze" while waiting

Re: [Tutor] gmail

2007-05-29 Thread jim stockford
i'd be curious to see what happens if you use the tag around your (properly) indented code, e.g. this = 1 that = 0 if this == 1 : that = 1 print that On May 29, 2007, at 9:24 AM, Adam Urbas wrote: > Hey, > > I have gmail now, but I'm not sure how to turn off HTML. > ___

Re: [Tutor] Inherit from int?

2007-05-12 Thread jim stockford
the problem is in the return. if you append a print statement to the class function such as print "number is ",number # (properly indented, of course) you'll get 8 On May 12, 2007, at 5:11 PM, John Fouhy wrote: > On 13/05/07, Marilyn Davis <[EMAIL PROTECTED]> wrote: >> #!/usr/bin/env python

Re: [Tutor] Python fast enough for ad server?

2007-05-09 Thread jim stockford
there's also the question of the delivery architecture: if there are multiple machines in a clustered configuration, even something such as DNS round robin, then improving performance is a matter of throwing machines at the front end. On May 9, 2007, at 1:17 PM, Alan Gauld wrote: > > "OkaMth

Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress

2007-01-21 Thread jim stockford
no need for apology on my side. there's no agreed-upon and expressed policy. i like the model that we accept each other as we are. On Jan 20, 2007, at 7:10 AM, Karl Wittgenstein wrote: > Sorry for the swear words... > > 2007/1/20, Kent Johnson <[EMAIL PROTECTED]>: Karl Wittgenstein w

Re: [Tutor] Matching on multiple log lines

2006-10-28 Thread jim stockford
so it's guaranteed that 'Writing Message to' will always be followed by 'TRANSPORT_STREAM_ID' before the next occurrence of 'Writing Message to' and all text between can be ignored, and we increment the counter if and only if there is a newline immediately after 'TRANSPORT_STREAM_I

[Tutor] what.built-in

2006-09-29 Thread jim stockford
from http://docs.python.org/lib/built-in-funcs.html some functions are always available--the built-in functions. (from elsewhere) everything in python is an object. hey, from abs() to zip() there's type() and super() and str() and setattr() and ... dir() and... they're the

Re: [Tutor] looping problem

2006-09-23 Thread jim stockford
t; Now I want to select ''GeneName ' into listA > and 'ATTAAGGCCAA' into listB > > so I want to select 0,3,6,9 elements into listA > and 2,5,8,11 and so on elements into listB > > then I can do dict(zip(listA,listB)) > > however, the ve

Re: [Tutor] looping problem

2006-09-23 Thread jim stockford
keep a counter in your loop. is this a homework question? On Sep 23, 2006, at 8:34 AM, kumar s wrote: > hi, > > the reason could be that I did not quite understand > the concept of looping > > I have a list of 48 elements > > I want to create another two lists , listA and listB > > I want to loo

Re: [Tutor] first programming project

2006-08-18 Thread jim stockford
i hope this helps: what a fun idea! do it! my way is to do a bad job fast then re-visit the plans and reimplement and test and re-visit and reimplement and test and consider writing a main program that does the primary work and outputs as text-only. maybe then create four clas

Re: [Tutor] Which Book

2006-08-17 Thread jim stockford
i think it's a mistake to concentrate on one book. Cull responses and pick three books to start with. The benefit is that where one book presents a poor explanation, another will do a good job (and one book will omit certain things that another presents). Also, you'll probably find you

Re: [Tutor] What does import really do?

2006-08-14 Thread jim stockford
y way of explaining my avoidance above. Might help to know I very much liked working in assembler and infer possible assembler correspondences when I wonder about code behavior. Your rundown of search order is helpful. more thanks. jim On Aug 14, 2006, at 7:52 PM, Luke Paireepinart wrote:

[Tutor] What does import really do?

2006-08-14 Thread jim stockford
For example, import os import sys My take is that one uses the import keyword in a program. The Python interpreter reads the program and generates machine code. The import keyword directs the Python interpreter to find some library (which is not necessarily named, certainly not necess