Re: String pattern matching

2006-04-03 Thread Kent Johnson
'] print 'z =', subject['z'] Output is v = ee w = ac x = abc y = a z = aab Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: String pattern matching

2006-04-03 Thread Kent Johnson
-greedy (.+?) and get this result: ('ee', 'bcac', 'a', 'bca', 'aab') Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: running IDLE from another program?

2006-04-01 Thread Kent Johnson
John Salerno wrote: Kent Johnson wrote: John Salerno wrote: Kent Johnson wrote: You probably don't need to do that. Just run the file in python directly. I don't know UE, but when you configure an external tool, tell it to run python.exe and pass the current file as a command line parameter

Re: Python 2.5 licensing: stop this change

2006-04-01 Thread Kent Johnson
this platform, it is again in production. http://paperforest.blogspot.com/2006/02/digi-comp-1.html Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: running IDLE from another program?

2006-04-01 Thread Kent Johnson
John Salerno wrote: Kent Johnson wrote: One thing that is really useful about running in an editor window is that (in TextPad, anyway) I can double-click on an error message and go directly to the line with the error. Interesting. The way I have it now, it shows errors the way I want

Re: running IDLE from another program?

2006-04-01 Thread Kent Johnson
John Salerno wrote: Kent Johnson wrote: The working directory must be wrong. Try calling Python directly with full paths: C:\Python24\pythonw C:\Python24\Lib\idlelib\idle.pyw -r C:\path\to\myprog.py Perfect! Thank you so much! I put this line in the command line field, and I left

Re: Doc suggestions

2006-04-01 Thread Kent Johnson
://docs.python.org/about.html Submitting a proposed change or fix is easier and quicker than arguing about it on c.l.py and it seems to get pretty quickly to the actual document maintainers. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: How to debug python code?

2006-03-31 Thread Kent Johnson
://www.digitalpeers.com/pythondebugger/ Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: member variables in python

2006-03-31 Thread Kent Johnson
of member variables? class AA: def __init__(...): self.test_flag = 0 def methos(self,...): self.test_flag = xx Note 'test-flag' is not a valid name. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: member variables in python

2006-03-31 Thread Kent Johnson
): if self.aa.testflag: 2. Pass the flag to BB.method() directly: def method(self, testflag): if testflag: Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: logging producing redundant entries

2006-03-31 Thread Kent Johnson
the logging setup somewhere else, in a module that is only loaded once? Or inspect _logger.handlers to see if it already contains a FileHandler to your log file, and only add it if it is not there already. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: running IDLE from another program?

2006-03-31 Thread Kent Johnson
as a command line parameter. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: logging producing redundant entries

2006-03-31 Thread Kent Johnson
Jed Parsons wrote: Thanks, Kent and Peter, Definitely making progress here. I've got propagate = 0, and am testing for handlers before doing any addHandler business. (The handlers test seems to make the most difference.) I'm down to two entries per time now! And prodding Zope

Re: running IDLE from another program?

2006-03-31 Thread Kent Johnson
John Salerno wrote: Kent Johnson wrote: You probably don't need to do that. Just run the file in python directly. I don't know UE, but when you configure an external tool, tell it to run python.exe and pass the current file as a command line parameter. I've tried a lot of combinations

Re: a hobbyist's dilemma

2006-03-30 Thread Kent Johnson
with SQLObject or SQLAlchemy). There are pesky differences in data types and how to pass parameters but the basics are the same. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Seems like I want a pre-processor, but...

2006-03-28 Thread Kent Johnson
In general the idea is to move the test from 'every time I need to do something' to 'once when some name is defined'. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: tips for this exercise?

2006-03-28 Thread Kent Johnson
lottery numbers, performance would have to be truly awful before you even noticed. Don't optimize until you have identified a problem. Python is pretty fast for most of the things you will want to do with it. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: pysqlite

2006-03-27 Thread Kent Johnson
abcd wrote: anyone have v2.x of pysqlite that I could download? the website is down for a hardware upgrade with no date as to when it will be back. I need v 2.x for windows, running python v2.4 I sent pysqlite-2.0.4.win32-py2.4.exe Kent -- http://mail.python.org/mailman/listinfo/python

Re: pysqlite

2006-03-27 Thread Kent Johnson
Kent Johnson wrote: abcd wrote: anyone have v2.x of pysqlite that I could download? the website is down for a hardware upgrade with no date as to when it will be back. I need v 2.x for windows, running python v2.4 I sent pysqlite-2.0.4.win32-py2.4.exe Well tried, anyway, someone

