Re: *Python* Power Tools

2005-06-21 Thread John Machin
Micah wrote: > Anyone know if there is any organized effort underway to implement the > Python equivalent of "Perl Power Tools" ? > > If not, would starting this be a waste of effort since: +1 WOFTAM-of-the-year > > - it's already being done in Perl? > - cygwin thrives? F

Re: need to strip stuff off email

2005-06-21 Thread John Roth
anyone know how to accomplish this? > thanks See the example at the end of the email package documentation. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: oddness in shelve module

2005-06-21 Thread John Machin
Michael P. Soulier wrote: > I'm trying to add objects to a shelve db object via hash assignment, but > I'm getting an odd exception. > > Traceback (most recent call last): > File "RemGui.py", line 117, in onMonitorButton > self.startMonitoring() > File "RemGui.py", line 163, in startMonit

Re: oddness in shelve module

2005-06-22 Thread John Machin
Michael P. Soulier wrote: >On 22/06/05 John Machin said: > > > >>AFAICT, wrong "it". The "item assignment" which is alleged not to be >>supported is of this form: an_object[some_key] = a_value >> >>I.e. "self.db" is the sus

Re: Does a function like isset() exist in Python?

2005-06-22 Thread John Roth
d trying to print out the values of identifiers on the calling chain on an exception, all bets are off. See the code in the py.test module (part of the PyPy project) for how you can do this. John Roth "Patrick Fitzsimmons" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED

Re: trouble subclassing str

2005-06-23 Thread John Machin
txt) print "new_instance:", repr(new_instance) new_instance.data = data return new_instance if __name__ == '__main__': s1 = MyString("some text", 100) print "s1:", type(s1), repr(s1) print "s1.data:";, s1.data 3. Note, *if* you provide an __init__ method, it will be called [seemingly redundantly???] after __new__ has returned. HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 304 - is anyone really interested?

2005-06-23 Thread John Roth
dows. Actually, the PEP states that if the environment variable does not specify a directory then it does not generate a .pyc file. Any entry that is not a directory would do, such as some special characters that are illegal in file and directory names. John Roth > > Regards, > Pat > -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting part of a list

2005-06-24 Thread John Machin
Sibylle Koczian wrote: > Hello, > > I thought I understood list slices, but I don't. I want to sort only the > last part of a list, preferably in place. If I do > > >>> ll = [3, 1, 4, 2] > >>> ll[2:].sort() It may help in unravelling any bogglement to point out that this is equivalent to te

Re: howto load and unload a module

2005-06-24 Thread John Machin
dname, attrname) continue # check that attr is NOT a function (maybe) for funcname in funcs: pass # similar to above but check that it IS a function BTW, question for the OP: what on earth is the use-case for this? Bulk checking of scripts written by students? Cheers, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Two questions on lambda:

2005-06-24 Thread John Roth
s also likely to go away in Python 3.0. Python, for better or worse, is a multi-paradigm language combining the object and procedural paradigms. It is not, and it is not intended to be, a functional style language. John Roth > > For example, the code > > # f = lambda : print "hel

Re: autoconfigure vss python question

2005-06-24 Thread John Machin
lode leroy wrote: > Hi folks, > > I'm trying to build a python module using MINGW on MSYS > the "configure" script is determining where python is installed as follows: > > python.exe -c 'import sys; print sys.prefix' > c:\Python24 > > which is good on native windows (i.e. when invoked from CMD.E

Re: Favorite non-python language trick?

2005-06-24 Thread John Machin
James wrote: > Interesting thread ... > > 1.) Language support for ranges as in Ada/Pascal/Ruby > 1..10 rather than range(1, 10) Did you mean 1..9 or 1...10 or both or neither? Can this construct be used like this: (i+1)..n ? If not, what would you use? What is the frequency of range literals i

Re: Favorite non-python language trick?

2005-06-24 Thread John Machin
James Stroud wrote: > On Friday 24 June 2005 05:58 am, Steven D'Aprano wrote: > >>with colour do begin >>red := 0; blue := 255; green := 0; >>end; >> >>instead of: >> >>colour.red := 0; colour.blue := 255; colour.green := 0; >> >>Okay, so maybe it is more of a feature than a trick, but I miss it a

