Re: [Tutor] counting no of words

2005-01-20 Thread Bill Mill
of recording a macro in word where you count the words, then repeating it in python. I'd help you with that, but I'm on linux. Peace Bill Mill bill.mill at gmail.com On Thu, 20 Jan 2005 16:37:06 +0530, Gopinath V, ASDC Chennai <[EMAIL PROTECTED]> wrote: > > > hi

Re: [Tutor] Ooer, OT Lisp

2005-01-20 Thread Bill Mill
o play 20 questions. No worries. I found the site at http://www.lisp.org/alu/home to be very helpful when I was digging around lisp-world. If you have any more questions, I'll try to help you out, but you might want to ask some more knowledgeable persons. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Cluster algorithms

2005-01-27 Thread Bill Mill
eful for numerical algorithms, where your code will often have to be optimized for speed. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Unique Items in Lists

2005-01-27 Thread Bill Mill
the default is to sort the list by the first element in the tuples. If you make a list where the element you want to sort on is first in all of the tuples (see the 'sorter = ...' line), then sort that list, then remove the element you added (the 'tuple([...])' line), you

Re: [Tutor] Safely buffering user input

2005-01-27 Thread Bill Mill
argv[1][:255] This says "Set the second element of sys.argv equal to its first 256 characters". Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Comparing files, Counting Value

2005-01-31 Thread Bill Mill
.split()] #convert strings to floats if (x,y) in pts and pts[(x,y)] > THRESHOLD: bigpixels += 1 print "%d pixels over %f" % (bigpixels, THRESHOLD) end file== Peace Bill Mill bill.mill at gmail.com On Mon, 31 Jan 2005 15:27:24

Re: [Tutor] Re: Are you allowed to shoot camels? [kinda OT]

2005-02-03 Thread Bill Mill
int re.compile(regex).match(line).groups() and then test my regexes incrementally: >>>l = '8 this is my line to test' >>> test('^\s*(\d)+', l) until I have it right. How is using this tool easier than that? Peace Bill Mill bill.mill at gmail.com > ___

Re: [Tutor] Hex to Str - still an open issue

2005-02-04 Thread Bill Mill
/comp.lang.python/browse_thread/thread/bdd85f1d1298a191 . Peace Bill Mill bill.mill at gmail.com On Fri, 4 Feb 2005 15:11:00 +0100, Tamm, Heiko <[EMAIL PROTECTED]> wrote: > > > Ok, thank you. > > Does anybody know how to convert a HEX into a BINARY? > > Best regards > > &g

Re: [Tutor] Perl Symbology (was: Are you allowed to shoot camels?)

2005-02-10 Thread Bill Mill
= 0, 0, 0 >>> print "$s $n $r" 0 0 0 >>> x = Itpl.itpl("$s $n $r") >>> x '0 0 0' And, of course, you can give Itpl.itpl a nicer name; I usually call it pp(). If you don't need to change the behavior of the "print" statement, then

Re: [Tutor] Perl Symbology (was: Are you allowed to shoot camels?)

2005-02-10 Thread Bill Mill
Sorry for the double post; I forgot one thing: On Thu, 10 Feb 2005 10:43:28 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: > Jeff, > > I get the impression that many pythonistas don't like string > interpolation. I've never seen a clear definition of why. Anyway, it

Re: [Tutor] Re: Perl Symbology

2005-02-10 Thread Bill Mill
On Thu, 10 Feb 2005 18:22:30 +0100, Abel Daniel <[EMAIL PROTECTED]> wrote: > Bill Mill writes: > > > I get the impression that many pythonistas don't like string > > interpolation. I've never seen a clear definition of why. > >From "import this

Re: [Tutor] Perl Symbology (was: Are you allowed to shoot camels?)

2005-02-10 Thread Bill Mill
001:0> x = 12 => 12 irb(main):002:0> '$x' => "$x" irb(main):003:0> "$x" => "$x" irb(main):004:0> "#{$x}" => "" irb(main):005:0> "#{x}" => "12" irb(main):006:0> '#{x}' => "#{x}" so "#{} . Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Perl Symbology