Re: [ANN] Firedrop 0.2.0 - The Python Blog Client

2006-03-26 Thread Kent Johnson
Fuzzyman wrote: It has finally happened, the release of `Firedrop 0.2.0 * `ConfigObj http://www.voidspace.org.uk/python/configobj.html`_ is now used to edit all the config files. You should add this to the dependency list in the install page, it tripped me up. Kent -- http

Re: how to format a return value by using re.sub(regx,rep1,str)?

2006-03-25 Thread Kent Johnson
a group to capture the text between a and /a: In [10]: re.sub('a( [^]+)+\s?([^^]*)/a',r'\2',' asd gaa target=_blank href=http://www.sine.com; class=wordstyle asdgasdghae rha/a') Out[10]: ' asd ga asdgasdghae rha' Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Custom behavior defined in the imported module

2006-03-25 Thread Kent Johnson
= \ ParserElement.packratParse,ParserElement.parse Then users would just import pyparsingpackrat instead of pyparsing. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing func_name from inside a function

2006-03-25 Thread Kent Johnson
James Thiele wrote: I'd like to access the name of a function from inside the function. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062 Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: converting to a binary number?

2006-03-24 Thread Kent Johnson
John Salerno wrote: I'm having some trouble finding a function that converts numbers (whether integer, hex, whatever) to its binary representation. Is there one? You might like this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286 Kent -- http://mail.python.org/mailman

Re: Why are so many built-in types inheritable?

2006-03-24 Thread Kent Johnson
(self, func): self.func = func def __call__(self, *args, **kwargs): print args, kwargs return self.func(*args, **kwargs) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: don't understand popen2

2006-03-24 Thread Kent Johnson
Sion Arrowsmith wrote: Kent Johnson [EMAIL PROTECTED] wrote: Sion Arrowsmith wrote: (and please avoid the abuse of raw strings for Windows paths). Why do you consider that abuse of raw strings? I consider it abuse because it's not what they were invented for. I consider discouraging

Re: don't understand popen2

2006-03-23 Thread Kent Johnson
very easy and convenient to copy a path from Windows Explorer and paste it directly into a raw string, no editing required. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Use of Python with GDAL. How to speed up ?

2006-03-22 Thread Kent Johnson
collects statistics for functions, not for individual lines of code. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: struct size confusion:

2006-03-22 Thread Kent Johnson
= HHHI which is 34 bytes Are you sure? Not for me: In [9]: struct.calcsize('HHHI') Out[9]: 36 Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: string.upto() and string.from()

2006-03-22 Thread Kent Johnson
, world !' Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: string.upto() and string.from()

2006-03-22 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Sure, you're right I forgot about rsplit ! I guess the negative indexes al could be done with sep.join(xyz.split(sep)[:index]) For index=-1 use xyz.rsplit(sep, 1)[0] Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Why TypeError: 'str' object is not callable?

2006-03-22 Thread Kent Johnson
message is, when you write a(b) Python interprets this as, call the object a, passing the parameter b. If a is a string - a 'str' object - Python attempts to call the string. Strings are not callable so you get the error message you see. Kent -- http://mail.python.org/mailman/listinfo/python

Re: Can't get the real contents form page in internet as the tag no-chche

2006-03-22 Thread Kent Johnson
-equiv=Pragma content=no-cache/HEADbody?y?ú'ò?aò3??.../body/html The page is in Chinese (I think), when you print the data it is printing in your console encoding which is apparently not Chinese. What did you expect to see? Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing PyExcelerator to write Excel files from Python

2006-03-21 Thread Kent Johnson
into site-packages. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: ** Operator

2006-03-20 Thread Kent Johnson
happen is to submit a bug report with your suggested change. See the link at the bottom of the above page to find out how. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting number of each item in a list.

2006-03-19 Thread Kent Johnson
will be dramatically faster for large lists as it only iterates str_list once. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-18 Thread Kent Johnson
John Machin wrote: I am pleased to announce a new general release (0.5.2) of xlrd, a Python package for extracting data from Microsoft Excel spreadsheets. How does xlrd compare with pyexcelerator? At a glance they look pretty similar. Thanks, Kent -- http://mail.python.org/mailman/listinfo

Re: POP3 Python Mail Download