Re: Thoughts on Guido's ITC audio interview

2005-06-25 Thread John Roth
cleanly with a type inferencer, while the index and find methods cannot. [snip] John Roth [1] I'm well aware that ostritches do not stick their heads in the sand to avoid looking at distressing things, such as advancing predators. It is, however, a useful metaphor. > > Cheers, > Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Thoughts on Guido's ITC audio interview

2005-06-25 Thread John Roth
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 25 Jun 2005 19:31:20 -0600, John Roth wrote: > >> >> "Dave Benjamin" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Gu

Re: Acceptance test spike example

2005-06-26 Thread John Roth
tables: Word processors, Spread Sheets, etc. The Python version of FIT (currently at 0.7a2) can be found in the file section of either the FitNesse Yahoo group or the ExtremeProgramming Yahoo group. One of these days I'm going to get it on PyPi. It's full featured, works both in batch and with FitNesse, and includes most of FitLibrary. There's a book coming out on FIT (FIT for Developing Software) by Rick Mugridge and Ward Cunningham. It was supposed to be out a week ago Friday, but B&N says it was delayed. John Roth PyFit > > Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question: Converting Single-Element tuples to list

2005-06-27 Thread John Roth
lass emulates > a list, it should do so every time, not only if there is more than one > value in it. Unfortunately, I've seen that behavior a number of times: no output is None, one output is the object, more than one is a list of objects. That forces you to have checks for None and list types all over the place. Granted, sometimes your program logic would need checks anyway, but frequently just returning a possibly empty list would save the caller a lot of grief. John Roth > > Reinhold -- http://mail.python.org/mailman/listinfo/python-list

Re: Plain text email?

2005-06-27 Thread John Roth
l clients out there that handle tabs poorly. Outlook Express is the poster child for this: it ignores tabs completely, however it is by no means the only culprit. It's simply the most widespread one. In other words, use strings of spaces rather than tabs, and you'll probably fin

Re: Plain text email?

2005-06-27 Thread John Roth
Dan - HTML mail is evil, and I try to avoid it whenever possible. That's one of the major vectors for worms, viri and simliar malware. John Roth > -- http://mail.python.org/mailman/listinfo/python-list

Re: building python 2.4.1

2005-06-28 Thread John Abel
Andreas Heiss wrote: >Hi ! >I am trying to build python 2.4.1 from source on a Linux system. >Everything seems fine, but tkinter seems not to work. >The file _tkinter.pyd is missing. >How can tell configure to build all necessary components ? > >Thanks >Andreas > > It looks to like Tcl/Tk is no

Re: building python 2.4.1

2005-06-28 Thread John Abel
Andreas Heiss wrote: >John Abel wrote: > > > >>Andreas Heiss wrote: >> >> >> >>>Hi ! >>>I am trying to build python 2.4.1 from source on a Linux system. >>>Everything seems fine, but tkinter seems not to work. >>>T

Re: Modules for inclusion in standard library?

2005-06-28 Thread John Roth
that. PyChecker, rather obviously. Likewise I'd like to see something that would do a decent job of coverage analysis. Neither of the modules out there at the moment is ready for prime time. I don't have enough experience with interactive mode to have an opinion on IPython. Wha

Re: Dictionary to tuple

2005-06-28 Thread John Roth
is really new to Python. The (dict.items()) part of the expression returns a list, and if you want to sort it, then you need to sort the list and then convert it to a tuple. dic = {1:'one',2:'two',3:'three'} dic.sort() tup = tuple(dic) This points up the fact that

Re: Newbie: Explain My Problem

2005-06-29 Thread John Machin
nteger e.g. guess = 42, counter = 4 2. Examine the logic carefully. The answer to your second problem was just staring you in the face -- you hadn't pulled the ripcord after the counter became zero. Cheers, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Got an interesting problem. (platform ruuning issue)

2005-06-29 Thread John Abel
Jeffrey Maitland wrote: >when running scripts they seem to work fine on ia-32 but I get >segfault on ia-64 what the heck should I be looking for? > >I did notice that it seems to work ok only for certain scripts but any >script that imports MySQLdb or glob seems to make this occur. > >Thanks Jeff

Re: Boss wants me to program