2005-02-10 Thread Bill Mill
thermore which I have not tested. You can also find a recipe to make pp() easy to make at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/335308 . This function may or may not be better than yours; I haven't used either. the Itpl module has worked fine for me (and for the author of

Re: [Tutor] Simple question on creating a filter

2005-02-11 Thread Bill Mill
On Fri, 11 Feb 2005 09:28:35 -0500, Smith, Jeff <[EMAIL PROTECTED]> wrote: > I'm sorry to both with such a simple question but I've looked in the > normal places and don't see the quick and dirty answer I know must > exist. > No worries; that's what this list is for. > I want to write a simple l

Re: [Tutor] Might be a silly question!

2005-02-11 Thread Bill Mill
weak system, and I'm sure there have been problems with it, I've never heard of one. Remember to only import the names you need from the classes you import, and you should be fine. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] count words

2005-02-15 Thread Bill Mill
e.split(): if word in word_counts: word_counts[word] += 1 else: word_counts[word] = 1 for word in word_counts: print "%s %d" % (word, word_counts[word]) Peace Bill Mill bill.mill at gmail.com ___ Tuto

Re: [Tutor] count words

2005-02-15 Thread Bill Mill
ion from the beginning and end of words, at least in 2.4, you can just use: word.strip('.!?\n\t ') plus any other characters that you'd like to strip. In action: >>> word = "?testing..!.\n\t " >>> word.strip('?.!\n\t ') 'testing' Peace Bill M

Re: [Tutor] count words

2005-02-15 Thread Bill Mill
unctuation does not include whitespace characters. Although that is no problem in this example, because split() strips its component strings automatically, people should be aware that punctuation won't work on strings that haven't had their whitespace stripped. Otherwise

Re: [Tutor] Basic terminology

2005-02-15 Thread Bill Mill
m.com/Modulus.html for more formal explanations. In particular, it explains some deeper meanings of the word "modulus". Once you get into group theory, it can start to mean some related but different things. Peace Bill Mill bill.mill at gmail.com On Tue, 15 Feb 2005 16:16:44 -0500, [

Re: [Tutor] Basic terminology

2005-02-15 Thread Bill Mill
in 16 hours? Well, in 12 hours it will be at the one, then four more hours later it will be pointing at the five. This can be represented as: 1 + (16 % 12) = 1 + 4 = 5 In general, the hour at some point in the future will be: (start time) + (hours in the future % 12)

Re: [Tutor] Re: Basic terminology

2005-02-16 Thread Bill Mill
On Wed, 16 Feb 2005 11:34:55 +0100, Roel Schroeven <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > However, where will it be pointing in 16 hours? Well, in 12 hours it > > will be at the one, then four more hours later it will be pointing at > > the five. This can b

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Bill Mill
#x27;ve written translates, in newsgroup-speak, to "Will somebody write this script for me that I need?" Boil your question down into something smaller, and then ask it with the appropriate information. I suggest reading http://www.catb.org/~esr/faqs/smart-questions.html . Peace Bill Mill b

Re: [Tutor] Active Python

2005-02-18 Thread Bill Mill
'd be in heaven. > How do you live without cygwin? Just 'cd' to the directory and 'grep -r' to search through it. It's the first thing I install on a windows box, even before python. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] killing a thread