2006-03-18 Thread Kent Johnson
(msg, )[0] msgSize = int(split(msg, )[1] You have an inconsistent indent in the two lines above. All the lines in a block must have the same indent (except sub-blocks of course). Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-18 Thread Kent Johnson
John Machin wrote: On 19/03/2006 8:31 AM, Kent Johnson wrote: How does xlrd compare with pyexcelerator? At a glance they look pretty similar. I have an obvious bias, so I'll just leave you with a not-very-PC analogy to think about: Depending on the ambient light and the quantity of mead

Re: POP3 Mail Download

2006-03-18 Thread Kent Johnson
'stdin'. raw_input() prompts to stdout and reads from stdin. print outputs to stdout: In [53]: print raw_input('What is your name? ') What is your name? Kent Kent or import sys and use sys.stdin and sys.stdout. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I use a conditional in a variable declaration?

2006-03-18 Thread Kent Johnson
to fix it isn't worth the trouble; just spell out the if / else. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting arguments of a function - possible?

2006-03-17 Thread Kent Johnson
raise KeyboardInterrupt Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing Hints

2006-03-17 Thread Kent Johnson
where the key is everything before the first colon, just use line.split(':', 1) to split on just the first colon. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Install Universal Encoding Detector

2006-03-16 Thread Kent Johnson
Jacob wrote: How do I uninstall? Delete the chardet folder from site-packages (Python24\Lib\site-packages on Windows, not sure of the exact path on other OS's). Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting nested loop iterations

2006-03-16 Thread Kent Johnson
() gives the total count. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Little Help with Exceptions and ConfigParser

2006-03-15 Thread Kent Johnson
configuration file. %s %err HTH Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Install Universal Encoding Detector

2006-03-15 Thread Kent Johnson
Jacob wrote: How do I install Universal Encoding Detector (http://chardet.feedparser.org/)? The usual process: download unpack with your favorite tool - tar or WinZip, maybe cd chardet-1.0 python setup.py install Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Localized month names?

2006-03-14 Thread Kent Johnson
has no attribute 'nl_langinfo' Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Little Help with Exceptions and ConfigParser

2006-03-14 Thread Kent Johnson
exceptions are subclasses of ConfigParser.Error so if you catch that instead of ConfigParser.ParsingError your code will catch NoSectionError as well. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Please, I Have A Question before I get started

2006-03-13 Thread Kent Johnson
Ravi Teja wrote: I do not think that technology has gone backwards. Hyper card alternatives still exist. http://www.metacard.com/ At $995 per seat it's not likely to be used for a home project. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: trying to find repeated substrings with regular expression

2006-03-13 Thread Kent Johnson
'. I've tried numerous variations on '.*(FOO((?!FOO).)*)+.*' and everything I've tried either matches too much or too little. FOO(.*?)(?=FOO|$) I've decided it's easier for me just to search for FOO, and then break up the string based on the locations of FOO. Use re.split() for this. Kent

Re: Python Love :)

2006-03-13 Thread Kent Johnson
Paul Rubin wrote: So what's the most concise way of turning it back into a string? ''.join(list(reversed(a_string))) ? You don't need the list(), join() can take an iterator: ''.join(reversed(a_string)) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this possible in Python?

2006-03-13 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hello again, I am disappointed. You are the experts, you've got to try harder ;-) What i want is a generalisation of this tiny function: Why? Maybe we can find a better way... Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: lighter weight options to Python's logging package?

2006-03-12 Thread Kent Johnson
%(created)f rather than %(asctime)s in your format. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-09 Thread Kent Johnson
provenance as well. From xx import * is evil because it does hide the provenance of names. It can also give unexpected results - if xx contains from zz import *, then all of the names from zz will also be imported into the module importing xx! Kent -- http://mail.python.org/mailman/listinfo/python

Re: cgi problem

2006-03-09 Thread Kent Johnson
Paul Rubin wrote: Tim Roberts [EMAIL PROTECTED] writes: Yes, but the CGI module doesn't write anything, so the advice of writing a Location: header still applies. Aha, it's coming from CGIHTTPServer.py:CGIHTTPRequestHandler.run_cgi() where it says self.send_response(200, Script

Re: generators shared among threads

2006-03-08 Thread Kent Johnson
execute until the yield returns. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: cgi problem

2006-03-08 Thread Kent Johnson
://hoohoo.ncsa.uiuc.edu/cgi/out.html http://www.algonet.se/~ug/html+pycgi/redirect.html Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting File Permissions

2006-03-07 Thread Kent Johnson
call last): File stdin, line 1, in ? NameError: name 'octal' is not defined The correct name is oct(). The docs on built-in functions are helpful here: http://docs.python.org/lib/built-in-funcs.html Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Python version of XMLUnit?

2006-03-06 Thread Kent Johnson
exactly the error including XPath expressions to the node containing the error! In Jython I use unittest, not JUnit, so instead of subclassing XMLTestCase I call the static methods of XLMAssert from my test cases. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggesting the use of StandardError as base of error Exceptions.

2006-03-06 Thread Kent Johnson
that the time machine is stil working ;) http://www.python.org/peps/pep-0352.html Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Mixin class error

2006-03-06 Thread Kent Johnson
Py_TPFLAGS_BASETYPE is not set. Whether this is by design or accident would be a question for the kinterbasdb developers. One workaround might be to use delegation instead of subclassing... Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Java

2006-03-06 Thread Kent Johnson
and there is (slow) progress being made in modernizing it. I recommend it. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Does '#hash' mean anything in IDLE?

2006-03-06 Thread Kent Johnson
of objects which don't directly support any comparison methods that the cmp builtin understands. Using the index as above prevents the objects from ever being compared. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this not infinite?

2006-03-06 Thread Kent Johnson
).__init__(etc...) Obviously I'm missing a piece of information that would help me to see why the call gets passed back up to Base... It's a typo in the book. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Mixin class error