2005-06-29 Thread John Machin
n script to do all those boring delta_x = paces * cos(delta_theta) etc calcs -- *after* they've done it manually of course. If they get a sign wrong and produce an endpoint that's in the next suburb, they might learn something and not go on to write aviation software that makes the aircraft flip upside down when it crosses the equator. Cheers, John -- http://mail.python.org/mailman/listinfo/python-list

Re: aligning text with space-normalized text

2005-06-29 Thread John Machin
Steven Bethard wrote: [snip] > And it appears to work: [snip] > But it seems somewhat inelegant. Can anyone see an easier/cleaner/more > Pythonic way[1] of writing this code? > > Thanks in advance, > > STeVe > > [1] Yes, I'm aware that these are subjective terms. I'm looking for > subjective

Re: Help please: How to assign an object name at runtime

2005-06-29 Thread John Machin
quot;"" with """for line in open(filename):""" and lose the """if : break""" line. Step 2: read up on the csv module, and lose the "split". Step 3: you are unlikely to *ever* need the string and fileinput modules Step 4: you import 4 modules you don't use. Why? Oh and BTW Step 0: what are the requirements for this exercise, what do the fields in the file actually represent, what is that bloody = sign between 'Adobe Acrobat' and the date rrrggg words fail me [finally] ... exiting in pursuit of paracetamol, John -- http://mail.python.org/mailman/listinfo/python-list

Re: aligning text with space-normalized text

2005-06-30 Thread John Machin
Steven Bethard wrote: > John Machin wrote: > >> If "work" is meant to detect *all* possibilities of 'chunks' not >> having been derived from 'text' in the described manner, then it >> doesn't work -- all information about the

Re: Store multiple dictionaries in a file

2005-06-30 Thread John Machin
bruno modulix wrote: > Philipp H. Mohr wrote: >>My code currently produces a new dictionary every iteration and >>passes it on to another peace of code. > > > May this code rest in piece Perhaps it's the piece of code that passeth all understanding? -- http://mail.python.org/mailman/listinfo

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Jun 29)

2005-07-01 Thread John Machin
Simon Brunning wrote: > On 7/1/05, Peter Maas <[EMAIL PROTECTED]> wrote: > >>Simon Brunning schrieb: >> >>>Sibylle Koczian needs to sort part of a list. His first attempt made >>>the natural mistake - sorting a *copy* of part of the list: >> >>I think it was _her_ first attempt. > > > Oo

Re: Splitting string into dictionary

2005-07-01 Thread John Machin
David Pratt wrote: > I have string text with language text records that looks like this: > > 'en' | 'the brown cow' | 'fr' | 'la vache brun' Pardonnez-moi, but I thought "how now brown cow" translated into something like "comme maintenant vache brune" -- something about the adjectives agreeing

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread John Roth
one can have for notational expressiveness. While lambda has a lot of problems, Guido seems to be resisting replacing it with something that can actually do the job. Having to define an external function or class doesn't always improve expressiveness. Sometimes it reduces it. To quote

Re: Running Python interpreter in Emacs

2005-07-01 Thread John Machin
Rex Eastbourne wrote: > Yes! Thank you so much! (For some reason, by the way, I had to copy > python.exe to my c:/ directory, No, you did _not_ need to copy it there. You did _not_ need to copy it anywhere. Didn't copying an executable to your root directory [on any operating system] strike you

Re: Python, mysql, floating point values question

2005-07-01 Thread John Machin
Terry Hancock wrote: > On Friday 01 July 2005 05:40 pm, Christopher Kang wrote: > >>Anyway, I have a problem where I am pulling floating point values out >>of mysql and into python using the MYSQLdb module. >> >>However, the values seem to be altered a little when I store them in python. > > > I

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-02 Thread John Roth
tional constructs has been going on for a long time, and list comprehensions are only one piece of it. John Roth > -- > Robert Kern > [EMAIL PROTECTED] > > "In the fields of hell where the grass grows high > Are the graves of dreams allowed to die." > -- Richard Harter > -- http://mail.python.org/mailman/listinfo/python-list

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Jun 29)