2005-02-22 Thread Bill Mill
If I recall correctly, there is not a direct way. Instead, you're going to want to have your worker thread check a queue it shares with the parent every so often to see if the supervisor thread has sent a "quit" message to it. Peace Bill Mill bill.mill at gmail.com On Tue, 22 Fe

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Bill Mill
e written them in the > script? Why not just take them out of the block, and either make them global to the module or create a string module? i.e.: prompt1 = """This is a long string with %s string variables %s scattered all over the place as well as odd indentation

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Bill Mill
On Thu, 24 Feb 2005 13:14:13 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: > On Thu, 24 Feb 2005 10:02:44 -0800, Luke Jordan <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > I've tried a lot of experimenting and searching through various > > tutorial

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Bill Mill
On Thu, 24 Feb 2005 14:23:28 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > >>class foo: > >>def bar(self): > > > > > > Sorry, I forgot that if it's in the module, you should declare prompt1 > > as global by usin

Re: [Tutor] threads

2005-02-25 Thread Bill Mill
ete before proceeding. > > I also feel that there is no clear documentation on > stackless. > > Show me the light. > You might want to tighten this question up and ask it on python-list. This is pretty specialized knowledge for the python-tutors list, and I know for a fact that

Re: [Tutor] Functions Calling Functions

2005-02-25 Thread Bill Mill
r functions in order. There's nothing technically wrong with what you're doing, as long as you don't exceed the maximum recursion depth, but it's a pain to debug and takes up a whole bunch of memory you don't need. Peace Bill Mill bill.mill at gmail.com _

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Bill Mill
cks are equivalent to the str() function which creates strings (or is it repr()? I can't remember; it's generally bad form to use back ticks anyway). Double quotes are the same as single quotes. Please read the tutorial at http://docs.python.org/tut/tut.html . Peace Bill Mill bill

Re: [Tutor] puzzling traceback -- what to do with it?

2005-02-28 Thread Bill Mill
t > down before reporting? I would just give them a link to the smallest bit of source code you can get to reproduce this problem, and an exact list of steps for how to repeat it consistently. Also tell them your OS, python version, and IDLE version. I'm

Re: [Tutor] Acessing files in Windows 2000

2005-03-09 Thread Bill Mill
r "license" for more information. >>> f = open('c:/Documents and Settings/WMill/test.txt') >>> I'm really pretty convinced that the file you're talking about doesn't exist, or you don't have the security permissions to open it. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Acessing files in Windows 2000

2005-03-09 Thread Bill Mill
> mmm ... I kind of see what you mean. > > Does anyone have like a realy large shovel so I can dig a hole and hide ? No worries, we've all been there before. Sometimes you just can't see what's right in front of your face. Don't let it stop you, or stop you from

Re: [Tutor] Accessing List items

2005-03-21 Thread Bill Mill
ctual object it encloses has changed. I hope this makes sense, and maybe clears up a little of your confusion about variables in Python. It is a bit confusing, even for experienced pythonistas, so ask questions if you don't get it (and you're interested). If not, you can get away without worrying about it for the most part. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Looking for a Pythonic way to pass variable

2005-03-22 Thread Bill Mill
, to modify the list in-place with a listcomp, you could use: >>> L = [[1,2], [3,4]] >>> K = [100, 200] >>> [x.append(y) for x, y in zip(L, K)] [None, None] >>> L [[1, 2, 100], [3, 4, 200]] And, to create a new list in the format you originally asked

Re: [Tutor] problems with dictionary

2005-03-23 Thread Bill Mill
quot; > self.text(END, str) > return 'break' > ) > > There is clearly a mistake in the first function, only thing is I cannot > spot it and thus the thing does not work. Send us the exception python gives you and we may be able to help you more. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How and where to use pass and continue

2005-03-27 Thread Bill Mill
works on the innermost loop in its execution context - but generally, they work as you expect. The longer you work with python, the more you'll find this to be the case, but I'm biased. Hope this helps, and feel free to ask questions about wha

Re: [Tutor] flatten

2005-04-07 Thread Bill Mill
', 9, 10, 11, 'test'] 2) What's different about your flatten than those ASPN entries? Just that it flattens in-place? I see a general-purpose flattener and a flattening generator. Peace Bill Mill bill.mill at gmail.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Pass By Reference

2005-04-12 Thread Bill Mill
x27; > > Any ideas on what I am doing wrong? > 1) Linked lists are almost always worthless in python. Why not use a list instead? 2) what's being printed is a function reference - i.e. you're doing: self.a_dir_instance.getSize instead of: self.a_dir_instance.

Re: [Tutor] How to calculate pi with another formula?

2005-04-14 Thread Bill Mill
-generating program. > I just thought I would reference the fascinating thread that ensued from this request on comp.lang.python : http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/1839b7d733ae37d0/3b5f7138f0e5fbd1?q=pi+base+12