2006-03-06 Thread Kent Johnson
Ed Leafe wrote: On Mar 6, 2006, at 8:08 PM, Kent Johnson wrote: One workaround might be to use delegation instead of subclassing... Yeah, but that would involve a lot more work at this point. The mixin approach has been working quite well up until this problem. Automatic delegation

Re: how to overload sqrt in a module?

2006-03-05 Thread Kent Johnson
implement all the functions you use from math. Kent -- http://mail.python.org/mailman/listinfo/python-list

Python version of XMLUnit?

2006-03-05 Thread Kent Johnson
). Thanks, Kent http://xmlunit.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread Kent Johnson
\\A', snip lots more dirs] foo.baz() here Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread Kent Johnson
(which does most of the setup of sys.path), one element of the path is an empty string. This is expanded by main() - removeduppaths() - makepath() - os.path.abspath() to the current working dir. This is Python 2.4.2 on Win2K. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Package organization: where to put 'common' modules?

2006-03-04 Thread Kent Johnson
package to hold commonly used code. Then B and D both use from util import foo In Python 2.5 you will be able to say (in D, for example) from ..util import foo http://www.python.org/peps/pep-0328.html Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: spliting on :

2006-03-04 Thread Kent Johnson
...: xxx.xxx.xxx.xxx ...: xxx.xxx.xxx.xxx:yyy'''.splitlines() In [3]: for line in data: ...: print line.split(':')[-1] ...: ...: yyy yyy yyy xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx yyy Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: in need of some sorting help

2006-03-03 Thread Kent Johnson
on: def make_key(f): return (os.path.dirname(f), f.lower()) files.sort(key=make_key) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: object's list index

2006-03-03 Thread Kent Johnson
inside the loop, this replaces your original loop: for i, object in enumerate(lst): print i Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Kent Johnson
Laszlo Zsolt Nagy wrote: The values of some inputs are encoded using html entities. How can I decode a string like Bessy#39;s cat in Bessy's cat? http://groups.google.com/group/comp.lang.python/browse_frm/thread/819731a536a4c1a2/fce6c2f6c3d46e9c?q=htmlentitydefsrnum=2#fce6c2f6c3d46e9c Kent

Re: in need of some sorting help

2006-03-02 Thread Kent Johnson
for lambda walk_files.sort(key=str.lower) # etc Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Proper class initialization

2006-03-02 Thread Kent Johnson
the superclass __init__ as well: class __metaclass__(type): def __init__(cls, name, bases, classdict): super(__metaclass__, cls).__init__(name, bases, classdict) cls.sum = sum(xrange(10)) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: setattr question

2006-03-02 Thread Kent Johnson
the same sort of thing without 'apply'. Apply has been replaced by 'extended call syntax', that is why it is deprecated. Instead of return apply(self._function,_args,_kargs) write return self._function(*_args, **_kargs) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: how to overload sqrt in a module?

2006-03-02 Thread Kent Johnson
): Compute sqrt of x return sqrt(x) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: error: argument after ** must be a dictionary

2006-03-01 Thread Kent Johnson
, *args, **kwargs).start() No. threading.Thread() doesn't use *args, **kwargs, it uses explicit named parameters. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Fetching the Return results of a spawned Thread

2006-02-28 Thread Kent Johnson
://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/435883 Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Thread Question

2006-02-28 Thread Kent Johnson
a class. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Kent Johnson
.iteritems()) {1: 'A', 2: 'B', 4: 'C'} Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Waiting for Connection

2006-02-27 Thread Kent Johnson
may give you some help though it may be more complex than you need: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: different ways to strip strings

2006-02-27 Thread Kent Johnson
() gets a bound method object from the class and calls it with no additional argument. str.strip(s) gets an unbound method object from the class and calls it, passing a class instance as the first argument. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: different ways to strip strings

2006-02-27 Thread Kent Johnson
Crutcher wrote: It is something of a navel (left over feature). xyz.strip() is (I think) newer than string.strip() Yes, but the question as written was about str.strip() which is an unbound method of the str class, not string.strip() which is a deprecated function in the string module. Kent

Re: type = instance instead of dict

2006-02-27 Thread Kent Johnson
UserDict.IterableUserDict which does support iteration. I don't think there is much reason to use UserDict in modern Python as dict can be subclassed. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: type = instance instead of dict

2006-02-27 Thread Kent Johnson
'itervalues' What version of Python are you using? itervalues() is in Python 2.2 and later. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: sort one list using the values from another list

2006-02-27 Thread Kent Johnson
it is a just a plain variable or like something pattern matching in Haskell. _ is just a plain variable name in Python. It is sometimes when a variable is needed to receive a value that won't be used. So your example was correct and idiomatic but functionally identical to mine. Kent -- http

Re: sort one list using the values from another list

2006-02-26 Thread Kent Johnson
to do what I want here? The example above does not sort in place, if you want it to be in place use A[:] = [a for b,a in sorted(zip(B,A))] Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding Problem (arbitrary thread sych)

2006-02-26 Thread Kent Johnson
of Semaphores: http://greenteapress.com/semaphores/ It requires that you know in advance how many threads need to rendezvous so you will have to preprocess your args a little. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I find the remainder when dividing 2 integers

2006-02-26 Thread Kent Johnson
the last one left off, put a global statement inside getText() so Python knows colorIndex is global: def getText(nodelist): global colorIndex for str in strings: print colors[colorIndex % colors.length] colorIndex += 1 Kent

Re: ls files -- list packer

2006-02-26 Thread Kent Johnson
try the index: http://docs.python.org/lib/genindex.html how do i either grab the full path or append it later ... Use os.path.join(): base = '/some/useful/path' for f in os.listdir(base): full_path_to_file = os.path.join(base, f) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode question

2006-02-25 Thread Kent Johnson
\\xe8 def' s='abc \xff\xe8 def' s.encode('string_escape') 'abc \\xff\\xe8 def' unicode(s.encode('string_escape')) u'abc \\xff\\xe8 def' Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Import in a separate thread

2006-02-25 Thread Kent Johnson
of the whole program and all needed library modules. If this is expensive, you can break up the loads by putting key imports into functions instead of at global scope. Note to the doubters - I have used these techniques in Jython programs, where importing java packages can be noticably slow. Kent

Re: Is Python a Zen language?

2006-02-25 Thread Kent Johnson
more an attitude of try it, you'll like it!. Using Python does seem to spoil people - I for one hate to code in Java now. Maybe bliss is a better word for it than satori. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: How to send an email with non-ascii characters in Python

2006-02-25 Thread Kent Johnson
Gabriel B. wrote: what does a string became when it's decoded? I mean, it must be encoded in something, right? Unicode, for encodings like latin-1 or utf-8. A few special cases like str.decode('string_escape') yield byte strings again. Kent -- http://mail.python.org/mailman/listinfo/python

Re: A C-like if statement

2006-02-24 Thread Kent Johnson
= ' ... ' Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: problem(s) with import from parent dir: from ../brave.py import sir_robin

2006-02-24 Thread Kent Johnson
for an import (and what worked from the command line). Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: a little more help with python server-side scripting

2006-02-24 Thread Kent Johnson
John Salerno wrote: Kent Johnson wrote: John Salerno wrote: Magnus Lycka wrote: The other option is ASP. You have been given information about that already. Be aware that ASP does not imply VBScript. You can use Python in ASP as long as that's enabled. It seems to be exactly what you

<    1   2   3   4   5   6   7   8   9   >