2005-07-02 Thread John Machin
Christos TZOTZIOY Georgiou wrote: > On Fri, 01 Jul 2005 23:45:57 +1000, rumours say that John Machin > <[EMAIL PROTECTED]> might have written: > > >>Simon Brunning wrote: >> >>>On 7/1/05, Peter Maas <[EMAIL PROTECTED]> wrote: >>> >>>

Re: What's wrong with this code?

2005-07-02 Thread John Machin
3. In this news group, read a little more than the threads that you have started; this guessing game was discussed in a thread started by somebody calling themselves ChuckDubya on 29 June!! Homework?? HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining actual elapsed (wall-clock) time

2005-07-02 Thread John Machin
Roy Smith wrote: > Peter Hansen <[EMAIL PROTECTED]> wrote: > >>I guess as long as the NTP client is set up to ensure the time >>adjustments are smaller than some value X, it would be acceptable. > > > NTP is generally capable of keeping the various system clocks on a LAN > within a few ms of e

Re: What's wrong with this code?

2005-07-02 Thread John Machin
John Machin wrote: > Nathan Pinno wrote: >> guess = input("Guess a number: ") > > > "guess" will refer to a string e.g. "42" which will *not* compare equal > to the integer 42. Also you should use raw_input, not input. > &g

Re: Inheriting from object

2005-07-02 Thread John Roth
ry class and instance. The big issue seems to be the direction Guido wants to take Python - he seems to not want to put methods on the object type. I have to say that I don't understand his reasoning, if that is indeed his position. John Roth > > Regards, > Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list

Re: Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-03 Thread John Roth
es in Python 3.0 See PEP 3000 for details. http://www.python.org/peps/pep-3000.html What this means is that there is a good chance that a print() built-in function or method on a file object may show up in a future release, the print statment won't go away until Python 3.0. John Roth > >

Re: Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-04 Thread John Roth
mal numbers, or are they? Because Guido said (somewhere) that he didn't want to go over release 2.9. John Roth > > -- > --- > Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0 >

Re: Unicode drives me crazy...

2005-07-04 Thread John Roth
our conversion in the middle will lead to excessive complexity, with the resulting debugging problems. If you do go the unicode route, you must remember that any method or function that's defined to return a string will most likely throw an exception. This includes str()! Whether or not the print statement will work depends on a number of factors in how your Python installation was set up. HTH John Roth > Thanx for help: > ft -- http://mail.python.org/mailman/listinfo/python-list

Re: what is __init__.py used for?

2005-07-05 Thread John Roth
t will have some standard identifiers that all modules have, and second it will have anything you put into the __init__.py module file. This last is an advanced feature, and you're well advised to stay away from it until you've got a lot more experiance. HTH John Roth > > thanks. > -- http://mail.python.org/mailman/listinfo/python-list

Re: Do a "Python beginners e-mail list" exist?

2005-07-07 Thread John Machin
Alessandro Brollo wrote: > Far from a professional programmer, I'm simply a > newbie Python user. Two basic questions: > > 1. I don't want to post banal questions about Python > to main Python list. Does a "banal Python questions > list" or a "Python beginners list" exist? http://mail.python.org/

Re: Create datetime instance using a tuple.

2005-07-07 Thread John Machin
Negroup wrote: >>Use: >>dt =3D datetime(*t) >> > > > Thanks for the quick reply. > I can't find any doc about '*' used in this context. Have you some url > or suggestion for which terms search in Google? http://www.python.org/doc/2.4.1/tut/tut.html Then read this section 4.7.4 Unpacking Argum

Re: print values from Py_BuildValue

2005-07-07 Thread John Machin
nge exception? Have you tested the value returned by Py_BuildValue -- like this: /* the following line is written to clarify intent, not as an example of good coding style :-) */ if (obj == NULL) goto free_resources_and_return_NULL; Are you extending or embedding? Is this your first a

Re: directory traverser

2005-07-09 Thread John Machin
Florian Lindner wrote: > Hello, > IIRC there is a directory traverser for walking recursively through > subdirectories in the standard library. But I can't remember the name and > was unable to find in the docs. Where did you look? How did you look? > Anyone can point me to it? Did you try Googl

Re: Formatting data to output in web browser from web form

2005-07-09 Thread John Machin
quot;\r". The line feed (LF) is "\x0a" or "\n". Does this info help you with your problem? If, not perhaps you might like to print repr(StringData) so that we can see what you are calling "carriage returns". HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with sha.new

2005-07-09 Thread John Machin
Florian Lindner wrote: > Hello, > I try to compute SHA hashes for different files: > > > for root, dirs, files in os.walk(sys.argv[1]): > for file in files: > path = os.path.join(root, file) > print path > f = open(path) print "sha is", repr(sha) ### self-help !!!

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread John Roth
to slice the result, when you want to see a > few elements through repr(), and when you need to loop over the > contents more than once. I was wondering about what seemed like an ill-concieved rush to make everything an iterator. Iterators are, of course, useful but there are times when you really

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread John Roth
ple have made many times, with about as much effect as spitting into the wind. Making a piece of functionality less convenient simply to satisfy someone's sense of language esthetics doesn't seem to me, at least, to be a really good idea. John Roth > > > George > -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I use "if" or "try" (as a matter of speed)?

2005-07-09 Thread John Roth
tively rare, then the try block is the better approach. If you simply want to throw an exception, then the clearest way of writing it that I've ever found is to encapsulate the raise statement together with the condition test in a subroutine with a name that describes what's being tested for. Even a name as poor as "HurlOnFalseCondition(, , , ) can be very enlightening. It gets rid of the in-line if and raise statements, at the cost of an extra method call. John Roth In both approaches, you have some error handling code that is going to clutter up your program flow. -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I use "if" or "try" (as a matter of speed)?

2005-07-09 Thread John Machin
Roy Smith wrote: > Well, you've now got a failure. I used to write Fortran on punch cards, which were then fed into an OCR gadget? That's an efficient approach -- where I was, we had to write the FORTRAN [*] on coding sheets; KPOs would then produce the punched cards. [snip] > > 3) In some

Re: Should I use "if" or "try" (as a matter of speed)?

2005-07-10 Thread John Roth
"optimization." If it runs faster, that's a bonus. It frequently will, at least if you don't add method calls to the process. John Roth > > -- > Thomas > -- http://mail.python.org/mailman/listinfo/python-list

Re: Codecs

2005-07-10 Thread John Machin
Ivan Van Laningham wrote: > > It seems to me that if I want to try to read an unknown file > using an exhaustive list of possible encodings ... Supposing such a list existed: What do you mean by "unknown file"? That the encoding is unknown? Possibility 1: You are going to try to decode the fil

Re: extend for loop syntax with if expr like listcomp&genexp ?

2005-07-11 Thread John Machin
Bengt Richter wrote: > E.g., so we could write > > for x in seq if x is not None: Chundrous; looks like that p**l language ... > print repr(x), "isn't None ;-)" > > instead of > > for x in (x for x in seq if x is not None): Byzantine ... > print repr(x), "isn't None ;

Missing Something Simple

2005-07-12 Thread John Abel
. I thought of using setattr, but this code sits in a function, and not class, so I'm unsure what the object would be. I'm hoping someone can point me in the right direction. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing Something Simple

2005-07-12 Thread John Abel
harold fellermann wrote: >Hi, > > > >>I have a list of variables, which I am iterating over. I need to set >>the value of each variable. My code looks like: >> >>varList = [ varOne, varTwo, varThree, varFour ] >> >>for indivVar in varList: >>indivVar = returnVarFromFunction() >> >>However,

Re: Missing Something Simple

2005-07-12 Thread John Abel
>have been declared before being used in the list. Basically, I'm after >the Python way of using deferencing. > > OK, that should say dereferencing. J -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing Something Simple

2005-07-12 Thread John Abel
harold fellermann wrote: > >so, if I understand you right, what you want to have is a list of >mutable objects, whose value you can change without changing the >objects' >references. > > Yes! >class Proxy : > def __init__(self,val) : self.set(val) > def set(self,val) : self.val = v

Re: Slicing every element of a list

2005-07-12 Thread John Machin
Alex Dempsey wrote: > Recently I tried to slice every element of a list of strings. First I tried: "slice"? Interesting terminology. Next problem you have, try posting an example of your input, and your expected output. E.g. repr(input_string): '"foo"\t"barre"\t"zot"\t"X"\n' repr(output_list): [

Re: How to match literal backslashes read from a text file using regular expressions?

2005-07-12 Thread John Machin
[EMAIL PROTECTED] wrote: > I'm parsing a text file to extract word definitions. For example the > input text file contains the following content: > > di.va.gate \'di_--v*-.ga_-t\ vb > pas.sim \'pas-*m\ adv : here and there : THROUGHOUT > > I am trying to obtain words between two literal backslash

Re: append one file to another

2005-07-12 Thread John Machin
[EMAIL PROTECTED] wrote: > Hi, > > I want to append one (huge) file to another (huge) file. The current > way I'm doing it is to do something like: > > infile = open (infilename, 'r') > filestr = infile.read() > outfile = open(outfilename, 'a') > outfile.write(filestr) > > I wonder if there is

Re: Help with inverted dictionary

2005-07-12 Thread John Machin
[EMAIL PROTECTED] wrote: > I will transfer eventually use a database but is there any way for now > you could help me make the text files? Thank you so much. Reece > No. There is utterly no reason why you should create 5000 or 3 text files. While you are waiting to get a clue about databas

Re: all possible combinations

2005-07-13 Thread John Machin
Steven D'Aprano wrote: > On Wed, 13 Jul 2005 10:39:41 -0400, rbt wrote: [snip] > Ah, then that's easy. Sit down with pencil and paper, write out all 64 > combinations yourself, and then type them into a Python list. Then you can > access any one of those combinations with a single call. [snip] >>My

Re: all possible combinations

2005-07-13 Thread John Machin
rbt wrote: > On Wed, 2005-07-13 at 10:21 -0400, rbt wrote: > >>Say I have a list that has 3 letters in it: >> >>['a', 'b', 'c'] >> >>I want to print all the possible 4 digit combinations of those 3 >>letters: >> >>4^3 = 64 >> >> >>abaa >>aaba >>aaab >>acaa >>aaca >>aaac >>... >> >>What is the

Re: 2.4 Recent File list not working

2005-07-13 Thread John Machin
Larry Bates wrote: > I recently upgraded from 2.2 to 2.4 (ActiveState for Windows). > I was accustomed to having the most recent 10 files that I had > edited show up under File menu under Recent. "File menu" of what? Let's guess that you mean Pythonwin. The problem is now fixed. It is possible th

Re: Help - Classes and attributes

2005-07-13 Thread John Machin
rh0dium wrote: > Hi all, > > I believe I am having a fundamental problem with my class and I can't > seem to figure out what I am doing wrong. Basically I want a class > which can do several specific ldap queries. So in my code I would have > multiple searches. But I can't figure out how to do

Re: How can I import a py script by its absolute path name?

2005-07-14 Thread John Machin
Thorsten Kampe wrote: > * Edvard Majakari (2005-07-14 12:52 +0100) > >>could ildg <[EMAIL PROTECTED]> writes: >> >>>I want to import c:\xxx\yyy\zzz.py into my programme, >>>What should I do? >>>Thank you~ >> >>import sys >>sys.path.append('c:\xxx\yyy') > > > "sys.path.append('c:\\xxx\\yyy')" or

Re: all possible combinations

2005-07-14 Thread John Machin
Steven D'Aprano wrote: > On Thu, 14 Jul 2005 08:49:05 +1000, John Machin wrote: > > >>"You keep using that word. I do not think it means what you think it means." >> >>Both of you please google("define: combination") > > > Combinat

Re: all possible combinations

2005-07-14 Thread John Machin
rbt wrote: > Thanks to all who were helpful... some of you guys are too harsh and > cynical. Reality check: wander down to your nearest military establishment, ask a drill sergeant to demonstrate "harsh and cynical". > Here's what I came up with. I believe it's a proper > combination, but I'm su

Re: readlines() doesn't read entire file

2005-07-14 Thread John Machin
Jeremy wrote: > I have a most aggravating problem. I don't understand what is causing > readlines() not to read all the lines in the file. Answer all of Peter Hansen's questions, then read on ... You are on platform X; did you get the file from platform Y where Y != X? Where did you get the fi

SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol

2005-07-16 Thread John Reese
Morning. I've been running into an error message pertaining to SSL that I don't understand, and I was hoping someone had some insight. Gmail provides POP access over SSL on port 587, so I tried to use poplib.POP_SSL, with the following results: %python Python 2.4.1 (#1, May 16 2005, 15:19:29) [G

Re: SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol

2005-07-17 Thread John Reese
On Sun, 17 Jul 2005 11:05:06 +0100, Stephen Illingworth <[EMAIL PROTECTED]> wrote: > John Reese wrote: >> Morning. I've been running into an error message pertaining to SSL >> that I don't understand, and I was hoping someone had some insight. >> Gmail pro

Re: Python Programming Contest

2005-07-17 Thread John Hazen
begin your itinerary upon arrival.) Say I can find a combination of flights that gets me to the target at the end of day 3 for 390 units, and a combination that gets me there at the end of day 4 for 400. If you count the hostel cost from day 3 to day 4, the first combination costs 410. So, which

Re: Python Programming Contest

2005-07-17 Thread John Machin
John Hazen wrote: > * Brian Quinlan <[EMAIL PROTECTED]> [2005-07-15 02:08]: > >>You can find the first problem here: >>http://www.sweetapp.com/pycontest/contest1 > > > I have one question about the problem. Is the cost we are to minimize > the cost of arrivi

Re: goto

2005-07-18 Thread John Roth
> Fortunately you can't. Of course you can. Recent versions of Python have the ability to change where an element on the call stack will return to. Don't ask me to debug such a program unless you really want my unvarnished opinion of such stupidity. John Roth > > Mage > -- http://mail.python.org/mailman/listinfo/python-list

Re: Python scripts wont run - HELP

2005-07-18 Thread John Abel
windozbloz wrote: >Bye Bye Billy Bob... > >Hello All, >I'm a fairly literate windoz amateur programmer mostly in visual basic. I >have switched to SuSE 9.2 Pro and am trying to quickly come up to speed >with Python 2.3.4. I can run three or four line scripts from the command >line but have not be

Re: Xah's edu corner: on Microsoft hatred

2005-07-18 Thread John Bokma
s and sense, and doesn't contain fuck or similar words. -- John Small Perl scripts: http://johnbokma.com/perl/ Perl programmer available: http://castleamber.com/ Happy Customers: http://castleamber.com/testimonials.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's edu corner: on Microsoft hatred

2005-07-19 Thread John Bokma
"Malcolm" <[EMAIL PROTECTED]> wrote: > > "John Bokma" <[EMAIL PROTECTED]> wrote >> A typical Xah Lee posting... wake me up when he is able to write a >> single post that makes and sense, and doesn't contain fuck or similar >> words. &

Re: Xah's edu corner: on Microsoft hatred

2005-07-19 Thread John Bokma
"Default User" <[EMAIL PROTECTED]> wrote: > A good newsreader and aggressive use of filtering is the best way to > handle such people. The best way is to complain with their ISP/USP and have their account canceled. Kill filing (filtering) is just closin

Re: Web Framework Reviews

2005-07-19 Thread John Ziniti
[EMAIL PROTECTED] wrote: > I thought it would make sense to write up some of my experiences with > python based web frameworks: > > http://www.personal.psu.edu/staff/i/u/iua1/python_reviews.html > From the web-page: """ Zope - Generation Z ... Weakness: Not pythonic. In fact you can barely u

Re: Documentation bug: Python console behaviour changed

2005-07-19 Thread John Machin
Kay Schluehr wrote: > > Peter Hansen schrieb: > >>Kay Schluehr wrote: >> >>>The documentation of the Python console behaviour is not correct >>>anymore for Python 2.4.1. At least for the Win2K system I'm working on >>>'Ctrl-Z' does not shut down the console but 'Ctrl-D' etc. >>> >>>The Python int

Re: socket programming

2005-07-19 Thread John Hazen
the first one fails, your telnet client tries the second? I'm just guessing, since you didn't include what command you ran to do the telnet. As Grant mentioned, the telnet protocol doesn't do redirects. -John -- http://mail.python.org/mailman/listinfo/python-list

Re: is a file open ?

2005-07-20 Thread John Machin
luis wrote: > for root, dirs, files in os.walk(path): >for file in files: > # ¿ is opened ? > ¡ rtfm ! "files" is a list of fileNAMEs -- i.e. strings. ¿ How could you possibly imagine that your sample code would open a file? What a design-nonsense that would be: instant complaints from

Re: is a file open ?

2005-07-20 Thread John Machin
Daniel Dittmar wrote: > luis wrote: > >> for root, dirs, files in os.walk(path): >>for file in files: >> # ¿ is opened ? > > > On Linux and some other Unixes, you can probably read the /proc filesystem. > > On Windows, you'll probably get the quickest result by running > handle.exe (

Re: Generating images with text in them

2005-07-21 Thread John Abel
Have you downloaded the pilfonts.zip from effbot.org? J phil hunt wrote: >I am trying to generate some images (gifs or pngs) with text in >them. I can use the Python Imaging Library, but it only has access >to the default, rather crappy, font. > >Ideally I'd like to use one of the nicer fonts

Re: is a file open ?

2005-07-21 Thread John Machin
luis wrote: > John Machin wrote: > >> Daniel Dittmar wrote: >> >>> luis wrote: >>> >>>> for root, dirs, files in os.walk(path): >>>>for file in files: >>>> # ¿ is opened ? >>> >>> >>>

Re: Difference between " and '

2005-07-22 Thread John Machin
[EMAIL PROTECTED] wrote: > Hi, > > Can someone tell me the difference between single quote and double > quote? >>> ord("'") - ord('"') 5 or ask a meaningful question ... -- http://mail.python.org/mailman/listinfo/python-list

!Re: PEP on path module for standard library

2005-07-22 Thread John Roth
sense of dread: nobody has thought out how to do those functions in a useful oo manner. Path looks useable to me. Do I think it's going to be the last word? I sincerely hope not! The only way we're going to find out where it really needs to go from here, though, is to put it out and find o

Re: PEP on path module for standard library

2005-07-22 Thread John Roth
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > John Roth wrote: >> "Michael Hoffman" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Many of you are familiar with Jason Orendorff'

Re: problem with string

2005-07-22 Thread John Machin
Tzanko Tzanev wrote: > hi :) > I need some help for this script > I have > > cursor = conn.cursor() > cursor.execute("select * from playlist limit 5") > result = cursor.fetchall() > # iterate through resultset > playlist_txt = '' > for record in result: > mp3id = record[0] > mp

Re: find a specified dictionary in a list

2005-07-22 Thread John Machin
Odd-R. wrote: > I have this list: > > [{'i': 'milk', 'oid': 1}, {'i': 'butter', 'oid': 2},{'i':'cake','oid':3}] > > All the dictionaries of this list are of the same form, and all the oids > are distinct. If I have an oid and the list, how is the simplest way of > getting the dictionary that hold

Re: find a specified dictionary in a list

2005-07-22 Thread John Machin
John Machin wrote: > Odd-R. wrote: > >> I have this list: >> >> [{'i': 'milk', 'oid': 1}, {'i': 'butter', 'oid': 2},{'i':'cake','oid':3}] >> >> All the dictionaries

Re: find a specified dictionary in a list

2005-07-22 Thread John Machin
7;oid']] = d then you do this: current_dict = the_dict[current_oid] # Simpler than that it cannot be. Now a couple of questions for you: (1) Have you contemplated that an oid can appear more than once in the list? (2) What in tarnation is an "oid"? Cheers, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between " and '

2005-07-22 Thread John Machin
Peter Hansen wrote: > Steven D'Aprano wrote: > >> It may shock some people to learn that difference in the sense of >> mathematical subtraction is not the only meaning of the word, but >> there it is. One wouldn't, I hope, misunderstand "What is the >> difference between spaghetti marinara and

Re: PEP on path module for standard library

2005-07-22 Thread John Roth
rner cases file system object (or object hierarchy, etc) has been discussed before, and nothing has ever come of it. Starting with an object that actually does something some people want gives the designers a chance to look at things in the wild. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP on path module for standard library

2005-07-22 Thread John Roth
"Duncan Booth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > John Roth wrote: >> You have to start somewhere. One of the lessons that's beginning >> to seep into people's minds is that getting something that works >> out the

<    9   10   11   12   13   14   15   16   17   18   >